All pastes #523564 Raw Edit

Unnamed

public text v1 · immutable
#523564 ·published 2007-05-30 20:40 UTC
rendered paste body
else if (strcmp(cmd, "/ctp", true)==0)
        {
           new temp[256];
           temp = strtok(cmdtext, idx);
           
           if (!strlen(temp) || !IsNumeric(temp))
           {
              SendClientMessage(playerid, RED, "Invalid usage");
             return 1;
           }

           giveplayerid = strval(temp);
           if (!IsPlayerConnected(giveplayerid))
           {
              SendClientMessage(playerid, RED, "Invalid player ID!");
              return 1;
           }

           new Float:x, Float:y, Float:z;
           GetPlayerPos(giveplayerid, x, y, z);
           SetVehiclePos(playerid, x, y, z);

         // Get the player names
           GetPlayerName(playerid, playername, sizeof(playername));
           GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));

         // Tell the player who they are teleporting to
           format(string, sizeof(string), "You have been car-teleported to %s!", giveplayername);
           SendClientMessage(playerid, YELLOW, string);

        // Tell the player who is teleporting to them
           format(string, sizeof(string), "%s has been car-teleported to you!", playername);
           SendClientMessage(giveplayerid, YELLOW, string);
        }
        return 1;
}