Carlos23 Posted June 21, 2014 Posted June 21, 2014 function indit(thePlayer) setElementData(thePlayer, "zsaksz", 0) end addEventHandler ( "onResourceStart", getRootElement(), indit ) function pakolas(thePlayer) if getElementData(thePlayer,"zsaksz") == 0 then if (exports.global:hasItem(thePlayer, 158) ) then setElementData(thePlayer, "zsaksz", 1222) exports.global:takeItem(thePlayer, 158) exports.global:giveItem(thePlayer, 159, 1) setElementInterior(ped, 1) burger = createObject(1550,0,0,0) setElementDimension(burger, 19) setElementInterior(burger, 1) exports.bone_attach:attachElementToBone(burger,thePlayer,3,0,-0.25,0,0,50,180) -- triggerClientEvent(thePlayer, "guielo", thePlayer) else outputChatBox("Elöbb kéne egy zsák amibe pakolhatsz...", thePlayer, 255,100,0) end else outputChatBox("Már van rajtad egy táska. Egyszerre nem bírsz el többet." .. zsakrajta .. " ", thePlayer, 255,100,0) end end if getElementData(thePlayer,"zsaksz") == 0 then doesn't work
Et-win Posted June 21, 2014 Posted June 21, 2014 if tonumber(getElementData(thePlayer,"zsaksz")) == 0 then It will be saved as a string, so get it as number (Correct me if I'm wrong) EDIT: You are not starting the function 'pakolas'?
Carlos23 Posted June 21, 2014 Author Posted June 21, 2014 addEventHandler( "onMarkerHit", pakol, pakolas ) if still not work Solution?
Et-win Posted June 21, 2014 Posted June 21, 2014 addEventHandler( "onMarkerHit", pakol, pakolas ) if still not work Solution? 'pakol' is not defined? Change it to getRootElement() otherwise. Also I would change: addEventHandler ( "onResourceStart", getRootElement(), indit ) To: addEventHandler ( "onResourceStart", getResourceRootElement(), indit ) Because it is otherwise starts the function everytime a resource starts. (Except is you want that, then leave it how it is)
Carlos23 Posted June 21, 2014 Author Posted June 21, 2014 I changed, but the things behind the "If" so they do not go. I do not understand.
Et-win Posted June 21, 2014 Posted June 21, 2014 function indit(thePlayer) setElementData(thePlayer, "zsaksz", 0) end addEventHandler ( "onResourceStart", getRootElement(), indit ) Event 'onResourceStart' can't send 'thePlayer' lol. That's why it doesn't work. You have to give up the player...
diesel974 Posted June 21, 2014 Posted June 21, 2014 If im not wrong, you want to set the element data "zsaksz" with 0 as data to players who join your server?? If thats the case then use onPlayerLogin and then instead of using thePlayer, you can use source .
Carlos23 Posted June 21, 2014 Author Posted June 21, 2014 I replaced function indit(thePlayer) setElementData(thePlayer, "zsaksz", 0) end addEventHandler ( "onPlayerJoin", getRootElement(), indit ) But does not work
Carlos23 Posted June 21, 2014 Author Posted June 21, 2014 function indit() setElementData(source, "zsaksz", 0) end addEventHandler ( "onPlayerJoin", getRootElement(), indit ) if (getElementData(source,"zsaksz")) == 0 then Does't work..
Et-win Posted June 21, 2014 Posted June 21, 2014 function indit() setElementData(source, "zsaksz", 0) end addEventHandler ( "onPlayerJoin", getRootElement(), indit ) function pakolas(thePlayer) if getElementData(thePlayer,"zsaksz") == 0 then if (exports.global:hasItem(thePlayer, 158) ) then setElementData(thePlayer, "zsaksz", 1222) exports.global:takeItem(thePlayer, 158) exports.global:giveItem(thePlayer, 159, 1) setElementInterior(ped, 1) burger = createObject(1550,0,0,0) setElementDimension(burger, 19) setElementInterior(burger, 1) exports.bone_attach:attachElementToBone(burger,thePlayer,3,0,-0.25,0,0,50,180) -- triggerClientEvent(thePlayer, "guielo", thePlayer) else outputChatBox("Elöbb kéne egy zsák amibe pakolhatsz...", thePlayer, 255,100,0) end else outputChatBox("Már van rajtad egy táska. Egyszerre nem bírsz el többet." .. zsakrajta .. " ", thePlayer, 255,100,0) end end addEventHandler ( "onMarkerHit", getRootElement(), pakolas)
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