HELP Automatic Gate To Open For Admin Only
#1

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
Reply
#2

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);
            }
        }
    }    
}
Reply
#3

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

?
Reply
#4

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);
Reply
#5

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
Reply
#6

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...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)