SA-MP Forums Archive
How to lock a filterscript - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: How to lock a filterscript (/showthread.php?tid=221156)



How to lock a filterscript - ZoinoZ88 - 05.02.2011

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 -_-


Re: How to lock a filterscript - Rachael - 05.02.2011

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
}



Re: How to lock a filterscript - ZoinoZ88 - 05.02.2011

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


Re: How to lock a filterscript - Rachael - 05.02.2011

//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