How to lock a filterscript
#1

i got 3 filterscript i want to be lockt to faction 1 and 2 but i dont know how some told me i need to add this

else if(PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2)
else if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)

But where do i put it inside the filterscript ? hope for help -_-
Reply
#2

To check a players info from a filterscript ( which is what you need to do to lock it to certain players ) there are two methods you could use.

1.PVars - which can be set in the gamemode and accessed from a filterscript.
eg:
pawn Код:
//gamemode
SetPVarInt(playerid,"faction",PlayerInfo[playerid][pMember]);

//in FS
if(GetPVarInt(playerid,"faction") == 2 //or whatever
{
     //do stuff here
}
another way would be to put a function in the gamemode and call it from the filterscript
eg
pawn Код:
//in gamemode
forward ReturnPlayerFaction(playerid);
public ReturnPlayerFaction(playerid)
{
     return PlayerInfo[playerid][pFaction];
}

//in the filterscript
new faction = CallRemoteFunction("ReturnPlayerFaction","d",playerid);
if(faction == 2)
{
     //do stuff here
}
Reply
#3

Do stuff here you mean i put the filterscript in there or ??
Reply
#4

//in gamemode - means the code is in the gamemode

//in filterscript - means the code is in the filterscript

Two separate files, so to answer your question, you put //in filterscript in the filterscript
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)