Jump to content

something wron


killeryoyo

Recommended Posts

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

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:

Link to comment

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