SA-MP Forums Archive
/hits Problem - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /hits Problem (/showthread.php?tid=276910)



/hits Problem - grand.Theft.Otto - 15.08.2011

Say I /hit 7 15000 for example. 7 would be my id because of bots, and 15000 as the hit amount. I made a /hits command to show all hits, so it shows "Hit for grandtheftotto || by grandtheftotto || price: 15000"

I know I /hit myself and it will be changed as soon as I'm done testing But the problem is, for example: /hit 4 54000 (id 4 is a bot), it will place the hit on the player, and show 2 hits available in /hits which is working right but the problem is the last hit amount/price will replace the first hit, so instead of it saying:

Quote:

"Hit for grandtheftotto || by grandtheftotto || price: 15000"
"Hit for botname || by grandtheftotto || price: 54000"

It will say:

Quote:

"Hit for grandtheftotto || by grandtheftotto || price: 54000"
"Hit for botname || by grandtheftotto || price: 54000"

So I need to fix it so it doesn't show the last hit amount/price for all players, but instead show their separate amounts. Any solution?


Re: /hits Problem - Backwardsman97 - 16.08.2011

Show some code. I think I know how you're doing it. You're making the amount each player places stored with that player instead of the other player.


Re: /hits Problem - grand.Theft.Otto - 16.08.2011

It probably has something to do with my hitamount variable. At the moment it is a global variable, but it isn't indexed (it's not MAX_PLAYERS). That must be why right?


Re: /hits Problem - Backwardsman97 - 16.08.2011

Probably.


Re: /hits Problem - Babul - 17.08.2011

a per-player variable will fix it:
Код:
SetPVarInt(HitRecieverID,"HitPlacedByID",playerid);
SetPVarInt(HitRecieverID,"HitPlacedAmont",Amount);
i bet now you know what to do ^^
if you want, i will send you my /hit callback via xf, it allows multiple hits on a player, but the hits are irreversible...