01.06.2013, 15:32
Well you need sscanf, look it up if you don't already have it.
This is pretty basic and you can copy paste it. You would need to define the color's or change these.
pawn Код:
CMD:goto(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 5) //== You would have something similar or you might not have it if you want anyone in the server to use the command
{
new Float:x, Float:y, Float:z, targetid;
if(sscanf(params,"u", targetid)) return SendClientMessage(playerid, C_WHITE, "Usage: /goto [Player ID/Name]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, C_RED, "Error: This player is not connected.");
GetPlayerPos(targetid, x, y, z); //== Get's the player position of the player you wish to go to
SetPlayerPos(playerid, x, y, z); //== Set's your position to his
}
else SendClientMessage(playerid, C_RED, "Invalid command, type /cmds to see a list of all our server commands."); //== If the player trying to use the command is not admin they will get this
return 1;
}
CMD:get(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 5)
{
new Float:x, Float:y, Float:z, targetid;
if(sscanf(params,"ui", targetid)) return SendClientMessage(playerid, C_WHITE, "Usage: /get [Player ID/Name]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, C_RED, "Error: This player is not connected.");
GetPlayerPos(playerid, x, y, z); //== Same as above only here the code will get your position
SetPlayerPos(targetid, x, y+1, z); //== And bring the target to you
}
else SendClientMessage(playerid, C_RED, "Invalid command, type /cmds to see a list of all our server commands.");
return 1;
}