Assigning gamemode variables to values in a filterscript
#1

I've never had to set a gamemode variable from a filterscript to a value before, so I've never faced this problem.
If I ever wanted to get the value, I would use the CallRemoteFunction method, for example:
pawn Код:
forward GetPlayerWhatever(playerid);
public GetPlayerWhatever(playerid)
{
    return whatever[playerid];
}
Now, I need to set that variable to a value, from the filterscript I'm currently scripting.
I've tried doing something like this, but it doesn't seem to work.
pawn Код:
forward SetPlayerWhatever(playerid, value);
public SetPlayerWhatever(playerid, value)
{
    return whatever[playerid] = value;
}
So I'm asking how could I do that?
Reply
#2

Wouldn't you do CallRemoteFunction?
Reply
#3

In case you have tested it in OnFilterScriptInit, it wouldn't work - you'd have to delay it.

pawn Код:
// <filterscript>
#define SetPlayerWhatever(%0,%1) CallRemoteFunction("GM_SetPlayerWhatever", "ii", %0, %1)

// an example setting the value to 10 for that playerid somewhere in filterscript:
SetPlayerWhatever(playerid, 10);

// <gamemode>
// global:
new whatever[MAX_PLAYERS];

forward GM_SetPlayerWhatever(playerid, value);
public GM_SetPlayerWhatever(playerid, value)
{
    whatever[playerid] = value;
}
It works good.
Reply
#4

That's what I was doing, but without paying attention I was only adding one "i" in the format[] argument in CallRemoteFunction.
I noticed that after you posted those codes, Konstantinos.
Thanks for your help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)