1
0

a_players.inc 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. /* SA-MP Player Functions
  2. *
  3. * (c) Copyright 2005-2012, SA-MP Team
  4. *
  5. */
  6. #if defined _players_included
  7. #endinput
  8. #endif
  9. #define _players_included
  10. #pragma library players
  11. #define SPECIAL_ACTION_NONE 0
  12. #define SPECIAL_ACTION_DUCK 1
  13. #define SPECIAL_ACTION_USEJETPACK 2
  14. #define SPECIAL_ACTION_ENTER_VEHICLE 3
  15. #define SPECIAL_ACTION_EXIT_VEHICLE 4
  16. #define SPECIAL_ACTION_DANCE1 5
  17. #define SPECIAL_ACTION_DANCE2 6
  18. #define SPECIAL_ACTION_DANCE3 7
  19. #define SPECIAL_ACTION_DANCE4 8
  20. #define SPECIAL_ACTION_HANDSUP 10
  21. #define SPECIAL_ACTION_USECELLPHONE 11
  22. #define SPECIAL_ACTION_SITTING 12
  23. #define SPECIAL_ACTION_STOPUSECELLPHONE 13
  24. #define SPECIAL_ACTION_DRINK_BEER 20
  25. #define SPECIAL_ACTION_SMOKE_CIGGY 21
  26. #define SPECIAL_ACTION_DRINK_WINE 22
  27. #define SPECIAL_ACTION_DRINK_SPRUNK 23
  28. #define SPECIAL_ACTION_CUFFED 24
  29. #define FIGHT_STYLE_NORMAL 4
  30. #define FIGHT_STYLE_BOXING 5
  31. #define FIGHT_STYLE_KUNGFU 6
  32. #define FIGHT_STYLE_KNEEHEAD 7
  33. #define FIGHT_STYLE_GRABKICK 15
  34. #define FIGHT_STYLE_ELBOW 16
  35. #define WEAPONSKILL_PISTOL 0
  36. #define WEAPONSKILL_PISTOL_SILENCED 1
  37. #define WEAPONSKILL_DESERT_EAGLE 2
  38. #define WEAPONSKILL_SHOTGUN 3
  39. #define WEAPONSKILL_SAWNOFF_SHOTGUN 4
  40. #define WEAPONSKILL_SPAS12_SHOTGUN 5
  41. #define WEAPONSKILL_MICRO_UZI 6
  42. #define WEAPONSKILL_MP5 7
  43. #define WEAPONSKILL_AK47 8
  44. #define WEAPONSKILL_M4 9
  45. #define WEAPONSKILL_SNIPERRIFLE 10
  46. #define WEAPONSTATE_UNKNOWN -1
  47. #define WEAPONSTATE_NO_BULLETS 0
  48. #define WEAPONSTATE_LAST_BULLET 1
  49. #define WEAPONSTATE_MORE_BULLETS 2
  50. #define WEAPONSTATE_RELOADING 3
  51. // Player
  52. native SetSpawnInfo(playerid, team, skin, Float:x, Float:y, Float:z, Float:rotation, weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo);
  53. native SpawnPlayer(playerid);
  54. // Player info
  55. native SetPlayerPos(playerid, Float:x, Float:y, Float:z);
  56. native SetPlayerPosFindZ(playerid, Float:x, Float:y, Float:z);
  57. native GetPlayerPos(playerid, &Float:x, &Float:y, &Float:z);
  58. native SetPlayerFacingAngle(playerid,Float:ang);
  59. native GetPlayerFacingAngle(playerid,&Float:ang);
  60. native IsPlayerInRangeOfPoint(playerid, Float:range, Float:x, Float:y, Float:z);
  61. native Float:GetPlayerDistanceFromPoint(playerid, Float:X, Float:Y, Float:Z);
  62. native IsPlayerStreamedIn(playerid, forplayerid);
  63. native SetPlayerInterior(playerid,interiorid);
  64. native GetPlayerInterior(playerid);
  65. native SetPlayerHealth(playerid, Float:health);
  66. native GetPlayerHealth(playerid, &Float:health);
  67. native SetPlayerArmour(playerid, Float:armour);
  68. native GetPlayerArmour(playerid, &Float:armour);
  69. native SetPlayerAmmo(playerid, weaponslot, ammo);
  70. native GetPlayerAmmo(playerid);
  71. native GetPlayerWeaponState(playerid);
  72. native GetPlayerTargetPlayer(playerid);
  73. native SetPlayerTeam(playerid, teamid);
  74. native GetPlayerTeam(playerid);
  75. native SetPlayerScore(playerid,score);
  76. native GetPlayerScore(playerid);
  77. native GetPlayerDrunkLevel(playerid);
  78. native SetPlayerDrunkLevel(playerid, level);
  79. native SetPlayerColor(playerid,color);
  80. native GetPlayerColor(playerid);
  81. native SetPlayerSkin(playerid, skinid);
  82. native GetPlayerSkin(playerid);
  83. native GivePlayerWeapon(playerid, weaponid, ammo);
  84. native ResetPlayerWeapons(playerid);
  85. native SetPlayerArmedWeapon(playerid, weaponid);
  86. native GetPlayerWeaponData(playerid, slot, &weapons, &ammo);
  87. native GivePlayerMoney(playerid,money);
  88. native ResetPlayerMoney(playerid);
  89. native SetPlayerName(playerid, const name[]);
  90. native GetPlayerMoney(playerid);
  91. native GetPlayerState(playerid);
  92. native GetPlayerIp(playerid, name[], len);
  93. native GetPlayerPing(playerid);
  94. native GetPlayerWeapon(playerid);
  95. native GetPlayerKeys(playerid, &keys, &updown, &leftright);
  96. native GetPlayerName(playerid, const name[], len);
  97. native SetPlayerTime(playerid, hour, minute);
  98. native GetPlayerTime(playerid, &hour, &minute);
  99. native TogglePlayerClock(playerid, toggle);
  100. native SetPlayerWeather(playerid, weather);
  101. native ForceClassSelection(playerid);
  102. native SetPlayerWantedLevel(playerid, level);
  103. native GetPlayerWantedLevel(playerid);
  104. native SetPlayerFightingStyle(playerid, style);
  105. native GetPlayerFightingStyle(playerid);
  106. native SetPlayerVelocity(playerid, Float:X, Float:Y, Float:Z);
  107. native GetPlayerVelocity( playerid, &Float:X, &Float:Y, &Float:Z );
  108. native PlayCrimeReportForPlayer(playerid, suspectid, crime);
  109. native PlayAudioStreamForPlayer(playerid, url[], Float:posX = 0.0, Float:posY = 0.0, Float:posZ = 0.0, Float:distance = 50.0, usepos = 0);
  110. native StopAudioStreamForPlayer(playerid);
  111. native SetPlayerShopName(playerid, shopname[]);
  112. native SetPlayerSkillLevel(playerid, skill, level);
  113. native GetPlayerSurfingVehicleID(playerid);
  114. native GetPlayerSurfingObjectID(playerid);
  115. native RemoveBuildingForPlayer(playerid, modelid, Float:fX, Float:fY, Float:fZ, Float:fRadius);
  116. // Attached to bone objects
  117. #define MAX_PLAYER_ATTACHED_OBJECTS 10 // This is the number of attached indexes available ie 10 = 0-9
  118. native SetPlayerAttachedObject(playerid, index, modelid, bone, Float:fOffsetX = 0.0, Float:fOffsetY = 0.0, Float:fOffsetZ = 0.0, Float:fRotX = 0.0, Float:fRotY = 0.0, Float:fRotZ = 0.0, Float:fScaleX = 1.0, Float:fScaleY = 1.0, Float:fScaleZ = 1.0, materialcolor1 = 0, materialcolor2 = 0);
  119. native RemovePlayerAttachedObject(playerid, index);
  120. native IsPlayerAttachedObjectSlotUsed(playerid, index);
  121. native EditAttachedObject(playerid, index);
  122. // Per-player TextDraws
  123. native PlayerText:CreatePlayerTextDraw(playerid, Float:x, Float:y, text[]);
  124. native PlayerTextDrawDestroy(playerid, PlayerText:text);
  125. native PlayerTextDrawLetterSize(playerid, PlayerText:text, Float:x, Float:y);
  126. native PlayerTextDrawTextSize(playerid, PlayerText:text, Float:x, Float:y);
  127. native PlayerTextDrawAlignment(playerid, PlayerText:text, alignment);
  128. native PlayerTextDrawColor(playerid, PlayerText:text, color);
  129. native PlayerTextDrawUseBox(playerid, PlayerText:text, use);
  130. native PlayerTextDrawBoxColor(playerid, PlayerText:text, color);
  131. native PlayerTextDrawSetShadow(playerid, PlayerText:text, size);
  132. native PlayerTextDrawSetOutline(playerid, PlayerText:text, size);
  133. native PlayerTextDrawBackgroundColor(playerid, PlayerText:text, color);
  134. native PlayerTextDrawFont(playerid, PlayerText:text, font);
  135. native PlayerTextDrawSetProportional(playerid, PlayerText:text, set);
  136. native PlayerTextDrawSetSelectable(playerid, PlayerText:text, set);
  137. native PlayerTextDrawShow(playerid, PlayerText:text);
  138. native PlayerTextDrawHide(playerid, PlayerText:text);
  139. native PlayerTextDrawSetString(playerid, PlayerText:text, string[]);
  140. // Per-player variable system (PVars)
  141. native SetPVarInt(playerid, varname[], int_value);
  142. native GetPVarInt(playerid, varname[]);
  143. native SetPVarString(playerid, varname[], string_value[]);
  144. native GetPVarString(playerid, varname[], string_return[], len);
  145. native SetPVarFloat(playerid, varname[], Float:float_value);
  146. native Float:GetPVarFloat(playerid, varname[]);
  147. native DeletePVar(playerid, varname[]);
  148. // PVar enumeration
  149. #define PLAYER_VARTYPE_NONE 0
  150. #define PLAYER_VARTYPE_INT 1
  151. #define PLAYER_VARTYPE_STRING 2
  152. #define PLAYER_VARTYPE_FLOAT 3
  153. native GetPVarsUpperIndex(playerid);
  154. native GetPVarNameAtIndex(playerid, index, ret_varname[], ret_len);
  155. native GetPVarType(playerid, varname[]);
  156. #define MAX_CHATBUBBLE_LENGTH 144
  157. native SetPlayerChatBubble(playerid, text[], color, Float:drawdistance, expiretime);
  158. // Player controls
  159. native PutPlayerInVehicle(playerid, vehicleid, seatid);
  160. native GetPlayerVehicleID(playerid);
  161. native GetPlayerVehicleSeat(playerid);
  162. native RemovePlayerFromVehicle(playerid);
  163. native TogglePlayerControllable(playerid, toggle);
  164. native PlayerPlaySound(playerid, soundid, Float:x, Float:y, Float:z);
  165. native ApplyAnimation(playerid, animlib[], animname[], Float:fDelta, loop, lockx, locky, freeze, time, forcesync = 0);
  166. native ClearAnimations(playerid, forcesync = 0);
  167. native GetPlayerAnimationIndex(playerid); // return the index of any running applied animations (0 if none are running)
  168. native GetAnimationName(index, animlib[], len1, animname[], len2); // get the animation lib/name for the index
  169. native GetPlayerSpecialAction(playerid);
  170. native SetPlayerSpecialAction(playerid,actionid);
  171. // Player world/map related
  172. native SetPlayerCheckpoint(playerid, Float:x, Float:y, Float:z, Float:size);
  173. native DisablePlayerCheckpoint(playerid);
  174. native SetPlayerRaceCheckpoint(playerid, type, Float:x, Float:y, Float:z, Float:nextx, Float:nexty, Float:nextz, Float:size);
  175. native DisablePlayerRaceCheckpoint(playerid);
  176. native SetPlayerWorldBounds(playerid,Float:x_max,Float:x_min,Float:y_max,Float:y_min);
  177. native SetPlayerMarkerForPlayer(playerid, showplayerid, color);
  178. native ShowPlayerNameTagForPlayer(playerid, showplayerid, show);
  179. #define MAPICON_LOCAL 0 // displays in the player's local are
  180. #define MAPICON_GLOBAL 1 // displays always
  181. #define MAPICON_LOCAL_CHECKPOINT 2 // displays in the player's local area and has a checkpoint marker
  182. #define MAPICON_GLOBAL_CHECKPOINT 3 // displays always and has a checkpoint marker
  183. native SetPlayerMapIcon(playerid, iconid, Float:x, Float:y, Float:z, markertype, color, style = MAPICON_LOCAL);
  184. native RemovePlayerMapIcon(playerid, iconid);
  185. native AllowPlayerTeleport(playerid, allow);
  186. // Player camera
  187. native SetPlayerCameraPos(playerid,Float:x, Float:y, Float:z);
  188. #define CAMERA_CUT 2
  189. #define CAMERA_MOVE 1
  190. native SetPlayerCameraLookAt(playerid, Float:x, Float:y, Float:z, cut = CAMERA_CUT);
  191. native SetCameraBehindPlayer(playerid);
  192. native GetPlayerCameraPos(playerid, &Float:x, &Float:y, &Float:z);
  193. native GetPlayerCameraFrontVector(playerid, &Float:x, &Float:y, &Float:z);
  194. native GetPlayerCameraMode(playerid);
  195. native AttachCameraToObject(playerid, objectid);
  196. native AttachCameraToPlayerObject(playerid, playerobjectid);
  197. native InterpolateCameraPos(playerid, Float:FromX, Float:FromY, Float:FromZ, Float:ToX, Float:ToY, Float:ToZ, time, cut = CAMERA_CUT);
  198. native InterpolateCameraLookAt(playerid, Float:FromX, Float:FromY, Float:FromZ, Float:ToX, Float:ToY, Float:ToZ, time, cut = CAMERA_CUT);
  199. // Player conditionals
  200. native IsPlayerConnected(playerid);
  201. native IsPlayerInVehicle(playerid, vehicleid);
  202. native IsPlayerInAnyVehicle(playerid);
  203. native IsPlayerInCheckpoint(playerid);
  204. native IsPlayerInRaceCheckpoint(playerid);
  205. // Virtual Worlds
  206. native SetPlayerVirtualWorld(playerid, worldid);
  207. native GetPlayerVirtualWorld(playerid);
  208. // Insane Stunts
  209. native EnableStuntBonusForPlayer(playerid, enable);
  210. native EnableStuntBonusForAll(enable);
  211. // Spectating
  212. #define SPECTATE_MODE_NORMAL 1
  213. #define SPECTATE_MODE_FIXED 2
  214. #define SPECTATE_MODE_SIDE 3
  215. native TogglePlayerSpectating(playerid, toggle);
  216. native PlayerSpectatePlayer(playerid, targetplayerid, mode = SPECTATE_MODE_NORMAL);
  217. native PlayerSpectateVehicle(playerid, targetvehicleid, mode = SPECTATE_MODE_NORMAL);
  218. // Recording for NPC playback
  219. #define PLAYER_RECORDING_TYPE_NONE 0
  220. #define PLAYER_RECORDING_TYPE_DRIVER 1
  221. #define PLAYER_RECORDING_TYPE_ONFOOT 2
  222. native StartRecordingPlayerData(playerid, recordtype, recordname[]);
  223. native StopRecordingPlayerData(playerid);
  224. native SelectTextDraw(playerid, hovercolor); // enables the mouse so the player can select a textdraw
  225. native CancelSelectTextDraw(playerid); // cancel textdraw selection with the mouse