commands
#2

Maybe this would work for Goto and Get, not sure, didn't test it:
pawn Код:
new cmd = strtok(cmdtext, idx);
    new tmp = strtok(cmdtext, idx);
    new giveplayerid;

if(strcmp(cmd, "/goto", true) == 0)
{
    if(!strlen(tmp))
    {
        SendClientMessage(playerid, 0xFFFFFFAA, "USAGE: /goto [playerid]");
        return 1;
    }
    giveplayerid = strval(tmp);
    new
        Float:x,
        Float:y,
        Float:z;
    if(!IsPlayerConnected(giveplayerid)
    {
        SendClientMessage(playerid, 0xFFFFFFAA, "ERROR: That player is not connected.");
        return 1;
    }
        GetPlayerPos(giveplayerid, x, y, z);
        SetPlayerPos(playerid, x, y+5, z);
        SendClientMessage(playerid, 0xFFFFFFAA, "You teleported to that player.");
        return 1;
}

if(strcmp(cmd, "/get", true) == 0)
{
    if(!strlen(tmp))
    {
        SendClientMessage(playerid, 0xFFFFFFAA, "USAGE: /get [playerid]");
        return 1;
    }
    giveplayerid = strval(tmp);
    new
        Float:x,
        Float:y,
        Float:z;
    if(!IsPlayerConnected(giveplayerid)
    {
        SendClientMessage(playerid, 0xFFFFFFAA, "ERROR: That player is not online.");
        return 1;
    }
        GetPlayerPos(playerid, x, y, z);
        SetPlayerPos(giveplayerid, x, y, z);
        SendClientMessage(playerid, 0xFFFFFFAA, "That player teleported to you.");
        SendClientMessage(giveplayerid, 0xFFFFFFAA, "You have been teleported by an admin);
        return 1;
}
Reply


Messages In This Thread
commands - by omer5198 - 29.01.2011, 07:52
Re: commands - by Biesmen - 29.01.2011, 08:10
Re: commands - by omer5198 - 29.01.2011, 08:23

Forum Jump:


Users browsing this thread: 1 Guest(s)