SA-MP Forums Archive
read a gamemode variable from filterscript - 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: read a gamemode variable from filterscript (/showthread.php?tid=443978)



read a gamemode variable from filterscript - S0n1COwnsYou - 14.06.2013

as the title said, how to read "PlayerInformation[playerid][whatever]" which exists in the gamemode, from a filterscript?


Re: read a gamemode variable from filterscript - Avi57 - 14.06.2013

Just use single line :-
pawn Код:
#define "/gamemodes/yourgamemode.pwn"



Re: read a gamemode variable from filterscript - InfiniTy. - 14.06.2013

This should work

In the gamemode you put this
pawn Код:
forward GetAdminFS(playerid);
public GetAdminFS(playerid) {
    return PlayerInformation[playerid][whatever];
}
in the filterscript you use https://sampwiki.blast.hk/wiki/CallRemoteFunction


Re: read a gamemode variable from filterscript - Pooh7 - 14.06.2013

Tutorial: Getting your filterscripts and gamemodes to share information


Re: read a gamemode variable from filterscript - Pottus - 14.06.2013

You need to make some functions in your gamemode to return values like this.

pawn Код:
forward GetPlayerWhatever(playerid);
public GetPlayerWhatever(playerid) { return PlayerInformation[playerid][whatever]; }
Now create an include for your filterscripts like this

pawn Код:
#define GetPlayerWhatever(%0) CallRemoteFunction("GetPlayerWhatever", "i", %0)
If anyone suggests to use PVars don't the tradeoff will most likely be in favor of CallRemoteFunction() even though it is slower using PVars overall will most certainly be slower besides they make some really ugly looking code.