SA-MP Forums Archive
Changing money with a FS using server sided money - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Changing money with a FS using server sided money (/showthread.php?tid=458630)



Changing money with a FS using server sided money - Blademaster680 - 17.08.2013

Hi.

I need help with a Filterscript called PPC Housing. My gamemode is running server sided money and so I need to make the Filterscript also use the server sided money. I need the FS to share data with the Gamemode.

I dont know how to get it to share data but I tried using PVars

In Filterscript
Код:
SetPVarInt(playerid, "HouseMoney", House_CalcSellPrice(HouseID));
In Gamemode:
Код:
PlayerInfo[playerid][pCash] = GetPVarInt(playerid, "HouseSell");
But my money still goes back to what it was before I sold the house.

Is there any other way I can make it set the server sided money?

Here is a example of me setting the cash when someone finishes a job:
Код:
new cash = random(5850) + 150;
	PlayerInfo[playerid][pCash] += cash;



Re: Changing money with a FS using server sided money - Blademaster680 - 17.08.2013

Please Help Me!!!!!


Re: Changing money with a FS using server sided money - iRage - 17.08.2013

One way is making a function to give money similar to GivePlayerMoney then using CallRemoteFunction on your filterscript.


Re: Changing money with a FS using server sided money - Blademaster680 - 17.08.2013

Could you please give me an example of what I would make in the gamemode and the filterscript please


Re: Changing money with a FS using server sided money - Blademaster680 - 17.08.2013

Can someone give me an example please?


Re: Changing money with a FS using server sided money - SuperViper - 18.08.2013

Your variables are named differently. One of them is HouseMoney and the other is HouseSell.


Re: Changing money with a FS using server sided money - Blademaster680 - 18.08.2013

nope I changed the variable names to HouseSell and it still doesnt do anything

Can someone please explain how I would use the callremotefunction please?


AW: Changing money with a FS using server sided money - Nero_3D - 18.08.2013

The only thing you need to do is to use PVar and only PVar if you want to use it for all scripts

Create your own include and call it ssmoney.inc (or something like that)
pawn Код:
#include <a_samp>

stock static
    SSM_PVar[] = "SSM_Money"
;

stock SSM_SetPlayerMoney(playerid, money) {
    return SetPVarInt(playerid, SSM_PVar, money);  
}

stock SSM_GivePlayerMoney(playerid, money) {
    return SetPVarInt(playerid, SSM_PVar, GetPVarInt(playerid, SSM_PVar) + money);
}

stock SSM_GetPlayerMoney(playerid) {
    return GetPVarInt(playerid, SSM_PVar);
}

#define SetPlayerMoney(   SSM_SetPlayerMoney(
#define GivePlayerMoney(  SSM_GivePlayerMoney(
#define GetPlayerMoney(   SSM_GetPlayerMoney(
#define ResetPlayerMoney( SSM_SetPlayerMoney(.money=0,.playerid=
Using CallRemoteFunction is more complicated because you need to add update callbacks and I doubt that it would be faster


Re: Changing money with a FS using server sided money - Blademaster680 - 19.08.2013

Wouldnt people be able to hack there money then?

And would I have to change all my PlayerInfo[playerid][pCash]?
or what would I have to change