LiOneLMeSsIShoT Posted November 29, 2013 Share Posted November 29, 2013 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
TAPL Posted November 29, 2013 Share Posted November 29, 2013 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
LiOneLMeSsIShoT Posted November 29, 2013 Author Share Posted November 29, 2013 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 ._. Alright i will ..and sorry. Link to comment
LiOneLMeSsIShoT Posted November 29, 2013 Author Share Posted November 29, 2013 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 ._. Alright i will ..and sorry. Same Error when i changed. Link to comment
TAPL Posted November 29, 2013 Share Posted November 29, 2013 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") Link to comment
LiOneLMeSsIShoT Posted November 29, 2013 Author Share Posted November 29, 2013 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 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
TAPL Posted November 29, 2013 Share Posted November 29, 2013 setTimer(function() x, y, z = unpack(pbags[math.random(#pbags)]) baga = createPickup(x, y, z, 3, 1210) end, 50000, 1) Link to comment
LiOneLMeSsIShoT Posted November 29, 2013 Author Share Posted November 29, 2013 setTimer(function() x, y, z = unpack(pbags[math.random(#pbags)]) baga = createPickup(x, y, z, 3, 1210) end, 50000, 1) ًًWOow.. Cool works..but how can i make all pickups in the table respawn? like i don't need only one x , y, z spawn..i want all of them spawn...it's able to do or what Link to comment
TAPL Posted November 29, 2013 Share Posted November 29, 2013 You want spawn pickup for all positions in the table at same time? Link to comment
LiOneLMeSsIShoT Posted November 29, 2013 Author Share Posted November 29, 2013 You want spawn pickup for all positions in the table at same time? YYes. Link to comment
TAPL Posted November 29, 2013 Share Posted November 29, 2013 You need to do loop for the table, also you will have to create a table to insert all pickups element. Link to comment
LiOneLMeSsIShoT Posted November 29, 2013 Author Share Posted November 29, 2013 You need to do loop for the table, also you will have to create a table to insert all pickups element. can you give me example to do with my table? Link to comment
TAPL Posted November 29, 2013 Share Posted November 29, 2013 for _, i in ipairs(pbags) do createPickup(i[1], i[2], i[3], 3, 1210) end Link to comment
LiOneLMeSsIShoT Posted November 29, 2013 Author Share Posted November 29, 2013 for _, i in ipairs(pbags) do createPickup(i[1], i[2], i[3], 3, 1210) end what i[1] , 2 and 3 !! don't understand Link to comment
LiOneLMeSsIShoT Posted November 29, 2013 Author Share Posted November 29, 2013 for _, i in ipairs(pbags) do createPickup(i[1], i[2], i[3], 3, 1210) end what i[1] , 2 and 3 !! don't understand 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
TAPL Posted November 29, 2013 Share Posted November 29, 2013 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
LiOneLMeSsIShoT Posted November 29, 2013 Author Share Posted November 29, 2013 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
TAPL Posted November 29, 2013 Share Posted November 29, 2013 I told you already, you can't use variable because it will be overwrite in the loop, you must use table. Link to comment
LiOneLMeSsIShoT Posted November 29, 2013 Author Share Posted November 29, 2013 I told you already, you can't use variable because it will be overwrite in the loop, you must use table. alright i must store them in table...can you give me an example with this table which i'm going to make and store everything on it? Link to comment
LiOneLMeSsIShoT Posted November 29, 2013 Author Share Posted November 29, 2013 I told you already, you can't use variable because it will be overwrite in the loop, you must use table. alright i must store them in table...can you give me an example with this table which i'm going to make and store everything on it? C'mon man ! give me an example to store them in table please. Link to comment
TAPL Posted November 29, 2013 Share Posted November 29, 2013 I gave you enough code already, you have to try yourself. Link to comment
LiOneLMeSsIShoT Posted November 29, 2013 Author Share Posted November 29, 2013 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? Link to comment
LiOneLMeSsIShoT Posted December 1, 2013 Author Share Posted December 1, 2013 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? Link to comment
Chronic Posted December 1, 2013 Share Posted December 1, 2013 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
LiOneLMeSsIShoT Posted December 1, 2013 Author Share Posted December 1, 2013 I mean...after the objects spawn in one time...how i defined them to use themm??? 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