Jump to content

[Error] Help please


Recommended Posts

I got error i don't understand..plesae check

client:

function SuccessSnd () 
local sound = playSound ("Jobs_System/songs/MissionComplete.mp3") 
setSoundVolume (sound, 1.0) 
end 
addEvent ("winSound", true) 
addEventHandler ("winSound", getRootElement(), SuccessSnd) 

server:

function onBtnClick() 
    local atthedTo = exports.bone_attach:getElementBoneAttachmentDetails(bagb) 
    if atthedTo == source then 
        local money = math.random(1000, 2000) 
        givePlayerMoney(source, money) 
        destroyElement(bagb) 
        triggerClientEvent(source, "WarningText", source, "reward", "You have rewarded and got "..money.. "$ from the dealer!! Good Job Pro!") 
        outputChatBox ("you have Rewarded and got "..money.."$ from the dealer...You are PRO!! Good JOB!", source, 0, 255, 0, false) 
        triggerClientEvent ("winSound", source) 
    else 
        triggerClientEvent(source, "WarningText", source, "reward", "You have to get the briefcase of weapons First!")       
    end 
end 

error:

Bad 'sound/player' pointer @ 'setSoundVolume'(1) 

Help Please :/

Link to comment
  • Replies 67
  • Created
  • Last Reply

Top Posters In This Topic

triggerClientEvent ("winSound", source) 

Should be:

triggerClientEvent(source, "winSound", source) 

And please keep post in same topic when the code is related and please pick different topic name as i start to get confused because all your topics have same name ._.

Link to comment
Wrong path i guess, Jobs_System is the name of the script?

You don't need to put the name of the script.

local sound = playSound ("songs/MissionComplete.mp3") 

Thanks PRO! :D :D :D

I should learn from the errors you fix for me

but i want to "setTimer" to re create the bag when it get removed after time...but actually setTimer (x, y, z, 50000, 1) gives me error :/ so what should i do..

Link to comment
for _, i in ipairs(pbags) do 
    createPickup(i[1], i[2], i[3], 3, 1210) 
end 

what i[1] , 2 and 3 o.O!!

don't understand xD

Anyway i've tried it...

  
local pbags = { 
    {2293.154, 561.47, 7.78}, 
    {2296, 150390625540, 82324218751, 794376373291} 
} 
    for _, i in ipairs(pbags) do 
        createPickup(i[1], i[2], i[3], 3, 1210) 
    end 
    

and the pickup spawn...but when i try to get the pickup..it don't be attached.

Link to comment

This is how your table look:

local pbags = { 
    {2293.154, 561.47, 7.78}, 
} 

i[1] will be first number which it 2293.154

i[2] second number which it 561.47

i[3] third number which it 7.78

And of course now it become more complexity as you have created multiple pickups in same time where it means now you can't have one variable for the pickup and one variable for the object you must store them in table.

Link to comment
This is how your table look:
local pbags = { 
    {2293.154, 561.47, 7.78}, 
} 

i[1] will be first number which it 2293.154

i[2] second number which it 561.47

i[3] third number which it 7.78

And of course now it become more complexity as you have created multiple pickups in same time where it means now you can't have one variable for the pickup and one variable for the object you must store them in table.

Alright... i did it:

local pbags = { 
    {2293.154, 561.47, 7.78}, 
    {2287.2265625, 566.3486328125, 7.78125} 
} 
  
    for _, i in ipairs(pbags) do 
       local baga = createPickup(i[1], i[2], i[3], 3, 1210) 
    end 
function onPickupHit(player) 
    if source == baga then 
        if not isPedInVehicle(player) and not isPedDead(player) then 
            bagb = createObject(1210, 0, 0, 0) 
            exports.bone_attach:attachElementToBone(bagb,player,12,0,0.1,0.3,0,180,0) 
            destroyElement(source) 
        end 
    end 
end 
addEventHandler("onPickupHit", root, onPickupHit) 
  
function onBtnClick() 
    local atthedTo = exports.bone_attach:getElementBoneAttachmentDetails(bagb) 
    if atthedTo == source then 
        local money = math.random(1000, 2000) 
        givePlayerMoney(source, money) 
        destroyElement(bagb) 
         
       setTimer(function() x, y, z = unpack(pbags[math.random(#pbags)])     
        baga = createPickup(x, y, z, 3, 1210) 
    end, 50000, 1) 
        triggerClientEvent(source, "WarningText", source, "reward", "You have rewarded and got "..money.. "$ from the dealer!! Good Job Pro!") 
        outputChatBox ("you have Rewarded and got "..money.."$ from the dealer...You are PRO!! Good JOB!", source, 0, 255, 0, false) 
        triggerClientEvent (source,"winSound", source) 
    else 
        triggerClientEvent(source, "WarningText", source, "reward", "You have to get the briefcase of weapons First!")       
    end 
end 
addEvent("reward", true) 
addEventHandler ("reward", root, onBtnClick) 
  
function onPlayerQuit() 
    local atthedTo = exports.bone_attach:getElementBoneAttachmentDetails(bagb) 
    if atthedTo == source then 
        destroyElement(bagb) 
        local x, y, z = getElementPosition(source) 
        baga = createPickup(x, y, z, 3, 1210) 
    end 
end 
addEventHandler("onPlayerQuit", root, onPlayerQuit) 

but still when i hit the pickup..it don't get attached on bone..

Link to comment
I gave you enough code already, you have to try yourself.

Yes man i will try but how i give name to the first pickup to use it? i mean how to give the x,y,z names to use them?

How to give a variable for the object?

Why are you asking silly questions? You know how to make variables because you made one here.

local sound = playSound ("songs/MissionComplete.mp3") 

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