Evil# Posted August 6, 2015 Share Posted August 6, 2015 Hi guys, there's a bug while i was making a script and i can't fix it so please help local marker = createMarker(2850.94849, -1532.66565, 11.09907, "corona", 2, 255, 0, 0, 255) local hp = getElementHealth(player) function HealthHandler() bindKey (source,"X","down", function(player,key,state) if hp >= 100 then outputChatBox("You already have 100 health", player, 255, 0, 0) else if getPlayerMoney(player) >= 30 then if hp >= 100 then hp = 100 end setElementHealth(localPlayer, hp+100) setElementHealth(player, 50) takePlayerMoney(player, 30) else outputChatBox("You don't have enough money to take Health, $30", player, 255, 0, 0) end end ) end end end end addEventHandler ("onMarkerHit", marker, HealthHandler) function chatBoxHandler(player) outputChatBox("Press X to take Health, $30", player, 0, 255, 0) end addEventHandler("onMarkerHit", marker, chatBoxHandler) Link to comment
KariiiM Posted August 6, 2015 Share Posted August 6, 2015 Any debug errors? use /debugscript 3 in game and restart the script to check the errors, copy them and post them here. Link to comment
KariiiM Posted August 6, 2015 Share Posted August 6, 2015 BTW, your code is full of errors, also you are using localPlayer in server side, since localPlayer is client side only.. i got its server side from "onMarkerHit" setElementHealth(localPlayer, hp+100) Tell me the idea and i'll try to help you out to make what you want Do you want to make when a player click on "x" he healt himself? Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now