SA-MP Forums Archive
HELP Automatic Gate To Open For Admin Only - 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: HELP Automatic Gate To Open For Admin Only (/showthread.php?tid=170229)



HELP Automatic Gate To Open For Admin Only - Stryke - 22.08.2010

I need help making this gate open only when an admin approaches it, i had a go myself but it just didnt work lol, im using Xtremes Admin System. The code is

pawn Код:
public GateCheck()
{
    new admingate1Open;
    for(new playerid; playerid<MAX_PLAYERS; playerid++)
    {
    if(IsPlayerInRangeOfPoint(playerid,15.0,2220.3957,-1139.3205,25.6949))admingate1Open=1;
    }
    //AdminGate Los Santos
    if(admingate1Open)MoveObject(admingate1,2227.763428, -1146.743164, 26.401253, 3); //These are the coordinates of the gate if it were in it's opened state.
    else MoveObject(admingate1,2220.218018, -1144.315796, 26.401253, 3);//These are the coordinates of the gate if it were in it's closed state.

}
Thanks


Re: HELP Automatic Gate To Open For Admin Only - Typhome - 22.08.2010

WHat fucking code?

Код:
public GateCheck()
{
    new admingate1Open;
    for(new playerid; playerid<MAX_PLAYERS; playerid++)
    {
        if(IsPlayerInRangeOfPoint(playerid,15.0,2220.3957,-1139.3205,25.6949))
        {
            admingate1Open=1;
            if(admingate1Open == 1)
            {
                  MoveObject(admingate1,2227.763428, -1146.743164, 26.401253, 3);
            }
            else 
            {
                  MoveObject(admingate1,2220.218018, -1144.315796, 26.401253, 3);
            }
        }
    }    
}



Re: HELP Automatic Gate To Open For Admin Only - SaW_[VrTx] - 22.08.2010

Shouldn't there be
admingate1Open=0;
after
if(admingate1Open == 1)
{

?


Re: HELP Automatic Gate To Open For Admin Only - Scenario - 22.08.2010

Why don't you learn to script in the pawn language first, then try this again? This is noob stuff, I haven't seen such crappy code in a LONG TIME! Here's one native you should be aware of...

pawn Код:
IsPlayerAdmin(playerid);



Re: HELP Automatic Gate To Open For Admin Only - Stryke - 22.08.2010

This isnt my code, i followed a tutorial to do this, and i had a go with the IsPlayerAdmin but i cant get it right, i probably could if i sat and stared at it all day but i just thought i would ask for some help with it because i am struggling with it, so i was hoping so one could point me in the right direction instead of just being arsey with me.

AND

This "noob" code is actually the only code (tutorial) i could find that worked, as long as it works i couldnt care less


Re: HELP Automatic Gate To Open For Admin Only - Scenario - 22.08.2010

Okay, I whipped this up for you.

pawn Код:
public GateCheck()
{
    if(IsPlayerInRangeOfPoint(playerid,15.0,2220.3957,-1139.3205,25.6949))
    {
        if(IsPlayerAdmin(playerid))
        {
            MoveObject(admingate1, 2227.763428, -1146.743164, 26.401253, 3);
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "This gate is for administrators only!");
        }
    }
}
That isn't the full code because I don't know what gate you have defined as "admingate1", so if you supply me the "CreateObject" line for the gate you'd like to open for admins only, I'll complete your code for you...