Advertisement
Guest User

Include - And CheckPoints

a guest
Feb 24th, 2012
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.56 KB | None | 0 0
  1. #if defined _CheckPointAnd_included
  2.  
  3. #endinput
  4.  
  5. #endif
  6.  
  7. #define _CheckPointAnd_included
  8.  
  9. #include <a_samp>
  10.  
  11.  
  12.  
  13. /*
  14. native OnPlayerInCheckpoint(playerid, checkpointid);
  15. native OnPlayerOutCheckpoint(playerid, checkpointid);
  16. native ShowPlayerCheckpoint(playerid, checkpointid, Float:x, Float:y, Float:z, Float:size); checkpointid can't be '0'
  17. native IsPlayerInCP(playerid, checkpointid);
  18. */
  19.  
  20.  
  21. forward ShowPlayerCheckpoint(playerid, checkpointid, Float:x, Float:y, Float:z, Float:size);
  22. forward (playerid, checkpointid);
  23.  
  24.  
  25. new checkpointid1[MAX_PLAYERS];
  26. new InCp[MAX_PLAYERS];
  27.  
  28.  
  29.  
  30. public OnPlayerEnterCheckpoint(playerid) // From SA:MP
  31. {
  32.     new cpid = checkpointid1[playerid];
  33.     CallLocalFunction("OnPlayerInCheckpoint", "dd", playerid, cpid);
  34.     InCp[playerid] = 1;
  35.     return 1;
  36. }
  37.  
  38. public OnPlayerLeaveCheckpoint(playerid) // From SA:MP
  39. {
  40.     new cpid = checkpointid1[playerid];
  41.     CallLocalFunction("OnPlayerOutCheckpoint", "dd", playerid, cpid);
  42.     InCp[playerid] = 0;
  43.     checkpointid1[playerid] = 0;
  44.     return 1;
  45. }
  46.  
  47. //By Me
  48.  
  49.  
  50. public ShowPlayerCheckpoint(playerid, checkpointid, Float:x, Float:y, Float:z, Float:size)
  51. {
  52.     DisablePlayerCheckpoint(playerid);
  53.     checkpointid1[playerid] = checkpointid;
  54.     SetPlayerCheckpoint(playerid, x, y, z, size);
  55.     return 1;
  56. }
  57.  
  58.  
  59. public IsPlayerInCP(playerid, checkpointid)
  60. {
  61.     if(InCp[playerid] == 0) return 0;
  62.     new cpid = checkpointid1[playerid];
  63.     if(checkpointid != cpid) return 0;
  64.     return 1;
  65. }
  66.  
  67.  
  68. forward OnPlayerInCheckpoint(playerid, checkpointid);
  69. forward OnPlayerOutCheckpoint(playerid, checkpointid);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement