SA-MP Forums Archive
little problem - 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: little problem (/showthread.php?tid=167636)



little problem - jaksimaksi - 13.08.2010

i want to create a cmd /jpr, he closes/open one thing... but i have an error

Код:
dcmd_jpr(playerid,params[])
{
    #pragma unused params
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_RED,"You are not adminstrator");
    {
    MoveObject(jpr,302.4842,1884.5002,8.8426,100);
    SendClientMessage(playerid, COLOR_LIME, "Jetpack room have been closed");
    }
    else //  error 029: invalid expression, assumed zero
    {
    MoveObject(jpr2,302.4842,1884.5002,8.8426,100);
    SendClientMessage(playerid, COLOR_LIME, "Jet pack room have been opened");
	}
    return 1;
    }



Re: little problem - ikey07 - 13.08.2010

Because there dont have nothing else, you want if he is admin close and when you are not admin open?

you already return first if, so there dont need else


Re: little problem - jaksimaksi - 13.08.2010

i want that when i type /jpr, jpr opens, when i type /jpr again, closes


Re: little problem - ikey07 - 13.08.2010

ok, wait I will script it for you


Re: little problem - ikey07 - 13.08.2010

pawn Код:
new GatesOpen = 0;

dcmd_jpr(playerid,params[])
{
    #pragma unused params
    if(IsPlayerAdmin(playerid))
    {
        if(GatesOpen == 1)
        {
            MoveObject(jpr,302.4842,1884.5002,8.8426,100);
            SendClientMessage(playerid, COLOR_LIME, "Jetpack room have been closed");
            GatesOpen = 0;
        }
        else
        {
            MoveObject(jpr,302.4842,1884.5002,8.8426,100);
            SendClientMessage(playerid, COLOR_LIME, "Jet pack room have been opened");
            GatesOpen = 1;
        }
        return 1;
    }
    else
    {
        SendClientMessage(playerid,COLOR_RED,"You are not adminstrator"); return 1;
    }
    return 1;
}



Re: little problem - jaksimaksi - 13.08.2010

thx. working