29.09.2018, 14:10
Calling remote function is one way. PVars is the other way.
You need to call from filterscript the public function `GivePlayerCash` of the gamemode. Replace `GivePlayerMoney` function to `GivePlayerMoneyEx` at the filterscript:
The filterscript uses `GetPlayerMoney` function, you will need to add another remote function to get the value of the variable from the gamemode. I am sure you have a function to get the server-side money value in your gamemode but make it a public function:
At the filterscript now, replace `GetPlayerMoney` to `GetPlayerMoneyEx`.
You need to call from filterscript the public function `GivePlayerCash` of the gamemode. Replace `GivePlayerMoney` function to `GivePlayerMoneyEx` at the filterscript:
pawn Код:
// filterscript:
GivePlayerMoneyEx(playerid, amount)
{
CallRemoteFunction("GivePlayerCash", "dd", playerid, amount);
}
pawn Код:
// gamemode:
forward GetPlayerCash(playerid);
public GetPlayerCash(playerid)
{
return PlayerInfo[playerid][pCash];
}
pawn Код:
// filterscript:
GetPlayerMoneyEx(playerid)
{
return CallRemoteFunction("GetPlayerCash", "d", playerid);
}