toribio

toribio

Dec 6th, 2008
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.17 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. new Float:pos[MAX_PLAYERS][100][4];
  4.  
  5. public OnPlayerCommandText(playerid, cmdtext[])
  6. {
  7.     new cmd[256];
  8.     new idx;
  9.     cmd = strtok(cmdtext, idx);
  10.     if(!strcmp(cmd, "/salvar", true))
  11.     {
  12.         new tmp[256];
  13.         tmp = strtok(cmdtext, idx);
  14.         new slot = strval(tmp);
  15.         if(!strlen(tmp))return SendClientMessage(playerid, 0xFFFFFFFAA, "USE: /salvar [slot]");
  16.         if(slot >= 1 && slot <= 100)
  17.         {
  18.             slot--;
  19.             new Float:x, Float:y, Float:z, Float:a;
  20.             if(IsPlayerInAnyVehicle(playerid))
  21.             {
  22.                 GetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);
  23.                 GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
  24.                 pos[playerid][slot][0] = x;
  25.                 pos[playerid][slot][1] = y;
  26.                 pos[playerid][slot][2] = z;
  27.                 pos[playerid][slot][3] = a;
  28.             } else {
  29.                 GetPlayerPos(playerid, x, y, z);
  30.                 GetPlayerFacingAngle(playerid, a);
  31.                 pos[playerid][slot][0] = x;
  32.                 pos[playerid][slot][1] = y;
  33.                 pos[playerid][slot][2] = z;
  34.                 pos[playerid][slot][3] = a;
  35.             }
  36.             SendClientMessage(playerid, 0xFFFFFFAA, "Salvo.");
  37.         } else {
  38.             SendClientMessage(playerid, 0xFFFFFFAA, "Slot inv�lido (1~100).");
  39.         }
  40.         return 1;
  41.     }
  42.  
  43.     if(!strcmp(cmd, "/ir", true))
  44.     {
  45.         new tmp[256];
  46.         tmp = strtok(cmdtext, idx);
  47.         new slot = strval(tmp);
  48.         if(!strlen(tmp))return SendClientMessage(playerid, 0xFFFFFFFAA, "USE: /ir [slot]");
  49.         if(slot >= 1 && slot <= 100)
  50.         {
  51.             slot--;
  52.             if(pos[playerid][slot][0] != 0.0 && pos[playerid][slot][1] != 0.0)
  53.             {
  54.                 if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  55.                 {
  56.                     SetVehiclePos(GetPlayerVehicleID(playerid),
  57.                     pos[playerid][slot][0],
  58.                     pos[playerid][slot][1],
  59.                     pos[playerid][slot][2]);
  60.                     SetVehicleZAngle(GetPlayerVehicleID(playerid), pos[playerid][slot][3]);
  61.                 } else {
  62.                     SetPlayerPos(playerid,
  63.                     pos[playerid][slot][0],
  64.                     pos[playerid][slot][1],
  65.                     pos[playerid][slot][2]);
  66.                     SetPlayerFacingAngle(playerid, pos[playerid][slot][3]);
  67.                 }
  68.                 SendClientMessage(playerid, 0xFFFFFFAA, "Teleportado.");
  69.             } else {
  70.                 SendClientMessage(playerid, 0xFFFFFFAA, "Slot vazio!");
  71.             }
  72.         } else {
  73.             SendClientMessage(playerid, 0xFFFFFFAA, "Slot inv�lido (1~100).");
  74.         }
  75.         return 1;
  76.     }
  77.  
  78.     return 0;
  79. }
Advertisement
Add Comment
Please, Sign In to add comment