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



Get a variable in a filterscript from gamemode - Anuris - 09.06.2014

Hello.

I've got some variable in a gamemod. How can I get this variable in the filterscript?

Sorry for my poor English. =)


Re: Get a variable in a filterscript from gamemode - Konstantinos - 09.06.2014

Use CallRemoteFunction: https://sampwiki.blast.hk/wiki/CallRemoteFunction

I'll give you an example. Let's say you have the variable for the admin level in the gamemode so add a public function and return the level:
pawn Код:
// it's just an example:
forward ReturnAdminLevel(playerid);
public ReturnAdminLevel(playerid)
{
    return Player_Admin[playerid];
}
now in the filterscript, you need to call the public function and CallRemoteFunction returns what the public functions returns too.
pawn Код:
new admin_level = CallRemoteFunction("ReturnAdminLevel", "i", playerid);
and you got the value of the variable.


Re: Get a variable in a filterscript from gamemode - Anuris - 09.06.2014

Thank you!