19.08.2012, 08:05
Yeah, sometime it will be suck if we can't use a filterscript we have a Server-Sided Money Gamemode. And i want to share my way to fix this. I will use SetPVarInt here.
First, We just open our Gamemode, and we have to find the timer to check the money, like this
Next, We go to the public 'MoneyCheck'
Next, Let the GM Opened, and open the Filterscript. Find the GivePlayerMoney. We will use the PVar here, every GivePlayerMoney should be replaced with SetPVarInt. Example, change this:
To this:
The name of variable can be changed, the integer of the PVarInt should same with the value in GivePlayerMoney.
Now, we just have to add GivePlayerSafeMoney (or anything like this) on your GM, We take the value through the PVar. Dont forget to add this on the timer public, like this
And Last, dont forget to reset the PVarInt, so the money won't be added again and again. Just use SetPVarInt(playerid, "HouseMoney", 0)
And that's it, I have test this and it worked. Sorry for my bad english, for question or suggestion please reply here.
First, We just open our Gamemode, and we have to find the timer to check the money, like this
pawn Code:
public OnGameModeInit()
{
SetTimer("MoneyCheck", 1000, 1);
return 1;
}
pawn Code:
forward MoneyCheck();
public MoneyCheck();
{
foreach(Player, i)
{
ResetPlayerMoney(i);
GivePlayerMoney(i, GetPlayerCash(i));
}
}
pawn Code:
GivePlayerMoney(playerid, -House[i][Price]);
pawn Code:
SetPVarInt(playerid, "HouseMoney", -House[i][Price]);
Now, we just have to add GivePlayerSafeMoney (or anything like this) on your GM, We take the value through the PVar. Dont forget to add this on the timer public, like this
pawn Code:
forward MoneyCheck();
public MoneyCheck();
{
foreach(Player, i)
{
ResetPlayerMoney(i);
GivePlayerMoney(i, GetPlayerCash(i));
GivePlayerSafeCash(i, GetPVarInt(playerid, "HouseMoney"));
}
}
pawn Code:
forward MoneyCheck();
public MoneyCheck();
{
foreach(Player, i)
{
ResetPlayerMoney(i);
GivePlayerMoney(i, GetPlayerCash(i));
GivePlayerSafeCash(i, GetPVarInt(playerid, "HouseMoney"));
SetPVarInt(playerid, "HouseMoney", 0);
}
}