How to detect if a player gets a stunt bonus - 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: How to detect if a player gets a stunt bonus (
/showthread.php?tid=357555)
How to detect if a player gets a stunt bonus -
stormchaser206 - 07.07.2012
Hello,
How can you detect if a player gets a stunt bonus? I need it cause I am making a stunt server.
Thanks
Respuesta: How to detect if a player gets a stunt bonus -
Chris1337 - 07.07.2012
basically , you cant as is a Game client stuff. You can detect when a player changes his z coordinate , if it increases and gets money in that second , then you could print that they have make a stunt
Re: How to detect if a player gets a stunt bonus -
MP2 - 07.07.2012
There's no other possible way for a player to gain client-side money while in a vehicle, as there's only stunt bonuses and casinos (and you're not in a vehicle in a casino), so you should just be able to detect a client-side cash increase by storing the last value in a variable and running a timer of about a second.
pawn Code:
new pOldCash[MAX_PLAYERS];
// Inside your GivePlayerCash or whatever function (or hook GivePlayerMoney):
pOldCash[playerid] = cash;
// in some timer
new newcash = GetPlayerCash/Money/Whatever(playerid/i);
new oldcash = pOldCash[playerid/i];
if(newcash > oldcash && IsPlayerInAnyVehicle(playerid/i)) // Gained money and it wasn't serverside
{
new szStunt[64];
format(szStunt, sizeof(szStunt), "Stunt Bonus: $%i", newcash-oldcash);
SendClientMessage(playerid, -1, szStunt);
}
Blah. Roughly what you need to do. They could be a hacker though.