micheal1230 Posted June 3, 2012 Share Posted June 3, 2012 Well I Made This Info Marker Script So When You Enter The Pickup It Tells You What Message Has Been Put Into The Pickup But It Doesnt Work And I Get Bad Argument @ createPickup Line 20 When i do /createinfo Hi But When I Do /createinfo It makes the pickup but no text infopoint = createPickup(-206.5537109375, 1132.1015625, 19.7421875, 3, 1239) -- ServerSide! function info (thePlayer) outputChatBox("Welcome To Fort Carson Roleplay Server",thePlayer) cancelEvent() end addEventHandler ( "onPickupHit", infopoint, info ) function createinfo(thePlayer, commandName, info) if (exports.global:isPlayerAdmin(thePlayer)) then if not (info) then outputChatBox("SYNTAX: /" .. commandName .. " [info]", thePlayer, 255, 194, 14) local x,y,z = getElementPosition(thePlayer) local infopointpickup = createPickup(x, y, z, 3, 1239) local message = table.concat({info}, " ") else createPickup(x, y, z, 3, 1239) end end end addCommandHandler("createinfo", createinfo) function infohit(thePlayer, info) local message = table.concat({info}, " ") outputChatBox("" .. message .."",thePlayer) cancelEvent() end addEventHandler("onPickupHit", getRootElement(), infohit) Link to comment
Wei Posted June 3, 2012 Share Posted June 3, 2012 (edited) did you think that you need to save text somewhere ? EDIT: and why are you canceling event onPickupHit ? Edited June 3, 2012 by Guest Link to comment
micheal1230 Posted June 3, 2012 Author Share Posted June 3, 2012 did you think that you need to save text somewhere ? Yes I did know i had to save it but i wasnt quite sure how Any Idea's? Link to comment
micheal1230 Posted June 3, 2012 Author Share Posted June 3, 2012 did you think that you need to save text somewhere ?EDIT: and why are you canceling event onPickupHit ? im trying to cancel the pickup from disappearing Link to comment
Wei Posted June 3, 2012 Share Posted June 3, 2012 infopoint = createPickup(-206.5537109375, 1132.1015625, 19.7421875, 3, 1239) -- ServerSide! function info (thePlayer) outputChatBox("Welcome To Fort Carson Roleplay Server",thePlayer) end addEventHandler ( "onPickupHit", infopoint, info ) function createinfo(thePlayer, commandName, info) if (exports.global:isPlayerAdmin(thePlayer)) then if not (info) then outputChatBox("SYNTAX: /" .. commandName .. " [info]", thePlayer, 255, 194, 14) local x,y,z = getElementPosition(thePlayer) local message = table.concat({info}, " ") infopointpickup = createPickup(x, y, z, 3, 1239, 0) setElementData( infopointpickup,"Message", message ) addEventHandler("onPickupHit", infopointpickup, infohit) else createPickup(x, y, z, 3, 1239) end end end addCommandHandler("createinfo", createinfo) function infohit(thePlayer) getElementData( infopointpickup,"Message") outputChatBox("" .. message .."",thePlayer) end something like that. I didn't test the code. it might have some bugs. Link to comment
micheal1230 Posted June 3, 2012 Author Share Posted June 3, 2012 (edited) infopoint = createPickup(-206.5537109375, 1132.1015625, 19.7421875, 3, 1239) -- ServerSide! function info (thePlayer) outputChatBox("Welcome To Fort Carson Roleplay Server",thePlayer) end addEventHandler ( "onPickupHit", infopoint, info ) function createinfo(thePlayer, commandName, info) if (exports.global:isPlayerAdmin(thePlayer)) then if not (info) then outputChatBox("SYNTAX: /" .. commandName .. " [info]", thePlayer, 255, 194, 14) local x,y,z = getElementPosition(thePlayer) local message = table.concat({info}, " ") infopointpickup = createPickup(x, y, z, 3, 1239, 0) setElementData( infopointpickup,"Message", message ) addEventHandler("onPickupHit", infopointpickup, infohit) else createPickup(x, y, z, 3, 1239) end end end addCommandHandler("createinfo", createinfo) function infohit(thePlayer) getElementData( infopointpickup,"Message") outputChatBox("" .. message .."",thePlayer) end something like that. I didn't test the code. it might have some bugs. Same Error As I Had Bad Argument Line 19 @ createPickup And The Pickup Doesnt Create, when you do /createinfo Hi but when you do /createinfo it makes the blip and you get unable to concatenate message a nil value because you havent set the message as i did /createinfo Thanks Edited June 3, 2012 by Guest Link to comment
Wei Posted June 3, 2012 Share Posted June 3, 2012 infopoint = createPickup(-206.5537109375, 1132.1015625, 19.7421875, 3, 1239) -- ServerSide! function info (thePlayer) outputChatBox("Welcome To Fort Carson Roleplay Server",thePlayer) end addEventHandler ( "onPickupHit", infopoint, info ) function createinfo(thePlayer, commandName, ...) if info then if (exports.global:isPlayerAdmin(thePlayer)) then local x,y,z = getElementPosition(thePlayer) local message = table.concat({...}, " ") infopointpickup = createPickup(x, y, z, 3, 1239, 1) setElementData( infopointpickup,"Message", message ) addEventHandler("onPickupHit", infopointpickup, infohit) end else outputChatBox("SYNTAX: /" .. commandName .. " [info]", thePlayer) end end addCommandHandler("createinfo", createinfo) function infohit(thePlayer) message = getElementData( infopointpickup,"Message") outputChatBox("" .. message .."",thePlayer) end Fixed and tested Link to comment
micheal1230 Posted June 3, 2012 Author Share Posted June 3, 2012 Thanks Now I Must Find A Way So All The Infopoints I Create Dont Say The Same Text i Guess That Would Be Saving The Text Right? Would It Be Possible To Do it In A XML Instead Of MYSQL Because Im not The Best At MySQL Scripting, Could I Do it With Functions Like fileCreate, fileOpen And fileWrite Link to comment
micheal1230 Posted June 3, 2012 Author Share Posted June 3, 2012 infopoint = createPickup(-206.5537109375, 1132.1015625, 19.7421875, 3, 1239) -- ServerSide! function info (thePlayer) outputChatBox("Welcome To Fort Carson Roleplay Server",thePlayer) end addEventHandler ( "onPickupHit", infopoint, info ) function createinfo(thePlayer, commandName, ...) if info then if (exports.global:isPlayerAdmin(thePlayer)) then local x,y,z = getElementPosition(thePlayer) local message = table.concat({...}, " ") infopointpickup = createPickup(x, y, z, 3, 1239, 1) setElementData( infopointpickup,"Message", message ) addEventHandler("onPickupHit", infopointpickup, infohit) end else outputChatBox("SYNTAX: /" .. commandName .. " [info]", thePlayer) end end addCommandHandler("createinfo", createinfo) function infohit(thePlayer) message = getElementData( infopointpickup,"Message") outputChatBox("" .. message .."",thePlayer) end Fixed and tested Would This Work? infopoint = createPickup(-206.5537109375, 1132.1015625, 19.7421875, 3, 1239) -- ServerSide! function info (thePlayer) outputChatBox("Welcome To Fort Carson Roleplay Server",thePlayer) cancelEvent() end addEventHandler ( "onPickupHit", infopoint, info ) function createinfo(thePlayer, commandName, ...) if info then if (exports.global:isPlayerAdmin(thePlayer)) then local x,y,z = getElementPosition(thePlayer) local message = table.concat({...}, " ") infopointpickup = createPickup(x, y, z, 3, 1239, 0.1) setElementData( infopointpickup,"Message", message ) addEventHandler("onPickupHit", infopointpickup, infohit) end else outputChatBox("SYNTAX: /" .. commandName .. " [info]", thePlayer) end end addCommandHandler("createinfo", createinfo) function infohit(thePlayer) message = getElementData( infopointpickup,"Message") outputChatBox("" .. message .."",thePlayer) end function saveinfo() message = getElementData( infopointpickup,"Message") local checksaveinfo = fileCreate("infopoints.xml") if checksaveinfo then fileWrite(checksaveinfo,"Pos=" .. x, y, z .. "Msg=" .. message ..) end end Link to comment
Guest Guest4401 Posted June 3, 2012 Share Posted June 3, 2012 There is a difference between XML functions and File functions Link to comment
micheal1230 Posted June 3, 2012 Author Share Posted June 3, 2012 There is a difference between XML functions and File functions Ok Link to comment
micheal1230 Posted June 3, 2012 Author Share Posted June 3, 2012 There is a difference between XML functions and File functions I Guess Ill Use MYSQL 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