Help to use serverside money in FS too.
#1

Hey, my GM uses a serverside money system, and i need that to work with my FS. Right now what happens is:

The player presses buy, the money goes down, and then up again ( the player dosent loose any money ). This is after i have done this:

I found this from the GM and putted it in my FS:

pawn Код:
enum pInfo
{
    pCash
};
new PlayerInfo[MAX_PLAYERS][pInfo];

stock GiveMoney(playerid, money)
{
    PlayerInfo[playerid][pCash] += money;
    ResetPlayerMoney(playerid);
    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
    return 1;
}
And then i replaced all
pawn Код:
GivePlayerMoney
in the FS to
pawn Код:
GiveMoney
Compiles with no errors or warnings. I don't know if it was like that before i edited the FS and tried to make it work or not. Please help.
Reply
#2

Please someone?
Reply
#3

You need to make sure your money functions are called in the gamemode script make an include file to call those functions with CallRemoteFunction.

pawn Код:
#define GiveMoney(%0,%1) CallRemoteFunction("GiveMoney","ii",%0,%1)
Reply
#4

I have read around a bit, and tried to understand what you meant here, because it was a bit hard for me to understand exactly what to do. Could you please explain what i need to do where? Should i create a include file? with what in it? and should i include it in the GM? I dont understand.
Reply
#5

You just make an include with your gamemode functions then include it with your filterscripts

example
#include <gamemodefunctions>

Then you can call your gamemode functions. Keep in mind your gamemode functions require a forward / public
Reply
#6

You can use a stock if you want it just in the gamemode or an include.. However, I'd recommend switching it to a public and forwarding it for use with
pawn Код:
CallRemoteFunction("GiveMoney","ii", playerid, valuehere);
There's plenty of ways to do it.
Reply
#7

Ok, I added this in the include:

pawn Код:
#include <a_samp>

enum pInfo
{
    pCash
};
new PlayerInfo[MAX_PLAYERS][pInfo];

forward GiveMoney(playerid, money);
public GiveMoney(playerid, money)
{
    PlayerInfo[playerid][pCash] += money;
    ResetPlayerMoney(playerid);
    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
    return 1;
}
Did
pawn Код:
#include <serverside>
in the FS, and added
pawn Код:
#define GiveMoney(%0,%1) CallRemoteFunction("GiveMoney","ii",%0,%1) where the other defines where, no errors when i compiled.
Restarted the server and went to test it out, bought a car that costed 10k.. and my money went up 12346..

I really need this to work with the GM, its a car dealership system. Please help me out guys!

Here is the code for the FS, just in case it is needed: http://pastebin.com/4Yzpnhvj

I have no idea how to fix this.
Reply
#8

Please help me guys! It's urgent!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)