Prevent carparking? - 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: Prevent carparking? (
/showthread.php?tid=304530)
Prevent carparking? -
Face9000 - 18.12.2011
Hello guys,i was thinking if it's possible to prevent carparking and autokill the player that made carpark.
Ex: Player 1 carpark Player 2 - Player 1 get's autokilled.
Thanks.
Re: Prevent carparking? -
Basssiiie - 18.12.2011
Maybe you can do it with OnPlayerTakeDamage, but I'm not sure how many times that callback is called if you're getting car parked. (If it's called every update while you're lying under the car, it can be very useful to prevent it.

)
Re: Prevent carparking? -
Face9000 - 18.12.2011
mmmm..thanks...another method?
Re: Prevent carparking? -
Face9000 - 19.12.2011
BUMP.
Re: Prevent carparking? -
Rob_Maate - 19.12.2011
Well... You could actually create a system where if OnPlayerTakeDamage occurs WITHOUT a "killerid", or "killerid" is equal to INVALID_PLAYER_ID, the damage is undone. This would prevent death by falling also... which is not something you want. HOWEVER you can create a timer that returns "OnPlayerTakeFallDamage" if the player's "z" velocity reaches a certain speed.
Re: Prevent carparking? -
Calgon - 19.12.2011
Use GetClosestVehicle() (might be in useful functions thread(s)), to determine the closest vehicle, determine the offset between the player and the vehicle in OnPlayerTakeDamage and try to determine if the car is stationary on top of the player (by checking the velocity), then clear the player's animations and they should get back up, but be in the middle of a car.
Re: Prevent carparking? -
Rob_Maate - 19.12.2011
Quote:
Originally Posted by Calgon
Use GetClosestVehicle() (might be in useful functions thread(s)), to determine the closest vehicle, determine the offset between the player and the vehicle in OnPlayerTakeDamage and try to determine if the car is stationary on top of the player (by checking the velocity), then clear the player's animations and they should get back up, but be in the middle of a car.
|
So if you stand next to a car, you'll survive a minigun onslaught.
Re: Prevent carparking? -
Gamer_Z - 19.12.2011
one link:
https://sampwiki.blast.hk/wiki/GetPlayerAnimationIndex + 1 callback: OnPlayerUpdate OR Timer = problem solved.
edit: lol u guys were faster ;x
Re: Prevent carparking? -
Calgon - 19.12.2011
Quote:
Originally Posted by Rob_Maate
So if you stand next to a car, you'll survive a minigun onslaught.
|
No, clearing animations doesn't make you invincible... Or there's always GetPlayerAnimationIndex.