Advertisement
Guest User

[Filterscript] Salvar posição e para a posição salva !

a guest
Aug 28th, 2011
423
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.53 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. new Float:PosX[MAX_PLAYERS], Float:PosY[MAX_PLAYERS], Float:PosZ[MAX_PLAYERS], Float:PosA[MAX_PLAYERS], PosI[MAX_PLAYERS];
  4. new bool: EnCoche[MAX_PLAYERS];
  5.  
  6.  
  7. public OnPlayerCommandText(playerid, cmdtext[]){
  8. if (strcmp("/sp", cmdtext, true, 10) == 0){
  9. GetPlayerPos(playerid, PosX[playerid], PosY[playerid], PosZ[playerid]);
  10. GetPlayerFacingAngle(playerid, PosA[playerid]);
  11. SendClientMessage(playerid, 0x57E427AA, "[INFO]: Sua posição foi salva, para voltar use: /irp");
  12. PosI[playerid] = (GetPlayerInterior(playerid));
  13. PlayerPlaySound(playerid, 1137 , 0.0, 0.0, 0.0);
  14. return 1;
  15. }
  16. if (strcmp("/irp", cmdtext, true, 10) == 0){
  17. if (!floatsqroot(PosX[playerid]+PosY[playerid]+PosZ[playerid]))
  18. {
  19. SendClientMessage(playerid, 0xF60000AA, "[ERRO] Você não tem nenhuma posição salva.");
  20. }
  21. else
  22. {
  23. if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  24. {
  25. SetVehiclePos(GetPlayerVehicleID(playerid), PosX[playerid], PosY[playerid], PosZ[playerid]);
  26. SetVehicleZAngle(GetPlayerVehicleID(playerid), PosA[playerid]);
  27. SetCameraBehindPlayer(playerid);
  28. LinkVehicleToInterior(GetPlayerVehicleID(playerid), PosI[playerid]);
  29. }
  30.  else
  31. {
  32. EnCoche[playerid] = false;
  33. SetPlayerPos(playerid, PosX[playerid], PosY[playerid], PosZ[playerid]);
  34. SetPlayerFacingAngle(playerid, PosA[playerid]);
  35. SetCameraBehindPlayer(playerid);
  36. }
  37. PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
  38. SetPlayerInterior(playerid, PosI[playerid]);
  39. SendClientMessage(playerid, 0x008040FF, "Você se teleportou para a ultima posição salva.");
  40. }
  41. return 1;
  42. }
  43. return 1;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement