How to make FS available only for specific factions? - 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: How to make FS available only for specific factions? (
/showthread.php?tid=491422)
How to make FS available only for specific factions? -
LazyGamer99 - 30.01.2014
So hello there, i would like to know how to make functions from filescripts to be available only for cops, but i don't know how, and can not find no where anything about it
So i would like help with this
Re: How to make FS available only for specific factions? -
LazyGamer99 - 01.02.2014
Nobody knows?
Re: How to make FS available only for specific factions? -
rakshith122 - 01.02.2014
If the functions are related to your gamemode, you cant just use it like that. I think.
Re: How to make FS available only for specific factions? -
CuervO - 01.02.2014
Well, maybe but you'd have to use CallRemoteFunction, SQL, player Teams (GetPlayerTeam), or PVars
CallRemoteFunction calls a function from other loaded script and returns the value it returns.
You could do
pawn Код:
forward GetCopLevel(playerid);
public GetCopLevel(playerid)
{
return GetPVarInt(playerid,"CopLevel"); // or whatever you use to store levels.
}
In the main gamemode then in the filterscript
pawn Код:
new coplevel = CallRemoteFunction("GetCopLevel", "i", playerid);
Which would also be unaccurate under heavy script processing load.
--------
With Teams you face the anti team kill problems but if that's okay for you then that would be the easiest solution.
---------
With SQL it would be pretty easy, connecting both scripts to the same DB.
---------
Alternatively and the easiest way I remembered while writting this is PVars.
PVars are shared between gamemodes and filterscripts loaded.
If you load a player's faction in the main gamemode, by saving it with PVars you can access that very same PVar in any filterscript you load.