SA-MP Forums Archive
Same Command ! - 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)
+--- Thread: Same Command ! (/showthread.php?tid=298092)



Same Command ! - dorperez - 19.11.2011

Hey guys sup ?

I want to learn how can I do a command twice..

For increas:

I want to enter some place with /blo and when I want to exit the place I will do the same command.


Re: Same Command ! - Juniior - 19.11.2011

You may use if and else statements in this case.

pawn Код:
if (strcmp("/blo", cmdtext, true, 10) == 0)
    {
        if(condition)
        {
            //...
        }
        else
        {
            //...
        }
    }
https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint


Re: Same Command ! - Kostas' - 19.11.2011

pawn Код:
CMD:blo(playerid, params[])
{
    if(GetPVarInt(playerid, "blo") == 0) {
        SetPlayerPos(playerid,Float:x,Float:y,Float:z);
        SetPlayerInterior(playerid,interiorid);
        SetPVarInt(playerid, "blo", 1);
    }
    else if(GetPVarInt(playerid, "blo") == 1) {
        SetPlayerPos(playerid,Float:x,Float:y,Float:z);
        SetPlayerInterior(playerid,interiorid);
        SetPVarInt(playerid, "blo", 0);
    }
    return 1;
}
However, about the InteriorIDs that the place you enter has.
Or use the /interior command ingame, and it will show you the ID