Automatic Gates - 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: Automatic Gates (
/showthread.php?tid=566315)
Automatic Gates -
Primard - 05.03.2015
How can I make the gate respond to one of an admin levels I have from GiDan's and rcon admins? And to have multiple gates in the gamemode?
References:
Automatic Gates tutorial:
https://sampforum.blast.hk/showthread.php?tid=279757 (this is where I had my gate code created)
GiDan's admin system:
http://forum.sa-mp.com/showthread.ph...ighlight=Gidan (admin system I am using for my server)
*Sorry if my problem is confusing*
Re: Automatic Gates -
De4dpOol - 05.03.2015
Just add a check to open the gate only if the player who is in range is a admin.
pawn Код:
forward GateCheck();
public GateCheck()
{
for(new i; i < MAX_PLAYERS; i++) // Start the loop
{
if((IsPlayerInRangeOfPoint(i, 15.0, 8.0, 3.0, 10.0)) && (P_Data[playerid][pAdmin] >= 1)) //Check if any admin is in the area. Replace '8.0, 3.0, 10.0' with your own coordinates of your closed gate.
{
if(gateopen == false) // If the gate isn't open...
{
MoveObject(gate, 32.0, 12.0, 10.0, 3.5); //Then open it! Change '32.0, 12.0, 10.0' to the coordinates of your opened gate.
gateopen = true; // Setting this to true indicates it's open(ing)
}
return; //This closes the callback
}
}
//This is called if nobody has been found near the gate. Obviously, because 'return' would fully close the function and this wouldn't be used then.
if(gateopen == true) //If the gate IS open, but there's no one near..
{
MoveObject(gate, 8.0, 3.0, 10.0, 3.5); // Change the '8.0, 3.0, 10.0' to the coordinates of your gate when it's closed.
gateopen = false; //This indicates the gate is closed again. Or at least, closing.
}
}
Also make sure you add gates in your Admin FilterScript not in your gamemode.
Re: Automatic Gates -
Primard - 05.03.2015
the 1 is the admin level?
Re: Automatic Gates -
hamzajaved780 - 05.03.2015
Yes change it allow the admin level you want
Re: Automatic Gates -
Primard - 05.03.2015
then how can I add the IsPlayerAdmin function to it to allow both the selected admin level and rcon admin for the gates to be opened for?
Re: Automatic Gates -
CalvinC - 05.03.2015
Use || to check if something OR something else, like this:
pawn Код:
P_Data[playerid][pAdmin] >= 1 || IsPlayerAdmin(playerid)
Re: Automatic Gates -
Primard - 05.03.2015
---
ERROR SOLVED
Re: Automatic Gates -
Primard - 07.03.2015
---PROBLEM SOLVED a friend of mine helped me, I apologize for those who were reading this when I may/may not have bumped my thread or those who might have helped me. I sincerely apologize.
My apologies and regards,
Richard