Peppery

sp and lp

Jan 28th, 2012
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. new Posaved[MAX_PLAYERS];
  4.  
  5. public OnPlayerConnect(playerid)
  6. {
  7. Posaved[playerid] = 0;
  8. return 1;
  9. }
  10.  
  11. public OnPlayerDisconnect(playerid)
  12. {
  13. Posaved[playerid] = 0;
  14. return 1;
  15. }
  16.  
  17. public OnPlayerCommandText(playerid, cmdtext[])
  18. {
  19. if(!strcmp("/sp", cmdtext, true))
  20. {
  21. new Float:x,Float:y,Float:z;
  22. GetPlayerPos(playerid,x,y,z);
  23. SetPVarFloat(playerid,"X",x);
  24. SetPVarFloat(playerid,"Y",y);
  25. SetPVarFloat(playerid,"Z",z);
  26. SendClientMessage(playerid, 0x10F441AA, "You have set your position. Type /lp to teleport to it!");
  27. if(Posaved[playerid] == 0)
  28. {
  29. Posaved[playerid] = 1;
  30. }
  31. return 1;
  32. }
  33. if(!strcmp("/lp", cmdtext, true))
  34. {
  35. if(Posaved[playerid] == 1)
  36. {
  37. SetPlayerPos(playerid, GetPVarFloat(playerid,"X"), GetPVarFloat(playerid,"Y"), GetPVarFloat(playerid,"Z"));
  38. SendClientMessage(playerid, 0x10F441AA, "Welcome to your Last Position!");
  39. }
  40. else SendClientMessage(playerid, 0xAA3333AA, "You did not save your position with /sp!");
  41. return 1;
  42. }
  43. return 0;
  44. }
Add Comment
Please, Sign In to add comment