SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 15/08/2011, 06:23 PM   #1
grand.Theft.Otto
High-roller
 
grand.Theft.Otto's Avatar
 
Join Date: Sep 2010
Location: Canada
Posts: 1,059
Reputation: 65
Default /hits Problem

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?
__________________


grand.Theft.Otto is offline  
Old 16/08/2011, 07:05 PM   #2
Backwardsman97
High-roller
 
Backwardsman97's Avatar
 
Join Date: Nov 2007
Posts: 1,501
Reputation: 36
Default Re: /hits Problem

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.
Backwardsman97 is offline  
Old 16/08/2011, 08:14 PM   #3
grand.Theft.Otto
High-roller
 
grand.Theft.Otto's Avatar
 
Join Date: Sep 2010
Location: Canada
Posts: 1,059
Reputation: 65
Default Re: /hits Problem

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?
__________________


grand.Theft.Otto is offline  
Old 16/08/2011, 09:32 PM   #4
Backwardsman97
High-roller
 
Backwardsman97's Avatar
 
Join Date: Nov 2007
Posts: 1,501
Reputation: 36
Default Re: /hits Problem

Probably.
Backwardsman97 is offline  
Old 17/08/2011, 01:31 AM   #5
Babul
High-roller
 
Babul's Avatar
 
Join Date: Sep 2009
Location: in a cement block
Posts: 1,785
Reputation: 251
Default Re: /hits Problem

a per-player variable will fix it:
Code:
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...
__________________
FireWorks

new sscanf2 custom specifiers available for Download, read the Release Topic
Babul is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Vehicle hits? kelken Scripting Help 1 21/09/2011 05:40 PM
When player hits spawn Trucker[UK] Scripting Help 8 25/08/2011 08:04 PM
Looping through hits Ihsan-Cingisiz Help Archive 9 19/03/2011 03:17 PM
Detect if an object hits the ground DaneAMattie Help Archive 1 04/03/2011 07:58 PM
The music hits of your country Bogdan Cirstea Everything and Nothing 26 02/12/2008 01:57 PM


All times are GMT. The time now is 09:02 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.