micheal1230 Posted June 16, 2012 Share Posted June 16, 2012 Well There Are No Errors I have been trying to get this working for ages but it still does'nt work function loadAllInfopoints(res1) -- Load current ones local result1 = mysql:query("SELECT * FROM infopoints") local count = 0 local highest = 0 if (result1) then local run1 = true while run1 do local row1 = exports.mysql:fetch_assoc(result1) if not (row1) then break end local id = tonumber(row1["id"]) local x = tonumber(row1["posx"]) local y = tonumber(row1["posy"]) local z = tonumber(row1["posz"]) local infomessage = (row1["message"]) local pickup = createPickup( x, y, z, 3, 1239, 0.1) exports.pool:allocateElement(pickup) setElementData ( pickup, "Message", infomessage ) exports['anticheat-system']:changeProtectedElementDataEx(pickup, "dbid", id, false) local pickupmessage = getElementData( pickup, "Message" ) outputChatBox("".. pickupmessage .."", source) count = count + 1 if id > highest then highest = id end end mysql:query_free("ALTER TABLE `infopoints` AUTO_INCREMENT = " .. mysql:escape_string((highest + 1))) end mysql:free_result(result1) end addEventHandler("onResourceStart", getResourceRootElement(), loadAllInfopoints) Link to comment
TwiX! Posted June 16, 2012 Share Posted June 16, 2012 man pls check your all code with debug or output messages. in all your posts not have errors.. Link to comment
TAPL Posted June 16, 2012 Share Posted June 16, 2012 source not defined here outputChatBox("".. pickupmessage .."", source) also what the point of doing this "".. pickupmessage .."" it can be like this outputChatBox(pickupmessage, source) Edit: about output message when walk though pickup you need to use this event https://wiki.multitheftauto.com/wiki/OnPickupHit Link to comment
micheal1230 Posted June 16, 2012 Author Share Posted June 16, 2012 (edited) man pls check your all code with debug or output messages.in all your posts not have errors.. MAN THERE AINT NO ****ING ERRORS! source not defined here outputChatBox("".. pickupmessage .."", source) also what the point of doing this "".. pickupmessage .."" it can be like this outputChatBox(pickupmessage, source) Edit: about output message when walk though pickup you need to use this event https://wiki.multitheftauto.com/wiki/OnPickupHit Edit: @TAPL How Would I Use onPickupHit For The Script Would It Be addEventHandler( "onPickupHit" , getRootElement() , loadAllInfopoints ) Edited June 16, 2012 by Guest Link to comment
TwiX! Posted June 16, 2012 Share Posted June 16, 2012 man pls check your all code with debug or output messages.in all your posts not have errors.. MAN THERE AINT NO ****ING ERRORS! you not understand outputDebugString example function test (thePlayer) local imOtherFunction = getPlayerName(thePlayer) if imOtherFunction then blablabla() end end check it : function test (thePlayer) local imOtherFunction = getPlayerName(thePlayer) outputDebugString ('imotherfunction created') if imOtherFunction then blablabla() outputDebugString ('imOtherFunction passed') end end function blablabla() outputDebugString ('passed') end Link to comment
micheal1230 Posted June 16, 2012 Author Share Posted June 16, 2012 source not defined here outputChatBox("".. pickupmessage .."", source) also what the point of doing this "".. pickupmessage .."" it can be like this outputChatBox(pickupmessage, source) Edit: about output message when walk though pickup you need to use this event https://wiki.multitheftauto.com/wiki/OnPickupHit TAPL How Would I Use onPickupHit For The Script Would It Be addEventHandler( "onPickupHit" , getRootElement() , loadAllInfopoints ) Link to comment
Castillo Posted June 16, 2012 Share Posted June 16, 2012 You have to create a function to output the info message when hit, then add the event handler "onPickupHit" after you create the pickup and attach it to that pickup. Link to comment
micheal1230 Posted June 16, 2012 Author Share Posted June 16, 2012 man pls check your all code with debug or output messages.in all your posts not have errors.. MAN THERE AINT NO ****ING ERRORS! you not understand outputDebugString example function test (thePlayer) local imOtherFunction = getPlayerName(thePlayer) if imOtherFunction then blablabla() end end check it : function test (thePlayer) local imOtherFunction = getPlayerName(thePlayer) outputDebugString ('imotherfunction created') if imOtherFunction then blablabla() outputDebugString ('imOtherFunction passed') end end function blablabla() outputDebugString ('passed') end Mate I Aint Got No Clue How To Make It Check It, Its Obviously Not Working WHATS THERE TO BLOODY CHECK! Link to comment
micheal1230 Posted June 16, 2012 Author Share Posted June 16, 2012 You have to create a function to output the info message when hit, then add the event handler "onPickupHit" after you create the pickup and attach it to that pickup. Well How Can I Get The Infomessage from that function?????????? Link to comment
TAPL Posted June 16, 2012 Share Posted June 16, 2012 You have to create a function to output the info message when hit, then add the event handler "onPickupHit" after you create the pickup and attach it to that pickup. Well How Can I Get The Infomessage from that function?????????? you already set a element data to the pickup so easily you can get it! as you do anyway!!!!!!!!!!!! local pickupmessage = getElementData( pickup, "Message" ) Link to comment
micheal1230 Posted June 16, 2012 Author Share Posted June 16, 2012 You have to create a function to output the info message when hit, then add the event handler "onPickupHit" after you create the pickup and attach it to that pickup. Well How Can I Get The Infomessage from that function?????????? you already set a element data to the pickup so easily you can get it! as you do anyway!!!!!!!!!!!! local pickupmessage = getElementData( pickup, "Message" ) Mate I Mean How Do I Get The Pickup Element From That Function Surely I Cant Just put local pickupmessage = getElementData( pickup, "Message" ) and it will find the element (pickup) automatically Link to comment
TAPL Posted June 16, 2012 Share Posted June 16, 2012 did you read wiki? https://wiki.multitheftauto.com/wiki/OnPickupHit The source of this event is the pickup that was hit by the player. so just use source local pickupmessage = getElementData( source, "Message" ) Link to comment
micheal1230 Posted June 16, 2012 Author Share Posted June 16, 2012 did you read wiki?https://wiki.multitheftauto.com/wiki/OnPickupHit The source of this event is the pickup that was hit by the player. so just use source local pickupmessage = getElementData( source, "Message" ) Mate I Mean The Element For The addEventHandler i cant use pickup as the element because it wont exist nor can i use source get the same error saying it doesnt exist addEventHandler("onPickupHit", pickup, gettehmessage) Link to comment
TAPL Posted June 16, 2012 Share Posted June 16, 2012 man use root addEventHandler("onPickupHit", root, gettehmessage) and source local pickupmessage = getElementData( source, "Message" ) Link to comment
micheal1230 Posted June 16, 2012 Author Share Posted June 16, 2012 man use root addEventHandler("onPickupHit", root, gettehmessage) and source local pickupmessage = getElementData( source, "Message" ) Boolean Value @ pickupmessage And you gotta use the ..pickupmessage.. or you get outputChatBox Bad Arg. function gettehmessage(source) local pickupmessage = getElementData( source, "Message" ) outputChatBox(""..pickupmessage..".", source) end addEventHandler("onPickupHit", root, gettehmessage) Link to comment
TAPL Posted June 16, 2012 Share Posted June 16, 2012 function gettehmessage(player) local pickupmessage = getElementData( source, "Message" ) outputChatBox(pickupmessage, player) end addEventHandler("onPickupHit", root, gettehmessage) Link to comment
micheal1230 Posted June 16, 2012 Author Share Posted June 16, 2012 function gettehmessage(player) local pickupmessage = getElementData( source, "Message" ) outputChatBox(pickupmessage, player) end addEventHandler("onPickupHit", root, gettehmessage) bad Arg outputchatbox you need the ""..pickupmessage.."" And Thanks <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 Link to comment
TAPL Posted June 16, 2012 Share Posted June 16, 2012 function gettehmessage(player) local pickupmessage = getElementData( source, "Message" ) outputChatBox(pickupmessage, player) end addEventHandler("onPickupHit", root, gettehmessage) bad Arg outputchatbox you need the ""..pickupmessage.."" And Thanks <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 I'm insisting that it doesn't need to be like this ""..pickupmessage.."" Link to comment
micheal1230 Posted June 16, 2012 Author Share Posted June 16, 2012 function gettehmessage(player) local pickupmessage = getElementData( source, "Message" ) outputChatBox(pickupmessage, player) end addEventHandler("onPickupHit", root, gettehmessage) bad Arg outputchatbox you need the ""..pickupmessage.."" And Thanks <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 I'm insisting that it doesn't need to be like this ""..pickupmessage.."" well if its not you get bad arg for me 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