else if (strcmp(cmd, "/tp", true)==0) { if (playerid == giveplayerid) { SendClientMessage(playerid, RED, "You can not teleport to yourself."); return 1; } { 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); SetPlayerPos(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 teleported to %s!", giveplayername); SendClientMessage(playerid, YELLOW, string); // Tell the player who is teleporting to them format(string, sizeof(string), "%s has been teleported to you!", playername); SendClientMessage(giveplayerid, YELLOW, string); } return 1; } else if (strcmp(cmd, "/ctp", true)==0) { if(!IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid, RED, "You must be in a vehicle to use this command."); return 1; } if (playerid == giveplayerid) { SendClientMessage(playerid, RED, "You can not teleport to yourself."); return 1; } { new temp[256]; temp = strtok(cmdtext, idx); if (!strlen(temp) || !IsNumeric(temp)) { SendClientMessage(playerid, RED, "Invalid Usage! Correct usage: /ctp id ."); 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(GetPlayerVehicleID(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; }