Jump to content

something wron


killeryoyo

Recommended Posts

Posted

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?

Posted

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

Posted
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

Posted
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.

Posted
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

Posted

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.

:roll:

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...