IsACop -
George0305 - 14.02.2014
So,i have a jail system but this is used for /ajail and i want to use it just for gates.
The problem is that the system is made for admins, IsPlayerAdmin and i want to switch it to IsACop.
I changed it,defined,no errors,but in game the cmds don`t work.So,anyone who can help,rep+.
Thanks!
Here`s the code:
Код:
//Gates Commands:
#define FILTERSCRIPT
#include <a_samp>
#include <zcmd>
#define MAX_GATES 4
#define red 0xFF0000C8
#define orange 0xFF8000C8
#define IsACop
........................................
CMD:gatesinfo(playerid,params[])
{
if(!IsACop(playerid)) {
return SendClientMessage(playerid,red,"You're not allowed to use this command.");
} else {
SendClientMessage(playerid,red,"/jailmain - Poarta principala");
SendClientMessage(playerid,red,"/jailp - Poarta prizonierilor");
SendClientMessage(playerid,red,"/jailguard - Poarta securitatii");
SendClientMessage(playerid,red,"/jailcar - Poarta masini");
}
return 1;
}
CMD:jailmain(playerid,params[])
{
if(!IsACop(playerid))
return SendClientMessage(playerid,red,"You're not allowed to use this command.");
else
switch(Open{0})
{
case true:
{
MoveObject(Gate[0],288.21933, 1411.60046, 6.55341,10);
Open{0} = false;
}
case false:
{
MoveObject(Gate[0],288.21933, 1411.60046, 12.11350,10);
Open{0} = true;
}
}
return 1;
}
CMD:jailp(playerid,params[])
{
if(!IsACop(playerid))
return SendClientMessage(playerid,red,"You're not allowed to use this command.");
else
switch(Open{1})
{
case true:
{
MoveObject(Gate[1],205.2051, 1425.8093, 6.33434,10);
Open{1} = false;
}
case false:
{
MoveObject(Gate[1],205.0506, 1425.8093, 10.8416,10);
Open{1} = true;
}
}
return 1;
}
CMD:gateguard(playerid,params[])
{
if(!IsACop(playerid))
return SendClientMessage(playerid,red,"You're not allowed to use this command.");
else
switch(Open{2})
{
case true:
{
MoveObject(Gate[2],276.7187, 1392.7837, 6.3300,10);
Open{2} = false;
}
case false:
{
MoveObject(Gate[2],276.71869, 1392.78369, 10.67510,10);
Open{2} = true;
}
}
return 1;
}
CMD:gatecars(playerid,params[])
{
if(!IsACop(playerid))
return SendClientMessage(playerid,red,"You're not allowed to use this command.");
else
switch(Open{3})
{
case true:
{
MoveObject(Gate[3],269.75021, 1413.76233, 10.15275,10);
Open{3} = false;
}
case false:
{
MoveObject(Gate[3],269.7502, 1413.7623, 8.6981 ,10);
Open{3} = true;
}
}
return 1;
}
Re: IsACop -
Avi Raj - 14.02.2014
- Create a Enum, Cop
- then check : if[playerid][Cop] = 1 or = 0.
- Use the function.
Re: IsACop -
Konstantinos - 14.02.2014
No, that's not correct. You shouldn't use
#define everytime you get an error for undefined symbol.
If you use IsACop in your gamemode, then you can use CallRemoteFunction so you can check whether a player is a cop or not.
Re: IsACop -
CuervO - 14.02.2014
You don't define functions like that. How is the script supposed to know what a Cop even is?
Think of the script as a raw paper without anything written on it, and you suddenly write "IsACop" on it. That doesn't make it a check, now does it?
What you're trying to do is to check if the player is a cop. How? There's a variable that stores whether the player is a cop, or not. The variable, if it's not a PVar only works for the main gamemode.
Check which variable checks IsACop for in your main gamemode, make sure to change the variables used to PVars so they can be used along other filterscripts, and use said PVars to check if the player is a cop in other scripts.
Re: IsACop -
George0305 - 14.02.2014
I thought that if i put the same variable as the gamemode,it would be the same.It seems i was wrong.Anyway,i don`t really know what and where to put.Thank you for your time and patience with me.
That`s the function in gamemode:
Код:
forward IsACop(playerid);
public IsACop(playerid)
{
if(IsPlayerConnected(playerid))
{
new leader = PlayerInfo[playerid][pLeader];
new member = PlayerInfo[playerid][pMember];
if(member==1 || member==2 || member==3)
{
return 1;
}
else if(leader==1 || leader==2 || leader==3)
{
return 1;
}
}
return 0;
}
Re: IsACop -
Konstantinos - 14.02.2014
Add this to your filterscript:
pawn Код:
stock IsACop(playerid)
{
return CallRemoteFunction("IsACop", "i", playerid);
}
Re: IsACop -
George0305 - 14.02.2014
Working.Thanks!+rep