Jump to content

KingMofo

Members
  • Posts

    24
  • Joined

  • Last visited

Everything posted by KingMofo

  1. KingMofo

    MySQL

    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).
  15. Right.. I've been fiddling around and came up with this for you. addEventHandler ("onPlayerQuit", root, function() local gpa = getPlayerAccount(source) if (gpa == false) then return end for i=0, 17 do local textur, model = getPedClothes (source, i) setAccountData(gpa, "s.s-texture" .. i, textur) setAccountData(gpa, "s.s-model" .. i, model) end end ) addEventHandler("onPlayerLogin", root, function(prev, curr) for i=0, 17 do local textur = getAccountData(curr, "s.s-texture" .. i) local mode = getAccountData(curr, "s.s-model" .. i) if (textur == nil or mode == nil) then break end addPedClothes(source, textur, mode, i) end end ) It seems to work ok. Probably isn't the best way (i assume) but hey, it works! Please try and learn from it. Edit: Forgot to say, if you have any problems with this, post here so i can help.
  16. Thanks xbost for the link but i had a go with the stuff they provided and wasn't working (probably me). Thanks robhol, it works perfectly. Thanks for all your help!
  17. Okay, now i have a problem. Now that i am using an ID system and the default system (Names), i get an error when using a name and not a number. For example, eject KingMofo - it would return an error on the ID system like this... ERROR: ...eathmatch/resources/scoreboard/dxscoreboard_http:lua:110: kingmofo is not a number, please enter a number ERROR: call: failed to call 'scoreboard:getPlayerFromID' What i need help with is how i would i go about checking if the syntax entered is letters or numbers and then i could prevent the error (Right?). I been trying to look through the math. stuff and string. stuff but i have no idea which one would be used to do such a thing. I hope someone can help me, i would appreciate it.
  18. Success! The ID system is working flawlessly thanks to Jumba'. Thanks for all your help, it is appreciated.
  19. Thank you all three of you! You don't know how much i appreciate you giving me your script Jumba, it means alot to me as it saves alot of hassle for the future. I will report back here to let you all know how it goes.
  20. Hello, I have something that needs done but i dunno how to even go about it or what it would be called. I have an eject script on my server for mods/admins (/eject player) but when it comes to ejecting a player with long and unuseal names, it can become a pain. I have come across other servers which are able to do it with typing just some of the characters of the player and it will relate to that player. Example. eject ThisIsConfusing I could do: eject thisis I hope i have explained it well enough. I dunno what something like this would be classed as. I would really appreciate it if someone could help me. Thanks.
  21. Thank you manuelhimmler, that worked flawlessly! You don't know how much time i've spent trying to get it right, so i am very grateful. Thank you for that link robhol, i have already visited that a few times and found it extremely helpful, thank you.
  22. Thank you 50p, this really did get me started. I already have a bit of knowledge with LUA. I managed to auto destroy vehicles when someone has left the vehicle for 30seconds via setTimer. I'm having a big problem though. If the player leaves the vehicle, then decides to re-enter the vehicle, it still destroys it. Also, if someone exits the vehicle as a passenger, it destroys the drivers vehicle. I have tried using getPedOccupiedVehicleSeat but that doesn't seem to work. Here is the code i'm using. Client: function onVehExit () local localPlayer = getLocalPlayer() local vehCheck = isPedInVehicle (localPlayer) local theVehicle = getPedOccupiedVehicle (vehCheck) if theVehicle == source then return else triggerServerEvent ("vehExit", source) end end addEventHandler ("onClientVehicleStartExit", getRootElement(), onVehExit) addEventHandler ("onClientVehicleStartEnter", getRootElement(), onVehExit) Server: function leftOverVehicles() local theSeat = getPedOccupiedVehicleSeat (source) if theSeat == 0 then setTimer (destroyElement, 30000, 1, source) else end end addEvent ("vehExit", true) addEventHandler ("vehExit", getRootElement(), leftOverVehicles) Maybe someone can point out if i'm doing something wrong? P.S - Sorry for replying so late, 50p.
  23. Hello, I am trying to find a function to use for automatically destroying the unoccupied vehicles left by the player. I'm not really sure of a way to go about doing this. Could someone give me some advice or maybe an example? I'd really appreciate it. Also, how would i add a space in a commandhandler? For example: addCommandHandler ("do now", blah, blah) So now i go to console and try "do now" but it doesn't work. I've tried doing _ as a space but that doesn't work either. If anyone can help me on this i'd be so happy!
×
×
  • Create New...