SAMP Gitlab CI Test
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

272 lines
12 KiB

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