Communication between Filterscript and GameMode
#1

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
Reply
#2

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.
Reply
#3

pawn Код:
// in your fs
public GetPlayerLicense(playerid) return License[playerid];

//in your gm
CallRemoteFunction("GetPlayerLicense", "d", playerid);
https://sampwiki.blast.hk/wiki/CallRemoteFunction
Reply
#4

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
pawn Код:
// in your fs
public GetPlayerLicense(playerid) return License[playerid];

//in your gm
CallRemoteFunction("GetPlayerLicense", "d", playerid);
https://sampwiki.blast.hk/wiki/CallRemoteFunction
great that was what i was looking for!
But now the following, how can use the following variables in my GM:
Reply
#5

pawn Код:
License = CallRemoteFunction("GetPlayerLicense", "d", playerid);
Quote:
Returns The value that the last public function returned.
Reply
#6

Oke thanks that what i needed!
Reply
#7

Question how to set that value?
So i call it, and now i want to use License[playerid] = +1; in my gm howto
Reply
#8

The same way

pawn Код:
// fs
public SetPlayerLicense(playerid, license)
{
    License[playerid] = license;
    return 1;
}

//in your gm
CallRemoteFunction("SetPlayerLicense", "dd", playerid, randomnumber);
Reply
#9

but were to put CallRemoteFunction("SetPlayerLicense", "dd", playerid, randomnumber);
this ^^ in my gm or:
License = CallRemoteFunction("SetPlayerLicense", "dd", playerid, randomnumber);
??
Reply
#10

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)