13.12.2013, 12:37
Is there a way to detect when player enter/exit Pay'N'Spray ?
Through my search I haven't find any but an include and some tips..
The problem with the include that it makes every vehicle's health 999 and detect when it gets 1000, But I don't like it as if someone cheated it will call the function.. So I decided to make one myself..
Tips
I tried making a timer and check every player near Pay'N'Spray and if he stood still for more then 3 seconds I call the function.. But what If he sprayed..then stood still.. It'll still call the function every 3 seconds.. So I tried to check if the player losses 100 and it worked.. But there is a problem.. You could spray your vehicle for free if its health is 1000.. And If I checked for the health I'll get back that he might stand still at the Pay'N'Spray with 1000 vehicle health and the function will keep calling.. Also I got an idea to make invisible Checkpoint/Pickup at every Pay'N'Spray and check OnPlayerEnterCheckPoint/OnPlayerPickUpPickUp instead of a timer... Can you tell me your suggestions/ideas to make this ? Or a link if it already exist..
Through my search I haven't find any but an include and some tips..
The problem with the include that it makes every vehicle's health 999 and detect when it gets 1000, But I don't like it as if someone cheated it will call the function.. So I decided to make one myself..
Tips
Quote:
Not really hard to do.
First thing I do when scripting something like this is to break it down into things we know. 1. The pay n spray locations do not move. 2. When a car is sprayed the car health goes back up to 1000. 3. The Player loses $100. 4. The car stays still while being sprayed You could do a check at every pay n spray to check if a play is within a certain distance, then if they are get the health of the car. Then if the cars health goes back up to 1000 while they are within that area then they probably used the pay n spray, you could also check if they lose money. So if they are within that area, their car has healed and they have lost $100 give the business $100. |