PDA

View Full Version : Small help


Face9000
18/09/2015, 08:22 PM
Hello, i have a small problem.

I'm creating a mini missions servers and is structured in this way:

The main core such as login, register, anticheat etc is a filterscript file.

The missions are placed in gamemodes folder.

Now the problem is, i've added a server side money system in the main core filterscript file, so i replaced every callback to custom (Ex: GivePlayerMoney became GivePlayerCash).

I've tried to replace the default money callbacks in gamemodes too, from GPM to GPC but having the "Undefined symbol GivePlayerCash".

Since i can't copy the code in 50 gamemodes, is there a way to read it from the main core filterscript?

In short words, i've the server side money placed in filterscripts but i need to replace the default callbacks in gamemodes too, without redefining everything.

TheLegend1
18/09/2015, 08:29 PM
Hey.
Well as far as i know yes there is possible to include an FS inside ur gm - only include it like .inc but only with .pwn example
#include test.pwn
or try
#include filterscripts/test.pwn

Face9000
18/09/2015, 08:34 PM
This will not cause errors?

Aliassassin123456
18/09/2015, 08:35 PM
What TheLegend1 said is false.
In your gamemodes and filterscripts you must put this:


GivePlayerCash(playerid, money) return CallRemoteFunction("GiveCash", "ii", playerid, money);

GetPlayerCash(playerid) return CallRemoteFunction("GetCash", "i", playerid);

ResetPlayerCash(playerid) return CallRemoteFunction("ResetCash", "i", playerid);


And put this code on your AntiCheat script (that contain the money variable):


forward GiveCash(playerid, money);
forward GetCash(playerid);
forward ResetCash(playerid);

public GiveCash(playerid, money)
{
if(IsPlayerConnected(playerid))
{
MoneyVariable[playerid] += money;
GivePlayerMoney(playerid, money);
return 1;
}
return 0;
}

public GetCash(playerid)
{
if(IsPlayerConnected(playerid)) return MoneyVariable[playerid];
return 1;
}

public ResetCash(playerid)
{
if(IsPlayerConnected(playerid))
{
MoneyVariable[playerid] = 0;
ResetPlayerMoney(playerid);
return 1;
}
return 0;
}

Face9000
18/09/2015, 08:53 PM
Aliassassin i resolved just by using CallRemoteFunction("GiveCash", "ii", playerid, money);

And i have a different anti cheat code but it works tho. Thanks :)