killeryoyo Posted December 5, 2015 Share Posted December 5, 2015 hello guys local alcoholLevels = {["Beer"]=10,["Cider"]=5,["Vodka"]=60,["Wine"]=20,["Whisky"]=50} function purchaseDrink(item,price) local money = getPlayerMoney(localPlayer) if money >= tonumber(price) then outputChatBox("* You bought some "..item.." for $"..price..".",255,255,0) takePlayerMoney(thePlayer,price) local sigarette = createObject ( 1485, 0, 0, 0 ) cigarettes[thePlayer] = sigarette exports.bone_attach:attachElementToBone(sigarette,thePlayer,11,0.15,0.1,0.15,0,180,30) outputChatBox("* You drink some "..item..".",0,255,0) setElementData(localPlayer,"drunk",(getElementData(localPlayer,"drunk") or 0)+(alcoholLevels[item]/100),false) else there is something wrong here. It doesnt take money from the player and it doesnt create the object at least. Can someone help? Link to comment
NeXuS™ Posted December 5, 2015 Share Posted December 5, 2015 Try to put down the object at your position. Link to comment
Anubhav Posted December 5, 2015 Share Posted December 5, 2015 You need to have proper position for your object. 0, 0, 0 is underground position, 0,0,4 is the top one. You used thePlayer in takePlayerMoney. Replace it by localPlayer Link to comment
killeryoyo Posted December 5, 2015 Author Share Posted December 5, 2015 You need to have proper position for your object. 0, 0, 0 is underground position, 0,0,4 is the top one.You used thePlayer in takePlayerMoney. Replace it by localPlayer still the both didnt work idk whats wrong. i see all is good only the text is working... and no errors Link to comment
Anubhav Posted December 6, 2015 Share Posted December 6, 2015 Show the full script maybe, and are there errors/warnings in /debugscript 3 Link to comment
killeryoyo Posted December 6, 2015 Author Share Posted December 6, 2015 Still its not working and there is no errors and no need to view all the script because its already working except that place Link to comment
SpecT Posted December 6, 2015 Share Posted December 6, 2015 Still its not working and there is no errors and no need to view all the script because its already working except that place Post the actual code. So we can see what you have changed and what not. Link to comment
Best-Killer Posted December 10, 2015 Share Posted December 10, 2015 local alcoholLevels = {["Beer"]=10,["Cider"]=5,["Vodka"]=60,["Wine"]=20,["Whisky"]=50} function purchaseDrink(item,price) local money = getPlayerMoney(localPlayer) if money >= tonumber(price) then outputChatBox("* You bought some "..item.." for $"..price..".",255,255,0) takePlayerMoney(source,price) local sigarette = createObject ( 1485, 0, 0, 0 ) cigarettes[thePlayer] = sigarette exports.bone_attach:attachElementToBone(sigarette,thePlayer,11,0.15,0.1,0.15,0,180,30) outputChatBox("* You drink some "..item..".",0,255,0) setElementData(localPlayer,"drunk",(getElementData(localPlayer,"drunk") or 0)+(alcoholLevels[item]/100),false) else i should it will work Link to comment
SpecT Posted December 10, 2015 Share Posted December 10, 2015 Why don't you read the whole text that Anubhav wrote? You need to have proper position for your object. 0, 0, 0 is underground position, 0,0,4 is the top one.You used thePlayer in takePlayerMoney. Replace it by localPlayer He told you that position 0,0,0 is an underground position. Link to comment
Anubhav Posted December 13, 2015 Share Posted December 13, 2015 Or better start freeroam. In freeroam go where you want the object. Use /getpos Get the X,Y,Z and put it instead of 0,0,0 or 0,0,4. 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