micheal1230 Posted June 4, 2012 Share Posted June 4, 2012 How do you load a table from MYSQL NOT SQLITE Link to comment
Castillo Posted June 5, 2012 Share Posted June 5, 2012 How do you mean by "load a table"? Link to comment
micheal1230 Posted June 5, 2012 Author Share Posted June 5, 2012 How do you mean by "load a table"? Like for example you have seen my infopoints script? Right? But When The Resource Gets Restarted The Infopoint Blips Dont Load In From The MYSQL Database Off Topic: Also In The MYSQL Database It Only Saves the X Postition And It Doesnt Save The Y Or Z Position mysql = exports.mysql local pInfo = createPickup ( -206.5537109375, 1132.1015625, 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 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, "Pos", nX .. nY .. nZ ); addEventHandler ( "onPickupHit", pInfoPickup, infohit ); fnSaveInfo(); end else outputChatBox ( "SYNTAX: /" .. chCommand .. " [iNFO]", pPlayer, 255, 194, 14 ); end end function fnSaveInfo ( ) local message = getElementData ( pInfoPickup, "Message" ); local position = getElementData ( pInfoPickup, "Pos" ); exports['mysql']:query_free ( "INSERT INTO `infopoints` ( pos, message ) VALUES ( '" .. exports.mysql:escape_string(position) .. "', '" .. exports.mysql:escape_string(message) .. "' )" ); end function infohit(thePlayer) local message = getElementData( infopointpickup,"Message") outputChatBox("" .. message .."",thePlayer) end Link to comment
Cyandie Posted June 5, 2012 Share Posted June 5, 2012 Instead of exports['mysql']: you should use exports.mysql: if it's got any such dot or - line in you should use [''] if not use exports.(resourcename). Link to comment
Alpha Posted June 5, 2012 Share Posted June 5, 2012 exports["resourceName"]:function(...) or exports.resourceName:function(...) Doesn't make any difference. Link to comment
micheal1230 Posted June 5, 2012 Author Share Posted June 5, 2012 Could Someone Just tell me how to load stuff and why it doesnt save the x y and z? Link to comment
micheal1230 Posted June 5, 2012 Author Share Posted June 5, 2012 Instead of exports['mysql']: you should use exports.mysql: if it's got any such dot or - line in you should use [''] if not use exports.(resourcename). This is nothing to do with how to load tables Link to comment
Cyandie Posted June 5, 2012 Share Posted June 5, 2012 exports["resourceName"]:function(...) or exports.resourceName:function(...) Doesn't make any difference. You can't do such astuff as exports.test-system:function(....) can you now Link to comment
Alpha Posted June 5, 2012 Share Posted June 5, 2012 Ah, no you can't, didn't know you mean that, misunderstood. 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