Jump to content

Vivalavido

Members
  • Posts

    40
  • Joined

  • Last visited

Everything posted by Vivalavido

  1. Okay the last few day's ive been notified in my server console about an error, basicly this one: [22:21:13] ERROR: ERROR: Infinite/too long execution (roam) [22:21:13] ERROR: Aborting; infinite running script roam is my freeroam resource, and ive noticed that once the last player leaves it gives me this error. What can it possibly be?
  2. Okay, I have done that now. It works perfectly! BUT: Only server sided it loops because look: --SERVER: local getSiteInfoDatabase = mysql_query( connect_mysql, "SELECT * FROM `messages` WHERE `to`='" .. userName .. "' " ) if (getSiteInfoDatabase) then local numRows = mysql_num_rows(getSiteInfoDatabase) if (numRows >= 1) then while true do local row = mysql_fetch_assoc(getSiteInfoDatabase) if (not row) then break end outputChatBox(row['title']) subject = row['title'] end else return nil end end Now what I do is make a var off the row['title] in subject. triggerClientEvent( theUser, "openTheUserPanel", getRootElement(), loginName, class, serial, skin, countMessage, unReadMessage, subject ) Im sending that too my clientsided GUI! GUI: pmList = guiCreateGridList ( 0.03, 0.21, 0.93, 0.24, true, mainWindowUserPM ) pmColumn1 = guiGridListAddColumn( pmList, "Subject", 0.31 ) pmColumn2 = guiGridListAddColumn( pmList, "From", 0.31 ) pmColumn3 = guiGridListAddColumn( pmList, "Date", 0.31 ) pmRow = guiGridListAddRow( pmList ) guiGridListSetItemText( pmList, pmRow, pmColumn1, subject, false, false ) Still, it only displays one item in the gridlist whilst I have more items to be dsiplayed!
  3. "bad argument #1 to 'ipairs' (table expected, got nil) Doesnt it mean the table is empty? ( Because it isnt.. )
  4. So, I actually have to make a table first like: local table = {} Then I go further with: local getSiteInfoDatabase = mysql_query( connect_mysql, "SELECT * FROM `messages` WHERE `to`='"..userName.."' " ) theReciever = mysql_fetch_assoc( getSiteInfoDatabase )l subject = theReciever['title'] for theReciever,subject in ipairs(table) do outputChatBox( subject ) end I dont understand wich var's are necceserly at the for statement. Im not realy expierenced with loops
  5. Hello, I have a question bout making a loop in LUA, im expierenced in it with PHP, but not with LUA. Heres how its done in PHP: while($row = mysql_fetch_array( $result )) { echo $row[subject]; echo "<br />"; } But how am I suposed to do this in LUA? I came this far: local getSiteInfoDatabase = mysql_query( connect_mysql, "SELECT * FROM `messages` WHERE `to`='"..userName.."' " ) theReciever = mysql_fetch_assoc( getSiteInfoDatabase ) local subject = theReciever['title'] So I want to get all the data from theReciever[title], so I need a loop, but how?
  6. At least he is being honest. To my vision, xbost's script should work just fine. True, but saying your lazy and not even have the intention to learn LUA, is just wrong imo than asking others to do it for you.
  7. I think this is the newer way to get scripts written for themselfs, just say "Sorry" and "Im lazy" alot
  8. function OnPlayerChat(message, messageType) cancelEvent() outputChatBox("[Player] ".. getPlayerName(source) .. " : " .. message) end
  9. Are you switching subject suddenly? MySQL is little different. SQLite is easier. SQLite doesnt always have to be easier. Some people take up things mentally diffrent than others do.
  10. https://wiki.multitheftauto.com/wiki/Modules/MTA-MySQL
  11. Have you just been busy with PHP maybe? Since you use the ";" tags at the end haha.
  12. Have you just been busy with PHP maybe? Since you use the ";" tags at the end haha.
  13. Change: if element == "player" then local player = getPlayerName(element) local level = getPlayerWantedLevel(element) To: if element == "player" then local player = getPlayerName(Spieler) local level = getPlayerWantedLevel(Spieler) Your getting an bad argument because your trying to get things from "element" Wich isnt a variable.
  14. I was wondering, I made a GUI, wich has an Gridlist. Now I also have a database ,wich hold some members.. How would I load in the database stuff in a client sided script? Is there something like callServer? Cause I think triggerServerEvent would be going back and forth.. Like I triggerServerEvent in cleinside, then I triggerClientEvent back.. That would be a drag.. Any other solutions? Thanks!
  15. Well I have never done tables. But I supose, doing it that way, would be best? Any suggestions?
  16. Alright, I have created an usersystem wich works with MySql. Now im having problems with adding a tag to a user as in: [ADMIN] User Script: function onJoin() if( not connect_mysql ) then outputChatBox( "Could not connect to MySQL server [sqlnames]" ) else colour = mysql_query( connect_mysql, "SELECT class FROM clanusers WHERE serial='" .. getPlayerSerial( source ) .. "'" ) if( colour ) then while true do local row = mysql_fetch_assoc(colour) if (not row) then break end if( row['name'] == "") then name = getPlayerName( source ) class = "Guest" else name = row['name'] class = row['class'] end end end mysql_free_result( colour ) end end function onChat( message ) cancelEvent() if( class == "Admin" ) then outputChatBox("#FF0000[Admin] " .. getPlayerName(source) .. ': ' .. "#FFFFFF" .. message:gsub('#%x%x%x%x%x%x', ''), getRootElement(), 0, 0, 0, true) elseif ( class == "Member" ) then outputChatBox("#7FFF00[MP] " .. getPlayerName(source) .. ': ' .. "#FFFFFF" .. message:gsub('#%x%x%x%x%x%x', ''), getRootElement(), 0, 0, 0, true) elseif( class == "Mod" ) then outputChatBox("#246119[Mod] " .. getPlayerName(source) .. ': ' .. "#FFFFFF" .. message:gsub('#%x%x%x%x%x%x', ''), getRootElement(), 0, 0, 0, true) elseif( class == "Mapper" ) then outputChatBox("#000000[Mapper] " .. getPlayerName(source) .. ': ' .. "#FFFFFF" .. message:gsub('#%x%x%x%x%x%x', ''), getRootElement(), 0, 0, 0, true) elseif( class == "Guest" ) then outputChatBox("#F96B09[Mod] " .. getPlayerName (source) .. ': ' .. "#FFFFFF" .. message:gsub('#%x%x%x%x%x%x', ''), getRootElement(), 0, 0, 0, true) end end addEventHandler ( "onPlayerJoin", getRootElement(), onJoin) addEventHandler ( "onPlayerChat", getRootElement(), onChat ) It adds the tags, like a charm! Problem is, im stated as Admin in the database. So it adds a [ADMIN] tag infront of my name.. That works fine.. Once another user joins, with the class Member, it adds the [MP] tags for everyone! What would be best to make the function call only for the player that joines?
  17. yourMarker = createMarker ( 1174, -1319, 16, "cylinder", 1, 0, 0, 255, 200 ) function YourFunction ( ) outputChatBox("Yay it works!") end addEventHandler("onMarkerHit", yourMarker, YourFunction, false) Basicly: Your addEventHandler doesnt make any sence at all.
  18. Looks like The Day After Tommorow, lol.
  19. Yea okay, it works perfeclty now. Theres another problem. I was writing in 1 table, but im trying to write multiple this time. I keep getting errors: Code: insert_the_app = mysql_query(con_my_sql, "INSERT INTO applications ( User, IGN) VALUES ( '" ..tostring(name) .. "' ), ( '" ..tostring(ign).. "')") Error: INFO: Error executing the query: (1136) Column count doesn't match value count at row 1 ERROR: ...mods/deathmatch/resources/DKRJoinform/server/xml.lua:34: bad argument #1 to 'mysql_free_result' (LuaBook.mysqlResult expected, got nil)
  20. It writes the first time --> Doesnt the second time. Error: ERROR: ...mods/deathmatch/resources/DKRJoinform/server/xml.lua:23: bad argument #1 to 'mysql_query' (Expected a valid MySQL link) Line 23: insert_the_app = mysql_query(con_my_sql, "INSERT INTO applications ( User) VALUES ( '" ..tostring(text) .. "' ) ")
  21. Well.. Im not using the ID table yet though. SQL Now: CREATE TABLE `applications` ( `ID` int(10) NOT NULL auto_increment, `User` text NOT NULL, `IGN` text NOT NULL, `Email` text NOT NULL, `Country` text NOT NULL, `IP` text NOT NULL, PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ; EDIT: If I restart resource, and execute, it writes! BUT! When I do it instantly after it, I get the error under here: ERROR: ...mods/deathmatch/resources/DKRJoinform/server/xml.lua:16: bad argument #1 to 'mysql_select_db' (Expected a valid MySQL link) EDIT 2: Okay uhm. It works all times now. Code: local con_my_sql = mysql_connect("meh") local select_the_applications_database = mysql_select_db (con_my_sql, "DKRApplication") local select_the_applications_table = mysql_query(con_my_sql, "SELECT User, IGN, Email, Country, IP FROM applications ") function loadDatabaseAndMakeItWriteAble(text, text2, text3, country, thePlayer) if ( not select_the_applications_database ) then outputChatBox("The database is unreachable, im sorry.") else outputChatBox("I connected to your database!") local insert_the_app = mysql_query(con_my_sql, "INSERT INTO applications ( User) VALUES ( '" ..tostring(text) .. "' ) ") if ( not insert_the_app ) then outputChatBox("I couldnt set the details..") outputDebugString("Error executing the query: (" .. mysql_errno(con_my_sql) .. ") " .. mysql_error(con_my_sql)) else outputChatBox("Your SQL should be written!") end end mysql_free_result(select_the_applications_table) -- Freeing the result is IMPORTANT mysql_free_result(insert_the_app) -- Freeing the result is IMPORTANT mysql_close(con_my_sql) end end Basicly, I added local infront off almost everything, the ERROR I get now: ERROR: ...mods/deathmatch/resources/DKRJoinform/server/xml.lua:31: bad argument #1 to 'mysql_free_result' (LuaBook.mysqlResult expected, got nil) Confused as shit atm.
  22. The table: CREATE TABLE `applications` ( `ID` varchar(10) NOT NULL, `User` text NOT NULL, `IGN` text NOT NULL, `Email` text NOT NULL, `Country` text NOT NULL, `IP` text NOT NULL, PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  23. Hello everyone! Got a nice lil script together here.. With some errors with it where I cant seem to get ahold off.. local con_my_sql = mysql_connect("meh") function loadDatabaseAndMakeItWriteAble(text) select_the_applications_database = mysql_select_db (con_my_sql, "DKRApplication") select_the_applications_table = mysql_query(con_my_sql, "SELECT User, IGN, Email, Country, IP FROM applications ") if ( not select_the_applications_database ) then outputChatBox("The database is unreachable, im sorry.") else outputChatBox("I connected to your database!") insert_the_app = mysql_query(con_my_sql, "INSERT INTO applications ( User) VALUES ( '" ..tostring(text) .. "' ) ") mysql_close(con_my_sql) if ( not insert_the_app ) then outputChatBox("I couldnt set the details..") outputDebugString("Error executing the query: (" .. mysql_errno(con_my_sql) .. ") " .. mysql_error(con_my_sql)) else outputChatBox("Your SQL should be written!") end end mysql_free_result(select_the_applications_table) -- Freeing the result is IMPORTANT mysql_free_result(insert_the_app) -- Freeing the result is IMPORTANT end end Thats the code, and I get these errors: INFO: Error executing the query: (1062) Duplicate entry '' for key 1 <--- Coming from: outputDebugString("Error executing the query: (" .. mysql_errno(con_my_sql) .. ") " .. mysql_error(con_my_sql)) And: ERROR: ...mods/deathmatch/resources/DKRJoinform/server/xml.lua:33: bad argument #1 to 'mysql_free_result' (LuaBook.mysqlResult expected, got nil)
×
×
  • Create New...