SA-MP Forums Archive
commands - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: commands (/showthread.php?tid=217956)



commands - omer5198 - 29.01.2011

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


Re: commands - Biesmen - 29.01.2011

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;
}



Re: commands - omer5198 - 29.01.2011

thx i will try this!