commands
#1

i make some admin commands like freeze/unfreeze/heal... but i have trouble with commands like goto/get/explode...
(and spawn car but this is not relate to the previous commands) can somebody help me? i am using strtok...
if you can help me with car spawning too but first the goto/get/explode and all the other commands from this kind...
sorry for my bad english
Reply
#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
#3

thx i will try this!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)