SA-MP Forums Archive
Pickup Help! - 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: Pickup Help! (/showthread.php?tid=122437)



Pickup Help! - sidhu123 - 21.01.2010

Hello!

I made a pickup thats supposed to restore the player's health to 100%, set their drunk level to 0, play a sound when the pickup is picked up, and subtract $250 from their money.

The problem I have is that if you walk through the pickup, the player's health gets set to 100, the sound plays, and $250 gets taken away from their balance. The drunk level doesn't reset back to 0. In order for it to reset back to 0, you must walk through the pickup 2 times.

Can anyone help me fix this problem please?!

http://pastebin.com/m7bc626ee


Re: Pickup Help! - sidhu123 - 22.01.2010

BUMP!

Anyone?


Re: Pickup Help! - Babul - 22.01.2010

may i ask if that happens, when you pick it up if your health is >50 ?



Re: Pickup Help! - sidhu123 - 22.01.2010

The drunk level gets set when the health is 50% or under.


Re: Pickup Help! - Babul - 22.01.2010

did u try a timer like 1000 ms instead of using OnPlayerUpdate?
maybe the problem is caused coz the OnPlayerUpdate gets called too often, while the script processes the pickup?
maybe its a return 1; missing in the Pickup script?


Re: Pickup Help! - Jakku - 22.01.2010

I just quess, but how about SetPlayerDrunkLevel(playerid, 0.0);?


Re: Pickup Help! - sidhu123 - 22.01.2010

Quote:
Originally Posted by Babul
did u try a timer like 1000 ms instead of using OnPlayerUpdate?
maybe the problem is caused coz the OnPlayerUpdate gets called too often, while the script processes the pickup?
maybe its a return 1; missing in the Pickup script?
I did, but then the message "Get to the hospital..." spams.

Quote:
Originally Posted by Jakku
I just quess, but how about SetPlayerDrunkLevel(playerid, 0.0);?
...If you looked, it already had that line.


Re: Pickup Help! - sidhu123 - 24.01.2010

Anybody?!


Re: Pickup Help! - Miguel - 24.01.2010

I know it's a dumb reply, but... :
pawn Код:
SetPlayerDrunkLevel(playerid, 0.0);
SetPlayerDrunkLevel(playerid, 0.0);
// why don't you use it twice xD



Re: Pickup Help! - sidhu123 - 24.01.2010

Quote:
Originally Posted by SAWC™
I know it's a dumb reply, but... :
pawn Код:
SetPlayerDrunkLevel(playerid, 0.0);
SetPlayerDrunkLevel(playerid, 0.0);
// why don't you use it twice xD
Not dumb at all. I tried that before, and was told by another friend of mine to do that. It didn't work though