How do I make a /goto and /bring
#3

Well you need sscanf, look it up if you don't already have it.
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;
}
This is pretty basic and you can copy paste it. You would need to define the color's or change these.
Reply


Messages In This Thread
How do I make a /goto and /bring - by lramos15 - 01.06.2013, 15:21
Re: How do I make a /goto and /bring - by drichie - 01.06.2013, 15:26
Re: How do I make a /goto and /bring - by Rillo - 01.06.2013, 15:32
Re: How do I make a /goto and /bring - by lramos15 - 01.06.2013, 16:16
Re: How do I make a /goto and /bring - by lramos15 - 01.06.2013, 16:58
Re: How do I make a /goto and /bring - by Rillo - 01.06.2013, 17:49
Re: How do I make a /goto and /bring - by lramos15 - 01.06.2013, 23:28
Re: How do I make a /goto and /bring - by Rillo - 02.06.2013, 11:38

Forum Jump:


Users browsing this thread: 1 Guest(s)