NotAvailable Posted July 8, 2010 Author Share Posted July 8, 2010 (edited) -------------------------- Edited December 19, 2011 by Guest Link to comment
MaddDogg Posted July 8, 2010 Share Posted July 8, 2010 Sorry, but you seem to have no idea whatsoever, what you're doing there. "if health > 1 then" makes no sense. Do you even understand the meaning of this line? And setPlayerHealth does not exist. Would you have read the errors, it would have been clear to you. Please start learning scripting, especially control structures. Another thing: "if money > 100 then" also has a flaw. It should be ">=", because otherwise, people with exactly 100$ won't be able to use your pickup. A hint to fix this: https://wiki.multitheftauto.com/wiki/SetElementHealth Link to comment
m4rsje Posted July 8, 2010 Share Posted July 8, 2010 I will try fixing the script hang on, I was out for dinner Link to comment
m4rsje Posted July 8, 2010 Share Posted July 8, 2010 okay i fixed the bugs, and now this one is the good one: local root = getRootElement() addEventHandler("onResourceStart", root, function() a = createPickup (-707, 973, 12, 0, 0, 0) end ) addEventHandler("onPickupUse", root, function( thePlayer ) if (source == a) then local health = getElementHealth(thePlayer) if (health >=5 and health <= 100) then local money = getPlayerMoney(thePlayer) if (money >= 100) then takePlayerMoney(thePlayer, 100) setElementHealth ( thePlayer, 100 ) outputChatBox("* A hot nurse gave you a nice healing process!", thePlayer) else outputChatBox("* You dont have enough money!", thePlayer ) end else outputChatBox("*You are healhty enough to be alife", thePlayer) end end end ) Link to comment
NotAvailable Posted July 9, 2010 Author Share Posted July 9, 2010 (edited) -------------------------- Edited December 19, 2011 by Guest Link to comment
NotAvailable Posted July 9, 2010 Author Share Posted July 9, 2010 (edited) ------------------------------ Edited December 19, 2011 by Guest Link to comment
TheRealCow Posted July 9, 2010 Share Posted July 9, 2010 this script will create always new pickup when eny script start. use this to fix it: local resroot = getResourceRootElement(getThisResource()) local root = getRootElement() addEventHandler("onResourceStart", resroot, function() a = createPickup (-707, 973, 12, 0, 0, 0) end ) addEventHandler("onPickupUse", root, function( thePlayer ) if (source == a) then local health = getElementHealth(thePlayer) if (health >=5 and health <= 100) then local money = getPlayerMoney(thePlayer) if (money >= 100) then takePlayerMoney(thePlayer, 100) setElementHealth ( thePlayer, 100 ) outputChatBox("* A hot nurse gave you a nice healing process!", thePlayer) else outputChatBox("* You dont have enough money!", thePlayer ) end else outputChatBox("*You are healhty enough to be alife", thePlayer) end end end ) Link to comment
m4rsje Posted July 9, 2010 Share Posted July 9, 2010 this script will create always new pickup when eny script start.use this to fix it: local resroot = getResourceRootElement(getThisResource()) local root = getRootElement() addEventHandler("onResourceStart", resroot, function() a = createPickup (-707, 973, 12, 0, 0, 0) end ) addEventHandler("onPickupUse", root, function( thePlayer ) if (source == a) then local health = getElementHealth(thePlayer) if (health >=5 and health <= 100) then local money = getPlayerMoney(thePlayer) if (money >= 100) then takePlayerMoney(thePlayer, 100) setElementHealth ( thePlayer, 100 ) outputChatBox("* A hot nurse gave you a nice healing process!", thePlayer) else outputChatBox("* You dont have enough money!", thePlayer ) end else outputChatBox("*You are healhty enough to be alife", thePlayer) end end end ) it wont be needed, the time from the respawning of the pickup is: 0. so it will never disapear Link to comment
NotAvailable Posted July 9, 2010 Author Share Posted July 9, 2010 (edited) ------------------------------ Edited December 19, 2011 by Guest Link to comment
Razerclaus Posted December 22, 2011 Share Posted December 22, 2011 ur server lags Our server is not up, yet. Link to comment
NotAvailable Posted December 22, 2011 Author Share Posted December 22, 2011 ur server lags Our server is not up, yet. Do you know how old this topic is? 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