Not mine, but this is with explanation so you can learn from it
pawn Code:
public OnPlayerCommandText( playerid, cmdtext[ ] )
{
dcmd( goto , 4, cmdtext); // Note that the characters in DCMD exclude the "/", so we use 4, instead of 5 we used in strcmp
return 0;
}
dcmd_goto(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000AA, "You need to be RCON for use this command");
new ID;
new pn[MAX_PLAYER_NAME];
new an[MAX_PLAYER_NAME];
new str[128];
if(sscanf(params, "u", ID)) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /goto [ID]"); //This is a long line, "sscanf" is the plugin that search the missing params, "params" is the param that define params LOL, "u" is the PARAM that define the MISSING ID, ID is the param for the targetid
if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: This player is not connected");//Same as !IsPlayerAdmin, but instead of "playerid" we put "ID" because it's the targetid
GetPlayerName(playerid, an, MAX_PLAYER_NAME);//Define the playerid's param
GetPlayerName(ID, pn, MAX_PLAYER_NAME);//Define the ID's param
new Float:x; //Defining float X
new Float:y; //Same
new Float:z; //Same
GetPlayerPos(ID, x, y, z); //This line get the "ID" position
SetPlayerPos(playerid, x+1, y+1, z); //This line set the "playerid" position from "ID" position, with some changes(x+1, y+1);
format(str, sizeof(str), "You have been teleported to %s", pn); //Showed before, this is the line that give the message to playerid)
SendClientMessage(playerid, 0x00FF00AA, str); //This line give the message to playerid
if(IsPlayerInAnyVehicle(playerid)) //Mhh, let's give you a question, what should this callback do?
{
GetPlayerPos(ID, x, y, z);
SetVehiclePos(playerid, x+1, y+1, z); //And this one? :D
}
return 1;
}