Communication between Filterscript and GameMode -
Oxside - 02.01.2010
heey all
I have a filterscript and a gamemode, now i want that i can use the same variables as in filterscript as in gamemode.
So a example:
I got a license system in a filterscript:
i i do /buylic the new License[MAX_PLAYERS]; variable will be set to 1
And when i do the following in my GameMode:
if(License[playerid] == 1)
{
balbala
}
That it works if i did /buylic in my fs.
Simple: if i set a variable to 1 or true or false i want to use that in my GM
I found on dracoblue's website dprop but is only for properties
Please dont say make /buylic in your gm too
i just want that it isn;'t about a license system but overall the license system was just a example
Oxside
Re: Communication between Filterscript and GameMode -
Rac3r - 02.01.2010
Use files maybe.
Each player has a file that contains two values, one for the current action and 2 as the value to set.
Then open the file, read the line and use the params to decide what the argument and what value to see for it. Then just check the 1st param in file to check if it's for the current command.
I won't say use the GM, but I will ask why not keep it in the GM?
They work best when in the same AMX IMO.
Re: Communication between Filterscript and GameMode -
dice7 - 02.01.2010
pawn Код:
// in your fs
public GetPlayerLicense(playerid) return License[playerid];
//in your gm
CallRemoteFunction("GetPlayerLicense", "d", playerid);
https://sampwiki.blast.hk/wiki/CallRemoteFunction
Re: Communication between Filterscript and GameMode -
Oxside - 02.01.2010
Quote:
Originally Posted by Rac3r
Use files maybe.
Each player has a file that contains two values, one for the current action and 2 as the value to set.
Then open the file, read the line and use the params to decide what the argument and what value to see for it. Then just check the 1st param in file to check if it's for the current command.
I won't say use the GM, but I will ask why not keep it in the GM?
They work best when in the same AMX IMO.
|
To diffucult
Quote:
Originally Posted by dice7
|
great that was what i was looking for!
But now the following, how can use the following variables in my GM:
Re: Communication between Filterscript and GameMode -
dice7 - 02.01.2010
pawn Код:
License = CallRemoteFunction("GetPlayerLicense", "d", playerid);
Quote:
Returns The value that the last public function returned.
|
Re: Communication between Filterscript and GameMode -
Oxside - 02.01.2010
Oke thanks that what i needed!
Re: Communication between Filterscript and GameMode -
Oxside - 02.01.2010
Question how to set that value?
So i call it, and now i want to use License[playerid] = +1; in my gm howto
Re: Communication between Filterscript and GameMode -
dice7 - 02.01.2010
The same way
pawn Код:
// fs
public SetPlayerLicense(playerid, license)
{
License[playerid] = license;
return 1;
}
//in your gm
CallRemoteFunction("SetPlayerLicense", "dd", playerid, randomnumber);
Re: Communication between Filterscript and GameMode -
Oxside - 02.01.2010
but were to put CallRemoteFunction("SetPlayerLicense", "dd", playerid, randomnumber);
this ^^ in my gm or:
License = CallRemoteFunction("SetPlayerLicense", "dd", playerid, randomnumber);
??
Re: Communication between Filterscript and GameMode -
dice7 - 02.01.2010
pawn Код:
if(strcmp(cmdtext, "/lvl 1 license", true) == 0)
{
CallRemoteFunction("SetPlayerLicense", "dd", playerid, randomnumber);
SendClientMessage(playerid, color, "You just got a level 1 license");
return 1;
}
if(strcmp(cmdtext, "/license", true) == 0)
{
new license = CallRemoteFunction("GetPlayerLicense", "d", playerid);
new str[128];
format(str, 128, "Your license level: %d", license);
SendClientMessage(playerid, color, str);
return 1;
}