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: Server sided money (
/showthread.php?tid=586041)
Server sided money -
DerickClark - 18.08.2015
If a hacker hack money it set it back where it was. how to do that server sided. I'm using Ini.
PlayerInfo[playerid][pCash].
Re: Server sided money -
Denying - 18.08.2015
it shouldn't be checked on OnPlayerUpdate bcz it gets called too often, but here is the idea:
Код:
public OnPlayerUpdate(playerid)
{
if(GetPlayerMoney(playerid) != PlayerInfo[playerid][pCash])
{
GivePlayerMoney(playerid, -GetPlayerMoney(playerid));
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
// Player's a hacker, do whatever u want with him
}
return 1;
}
Re: Server sided money -
LetsOWN[PL] - 18.08.2015
Quote:
Originally Posted by DerickClark
If a hacker hack money it set it back where it was. how to do that server sided. I'm using Ini.
PlayerInfo[playerid][pCash].
|
There are basically two ways. One is to create a timer, which will refresh in, for example, 1000 miliseconds, and will reset player money (ResetPlayerMoney()) and set it back to PlayerInfo[playerid][pCash] (GivePlayerMoney(playerid, PlayerInfo[playerid][pCash])).
The second one:
Instead of:
pawn Код:
if( GetPlayerMoney(playerid) < 10 ) return SendClientMessage( playerid, -1, "You've less than $10..");
just do:
pawn Код:
if( PlayerInfo[playerid][pCash] < 10 ) return SendClientMessage( playerid, -1, "You've less than $10..");
Additionally, with this second one, before return You can reset player money and set it (as in 1st way) back to PlayerInfo[playerid][pCash].
Greetings.
Re: Server sided money -
DerickClark - 18.08.2015
I mean only if the player hacked the money. but it's resting this one
GivePlayerMoney(playerid, trucker[End][cost]); i don't want it to reset this one.
Re: Server sided money -
kiloman3 - 19.08.2015
Quote:
Originally Posted by DerickClark
I mean only if the player hacked the money. but it's resting this one
GivePlayerMoney(playerid, trucker[End][cost]); i don't want it to reset this one.
|
Replace this with
Код:
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash] + trucker[End][cost];
after the timer comes back around the player will get the pay for the trucker job.