Jump to content


  • Posts

  • Joined

  • Last visited

About KingMofo

  • Birthday 04/10/1990


  • Gang
    Grove Street

KingMofo's Achievements


Civilian (7/54)



  1. KingMofo


    MySQL is server-side.
  2. You are a life saver! Thank you, it worked!
  3. Hello all. I have a little problem. I have just made a custom chat system for my server members/moderators/administrators. It's all working fine except the binds. When i try to bind the key "i" from the script like this... bindKey(source, "i", "down", "chatbox member") When it is done from the script, it won't put the chatbox active when you press that button. However, if i bind the same key to the same command while in-game, it works. Could anyone explain why this is or a way to get around it? I want to do this as it will be annoying telling all of my members/staff to bind the i key for member/staff chat. Thanks in advanced!
  4. KingMofo

    sql save

    It still works regardless if it's outdated.
  5. KingMofo

    sql save

    Instead of giveWeapon(source, result, tonumber(result2) Try giveWeapon(source, result[1]['slot'], result2[1]['ammo'])
  6. Oh wow! I just tried that and it worked! Thank you all for your help and thank you AdiBoy.
  7. Oh wow, i just read that page about transferring it to another table and it sounds not a bad idea. I will try it out and let you know how it goes. Cheers you 2.
  8. Hello all. I use SQL quite a lot. When i am updating a table, sometimes i want to insert a new column into an existing table but the only way i can seem to do that is if i drop the table and re-create the table with the added column which results in all the data in the table being lost. I was wondering if anyone knows how to add a column to the table without having to drop it and re-create it? An example: Here's my current table columns How would i add an extra column called "Account" without dropping and re-creating? I would really appreciate any help on this. Thanks in advanced.
  9. This is what i was looking for. Now looking at it, i see what you all mean. It would be easier just to turn it back into a normal function but i have been curious for awhile now if it can be done or not. Thanks all, you satisfied my curiosity.
  10. Now, i missed the 3rd argument on purpose as how can i put that 3rd argument when there is no function name?
  11. Hello all. I have a question that i have been meaning to ask for awhile now. I prefer to use anonymous functions and when i try to do 2 eventhandlers, it errors. For example: addEvent("playerNotChatting", true) addEventHandler("playerNotChatting", root) addEventHandler("onPlayerQuit", root, function() triggerClientEvent("updateChatList", root, source, false) end ) If i do just addEvent and addEventHandler, it will work but when i try to do 2 event handlers inside a anonymous function, it never works. So my question is, can you use more than 1 command/event handler inside a anonymous function? if yes, would you be kind enough to tell me how? Thanks in advanced.
  12. local playerstbl = "skin" function start () executeSQLCreateTable(playerstbl, "accountname TEXT, skin INT") outputDebugString ("Resource loaded.", 3) end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), start) function login1(prev, account, autologin) local result = executeSQLQuery("SELECT skin FROM skin WHERE accountname='" .. getAccountName(account) .. "'") if result and #result > 0 then for k, v in ipairs(result) do setElementModel(source, v.skin) end else outputDebugString(tostring(executeSQLInsert(playerstbl, "'0', '"..getAccountName(account).."'", "skin, accountname"))) end end addEventHandler("onPlayerLogin", getRootElement(), login1) function onPlayerQuit() local acc = getPlayerAccount(source) if not isGuestAccount(acc) then outputDebugString(tostring(executeSQLUpdate(playerstbl, "skin = '"..getElementModel(source).."'", "accountname = '"..getAccountName(acc).."'"))) end end addEventHandler("onPlayerQuit", getRootElement(), onPlayerQuit) Try that.
  13. I'm so chuffed to see this back. This helped me so much when i started out. Thank you for bringing it back robhol!
  14. If you have trouble with setting up MySQL, you could always use SQLite as an alternative. It's already built into MTA server and it easy to manage with sqlitebrowser (https://community.multitheftauto.com/index.html?p ... ils&id=495).
  • Create New...