micheal1230 Posted June 13, 2012 Posted June 13, 2012 Well the markers load in from the mysql but i dont understand how to get the messages to load -- Infopoints Script By haws1290 For Use On Fort Carson Roleplay © -- Help From: -- Alpha -- Soildsnake14 -- blazy -- Draken mysql = exports.mysql local pInfo = createPickup ( -204.19921875, 1116.7587890625, 19.7421875, 3, 1239 ); -- create marker addEventHandler ( "onResourceStart", resourceRoot, function ( ) addEventHandler ( "onPickupHit", pInfo, fnShow ); -- add handler of event 'onPickupHit' to fn 'fnShow' addCommandHandler ( "createinfo", fnCreateInfo ); -- add command 'createinfo' to fn 'fnCreateInfo' end ) function fnShow ( pPlayer ) outputChatBox ( "Welcome to Fort Carson Roleplay Server!", pPlayer ); -- output on chat some text outputChatBox ( "Our Forums Address Is mtafcrp.freeforums.org", pPlayer ); cancelEvent(); end function fnCreateInfo ( pPlayer, chCommand, ... ) if ( ... ) then if ( exports['global']:isPlayerAdmin ( pPlayer ) ) then local nX, nY, nZ = getElementPosition ( pPlayer ); local chText = table.concat ( { ... }, " " ); pInfoPickup = createPickup ( nX, nY, nZ, 3, 1239, 0.1 ); setElementData ( pInfoPickup, "Message", chText ); setElementData ( pInfoPickup, "PosX", nX ); setElementData ( pInfoPickup, "PosY", nY ); setElementData ( pInfoPickup, "PosZ", nZ ); addEventHandler ( "onPickupHit", pInfoPickup, infohit ); local id = mysql:query_insert_free ( "INSERT INTO infopoints SET posx='" .. mysql:escape_string(nX) .. "', posy='" .. mysql:escape_string(nY) .. "', posz='" .. mysql:escape_string(nZ) .. "', message='" .. mysql:escape_string(chText) .. "'" ); exports['anticheat-system']:changeProtectedElementDataEx(pInfoPickup, "dbid", id, false) outputChatBox("You Have Created A Infopoint With The ID ".. id ..".",pPlayer, 255, 194, 14) --fnSaveInfo(); end else outputChatBox ( "SYNTAX: /" .. chCommand .. " [iNFO]", pPlayer, 255, 194, 14 ); end end --[[function fnSaveInfo ( ) local message = getElementData ( pInfoPickup, "Message" ); local posx = getElementData ( pInfoPickup, "PosX" ); local posy = getElementData ( pInfoPickup, "PosY" ); local posz = getElementData ( pInfoPickup, "PosZ" ); end]] --[[function infohit(thePlayer) local message = getElementData( pInfoPickup,"Message") outputChatBox("" .. message .."",thePlayer) end]] mysql = exports.mysql --[[function createInfoPoints( ) local result = mysql:mysql_query(host,"SELECT * FROM infopoints") if #result ~= 0 then for index, pInfoPickup in ipairs(result ) do fnCreateInfo(pInfoPickup ["posx"], pInfoPickup ["posy"], pInfoPickup["posz"], pInfoPickup["message"]) end end end addEventHandler("onResourceStart",resourceRoot, createInfoPoints)]] function loadAllInfopoints(res) -- Load current ones local result = mysql:query("SELECT * FROM infopoints") local count = 0 local highest = 0 if (result) then local run = true while run do local row = exports.mysql:fetch_assoc(result) if not (row) then break end local id = tonumber(row["id"]) local x = tonumber(row["posx"]) local y = tonumber(row["posy"]) local z = tonumber(row["posz"]) local infomessage = (row["message"]) local pickup = createPickup( x, y, z, 3, 1239, 0.1) exports.pool:allocateElement(pickup) exports['anticheat-system']:changeProtectedElementDataEx(pickup, "dbid", id, false) outputChatBox("".. infomessage .."", 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(result) end addEventHandler("onResourceStart", getResourceRootElement(), loadAllInfopoints)
Castillo Posted June 13, 2012 Posted June 13, 2012 -- Infopoints Script By haws1290 For Use On Fort Carson Roleplay © -- Help From: -- Alpha -- Soildsnake14 -- blazy -- Draken mysql = exports.mysql local pInfo = createPickup ( -204.19921875, 1116.7587890625, 19.7421875, 3, 1239 ); -- create marker addEventHandler ( "onResourceStart", resourceRoot, function ( ) addEventHandler ( "onPickupHit", pInfo, fnShow ); -- add handler of event 'onPickupHit' to fn 'fnShow' addCommandHandler ( "createinfo", fnCreateInfo ); -- add command 'createinfo' to fn 'fnCreateInfo' end ) function fnShow ( pPlayer ) outputChatBox ( "Welcome to Fort Carson Roleplay Server!", pPlayer ); -- output on chat some text outputChatBox ( "Our Forums Address Is mtafcrp.freeforums.org", pPlayer ); cancelEvent(); end function fnCreateInfo ( pPlayer, chCommand, ... ) if ( ... ) then if ( exports['global']:isPlayerAdmin ( pPlayer ) ) then local nX, nY, nZ = getElementPosition ( pPlayer ); local chText = table.concat ( { ... }, " " ); pInfoPickup = createPickup ( nX, nY, nZ, 3, 1239, 0.1 ); setElementData ( pInfoPickup, "Message", chText ); setElementData ( pInfoPickup, "PosX", nX ); setElementData ( pInfoPickup, "PosY", nY ); setElementData ( pInfoPickup, "PosZ", nZ ); addEventHandler ( "onPickupHit", pInfoPickup, infohit ); local id = mysql:query_insert_free ( "INSERT INTO infopoints SET posx='" .. mysql:escape_string(nX) .. "', posy='" .. mysql:escape_string(nY) .. "', posz='" .. mysql:escape_string(nZ) .. "', message='" .. mysql:escape_string(chText) .. "'" ); exports['anticheat-system']:changeProtectedElementDataEx(pInfoPickup, "dbid", id, false) outputChatBox("You Have Created A Infopoint With The ID ".. id ..".",pPlayer, 255, 194, 14) --fnSaveInfo(); end else outputChatBox ( "SYNTAX: /" .. chCommand .. " [iNFO]", pPlayer, 255, 194, 14 ); end end --[[function fnSaveInfo ( ) local message = getElementData ( pInfoPickup, "Message" ); local posx = getElementData ( pInfoPickup, "PosX" ); local posy = getElementData ( pInfoPickup, "PosY" ); local posz = getElementData ( pInfoPickup, "PosZ" ); end]] --[[function infohit(thePlayer) local message = getElementData( pInfoPickup,"Message") outputChatBox("" .. message .."",thePlayer) end]] mysql = exports.mysql --[[function createInfoPoints( ) local result = mysql:mysql_query(host,"SELECT * FROM infopoints") if #result ~= 0 then for index, pInfoPickup in ipairs(result ) do fnCreateInfo(pInfoPickup ["posx"], pInfoPickup ["posy"], pInfoPickup["posz"], pInfoPickup["message"]) end end end addEventHandler("onResourceStart",resourceRoot, createInfoPoints)]] function loadAllInfopoints(res) -- Load current ones local result = mysql:query("SELECT * FROM infopoints") local count = 0 local highest = 0 if (result) then local run = true while run do local row = exports.mysql:fetch_assoc(result) if not (row) then break end local id = tonumber(row["id"]) local x = tonumber(row["posx"]) local y = tonumber(row["posy"]) local z = tonumber(row["posz"]) local infomessage = row["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) outputChatBox("".. infomessage .."", 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(result) end addEventHandler("onResourceStart", getResourceRootElement(), loadAllInfopoints)
micheal1230 Posted June 13, 2012 Author Posted June 13, 2012 -- Infopoints Script By haws1290 For Use On Fort Carson Roleplay © -- Help From: -- Alpha -- Soildsnake14 -- blazy -- Draken mysql = exports.mysql local pInfo = createPickup ( -204.19921875, 1116.7587890625, 19.7421875, 3, 1239 ); -- create marker addEventHandler ( "onResourceStart", resourceRoot, function ( ) addEventHandler ( "onPickupHit", pInfo, fnShow ); -- add handler of event 'onPickupHit' to fn 'fnShow' addCommandHandler ( "createinfo", fnCreateInfo ); -- add command 'createinfo' to fn 'fnCreateInfo' end ) function fnShow ( pPlayer ) outputChatBox ( "Welcome to Fort Carson Roleplay Server!", pPlayer ); -- output on chat some text outputChatBox ( "Our Forums Address Is mtafcrp.freeforums.org", pPlayer ); cancelEvent(); end function fnCreateInfo ( pPlayer, chCommand, ... ) if ( ... ) then if ( exports['global']:isPlayerAdmin ( pPlayer ) ) then local nX, nY, nZ = getElementPosition ( pPlayer ); local chText = table.concat ( { ... }, " " ); pInfoPickup = createPickup ( nX, nY, nZ, 3, 1239, 0.1 ); setElementData ( pInfoPickup, "Message", chText ); setElementData ( pInfoPickup, "PosX", nX ); setElementData ( pInfoPickup, "PosY", nY ); setElementData ( pInfoPickup, "PosZ", nZ ); addEventHandler ( "onPickupHit", pInfoPickup, infohit ); local id = mysql:query_insert_free ( "INSERT INTO infopoints SET posx='" .. mysql:escape_string(nX) .. "', posy='" .. mysql:escape_string(nY) .. "', posz='" .. mysql:escape_string(nZ) .. "', message='" .. mysql:escape_string(chText) .. "'" ); exports['anticheat-system']:changeProtectedElementDataEx(pInfoPickup, "dbid", id, false) outputChatBox("You Have Created A Infopoint With The ID ".. id ..".",pPlayer, 255, 194, 14) --fnSaveInfo(); end else outputChatBox ( "SYNTAX: /" .. chCommand .. " [iNFO]", pPlayer, 255, 194, 14 ); end end --[[function fnSaveInfo ( ) local message = getElementData ( pInfoPickup, "Message" ); local posx = getElementData ( pInfoPickup, "PosX" ); local posy = getElementData ( pInfoPickup, "PosY" ); local posz = getElementData ( pInfoPickup, "PosZ" ); end]] --[[function infohit(thePlayer) local message = getElementData( pInfoPickup,"Message") outputChatBox("" .. message .."",thePlayer) end]] mysql = exports.mysql --[[function createInfoPoints( ) local result = mysql:mysql_query(host,"SELECT * FROM infopoints") if #result ~= 0 then for index, pInfoPickup in ipairs(result ) do fnCreateInfo(pInfoPickup ["posx"], pInfoPickup ["posy"], pInfoPickup["posz"], pInfoPickup["message"]) end end end addEventHandler("onResourceStart",resourceRoot, createInfoPoints)]] function loadAllInfopoints(res) -- Load current ones local result = mysql:query("SELECT * FROM infopoints") local count = 0 local highest = 0 if (result) then local run = true while run do local row = exports.mysql:fetch_assoc(result) if not (row) then break end local id = tonumber(row["id"]) local x = tonumber(row["posx"]) local y = tonumber(row["posy"]) local z = tonumber(row["posz"]) local infomessage = row["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) outputChatBox("".. infomessage .."", 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(result) end addEventHandler("onResourceStart", getResourceRootElement(), loadAllInfopoints) Does'nt load the message
TwiX! Posted June 13, 2012 Posted June 13, 2012 function fnCreateInfo ( pPlayer, chCommand, ... ) local Words = { ... } local chText = table.concat( Words, " " ) if chText then if ( exports['global']:isPlayerAdmin ( pPlayer ) ) then local nX, nY, nZ = getElementPosition ( pPlayer ); pInfoPickup = createPickup ( nX, nY, nZ, 3, 1239, 0.1 ); setElementData ( pInfoPickup, "Message", chText ); setElementData ( pInfoPickup, "PosX", nX ); setElementData ( pInfoPickup, "PosY", nY ); setElementData ( pInfoPickup, "PosZ", nZ ); addEventHandler ( "onPickupHit", pInfoPickup, infohit ); local id = mysql:query_insert_free ( "INSERT INTO infopoints SET posx='" .. mysql:escape_string(nX) .. "', posy='" .. mysql:escape_string(nY) .. "', posz='" .. mysql:escape_string(nZ) .. "', message='" .. mysql:escape_string(chText) .. "'" ); exports['anticheat-system']:changeProtectedElementDataEx(pInfoPickup, "dbid", id, false) outputChatBox("You Have Created A Infopoint With The ID ".. id ..".",pPlayer, 255, 194, 14) --fnSaveInfo(); end else outputChatBox ( "SYNTAX: /" .. chCommand .. " [iNFO]", pPlayer, 255, 194, 14 ); end end or what messages? /debugscript 3
micheal1230 Posted June 13, 2012 Author Posted June 13, 2012 function fnCreateInfo ( pPlayer, chCommand, ... ) local Words = { ... } local chText = table.concat( Words, " " ) if chText then if ( exports['global']:isPlayerAdmin ( pPlayer ) ) then local nX, nY, nZ = getElementPosition ( pPlayer ); pInfoPickup = createPickup ( nX, nY, nZ, 3, 1239, 0.1 ); setElementData ( pInfoPickup, "Message", chText ); setElementData ( pInfoPickup, "PosX", nX ); setElementData ( pInfoPickup, "PosY", nY ); setElementData ( pInfoPickup, "PosZ", nZ ); addEventHandler ( "onPickupHit", pInfoPickup, infohit ); local id = mysql:query_insert_free ( "INSERT INTO infopoints SET posx='" .. mysql:escape_string(nX) .. "', posy='" .. mysql:escape_string(nY) .. "', posz='" .. mysql:escape_string(nZ) .. "', message='" .. mysql:escape_string(chText) .. "'" ); exports['anticheat-system']:changeProtectedElementDataEx(pInfoPickup, "dbid", id, false) outputChatBox("You Have Created A Infopoint With The ID ".. id ..".",pPlayer, 255, 194, 14) --fnSaveInfo(); end else outputChatBox ( "SYNTAX: /" .. chCommand .. " [iNFO]", pPlayer, 255, 194, 14 ); end end or what messages? /debugscript 3 No Errors And I Made Edits But the message still doesnt show the message -- Infopoints Script By haws1290 For Use On Fort Carson Roleplay © -- Help From: -- Alpha -- Soildsnake14 -- blazy -- Draken mysql = exports.mysql local pInfo = createPickup ( -204.19921875, 1116.7587890625, 19.7421875, 3, 1239 ); -- create marker addEventHandler ( "onResourceStart", resourceRoot, function ( ) addEventHandler ( "onPickupHit", pInfo, fnShow ); -- add handler of event 'onPickupHit' to fn 'fnShow' addCommandHandler ( "createinfo", fnCreateInfo ); -- add command 'createinfo' to fn 'fnCreateInfo' end ) function fnShow ( pPlayer ) outputChatBox ( "Welcome to Fort Carson Roleplay Server!", pPlayer ); -- output on chat some text outputChatBox ( "Our Forums Address Is mtafcrp.freeforums.org", pPlayer ); cancelEvent(); end function fnCreateInfo ( pPlayer, chCommand, ... ) if ( ... ) then if ( exports['global']:isPlayerAdmin ( pPlayer ) ) then local nX, nY, nZ = getElementPosition ( pPlayer ); local chText = table.concat ( { ... }, " " ); pInfoPickup = createPickup ( nX, nY, nZ, 3, 1239, 0.1 ); setElementData ( pInfoPickup, "Message", chText ); setElementData ( pInfoPickup, "PosX", nX ); setElementData ( pInfoPickup, "PosY", nY ); setElementData ( pInfoPickup, "PosZ", nZ ); --addEventHandler ( "onPickupHit", pInfoPickup, infohit ); local id = mysql:query_insert_free ( "INSERT INTO infopoints SET posx='" .. mysql:escape_string(nX) .. "', posy='" .. mysql:escape_string(nY) .. "', posz='" .. mysql:escape_string(nZ) .. "', message='" .. mysql:escape_string(chText) .. "'" ); exports['anticheat-system']:changeProtectedElementDataEx(pInfoPickup, "dbid", id, false) outputChatBox("You Have Created A Infopoint With The ID ".. id ..".",pPlayer, 255, 194, 14) --fnSaveInfo(); end else outputChatBox ( "SYNTAX: /" .. chCommand .. " [iNFO]", pPlayer, 255, 194, 14 ); end end --[[function fnSaveInfo ( ) local message = getElementData ( pInfoPickup, "Message" ); local posx = getElementData ( pInfoPickup, "PosX" ); local posy = getElementData ( pInfoPickup, "PosY" ); local posz = getElementData ( pInfoPickup, "PosZ" ); end]] --[[function infohit(thePlayer) local message = getElementData( pInfoPickup,"Message") outputChatBox("" .. message .."",thePlayer) end]] mysql = exports.mysql --[[function createInfoPoints( ) local result = mysql:mysql_query(host,"SELECT * FROM infopoints") if #result ~= 0 then for index, pInfoPickup in ipairs(result ) do fnCreateInfo(pInfoPickup ["posx"], pInfoPickup ["posy"], pInfoPickup["posz"], pInfoPickup["message"]) end end end addEventHandler("onResourceStart",resourceRoot, createInfoPoints)]] function loadAllInfopoints(res) -- Load current ones local result = mysql:query("SELECT * FROM infopoints") local count = 0 local highest = 0 if (result) then local run = true while run do local row = exports.mysql:fetch_assoc(result) if not (row) then break end local id = tonumber(row["id"]) local x = tonumber(row["posx"]) local y = tonumber(row["posy"]) local z = tonumber(row["posz"]) local infomessage = row["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(result) end addEventHandler("onResourceStart", getResourceRootElement(), loadAllInfopoints)
micheal1230 Posted June 14, 2012 Author Posted June 14, 2012 put the /debugscript 3im not psychic There is no errors
TwiX! Posted June 14, 2012 Posted June 14, 2012 put the /debugscript 3im not psychic There is no errors try to check all code with outputDebugString or outputChatBox
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