1. Multi Theft Auto: San Andreas 1.x

    1. Support for MTA:SA 1.x

      HELP! HELP! Need help? Post here.
    2. User Guides

      These guides are a good place to start learning how to achieve certain things within MTA in an efficient and well mannered way.

    3. Open Source Contributors

      This space is for contributors to discuss the development of MTA. No user suggestions/support.

    4. Suggestions

      Suggestions and requests go here. Please note that actual feature requests must be filed on our GitHub.

    5. Ban appeals

      Use this forum to appeal your GLOBAL MTA:SA bans. Permanent bans only - appeals for timed ones (eg. 24 hours) will be refused.

      Do not use it for appealing server-specific bans as we do not have power over these specific servers.

  2. General MTA

    1. News

      News and updates on Multi Theft Auto.
    2. Media

      User-made screens and movies go here.

    3. Site/Forum/Discord/Mantis/Wiki related

      Share your comments & concerns about our services.

    4. MTA Chat

      MTA related chat that is NOT support related!
    5. 313,786
  3. MTA Community

    1. Scripting

      All Lua scripting topics related to Multi Theft Auto.

    2. Maps

      Discussions for maps on various gamemodes.
    3. Resources

      Everything else about resources.
    4. Other Creations & GTA modding

      This section includes things such as GUI themes, forum userbars, user-created MTA logos, etc. Also contains topics which cover general GTA modding areas that can be used in MTA, such as modelling.

    5. Competitive gameplay

      Discussions about various MTA-related competitive gameplay events. Also gang (clan) forums.
    6. Servers

      Looking for a server to play on? Looking for someone to host your server? Looking for a place to discuss with other server owners? Here's where to look.
  4. Other

    1. General

      Non-MTA discussions. Anything you want.
    2. Multi Theft Auto 0.5r2

      Discussion regarding Multi Theft Auto 0.5r2 for GTAIII and Vice City.
    3. Third party GTA mods

      Showcase for single player mods and requests.
  5. Archive

    1. 144,330
    2. Trash

      These posts have broken forum rules. They are stored here temporarily so offending users can see what they have done wrong.
  • Posts

    • Depending on what he wants string.gsub already should do the job.
    • Hi! I'm a beginner, so I don't really know what goes wrong in this scirpt, if someone can help me out here I would be very happy. So, as I said I'm a beginner and I tried to get an account system, I think I connected to the MySQL successfully. But here is the Problem! [Open the Spoiler to see the picture.]   I used Debugscript to know what is the problem . This was the original row. execute("UPDATE accounts SET x=?,y=?,z=?,interior=?,dimension=,health=?,armor=?,money=?,rotation=?,team=?,skin=?,weapons=? WHERE id=?",x,y,z,int,dim,health,armor,money,rotation,team,skin,weaponsStr,id) I tought the question mark was the problem, so I changed the money to '0' and I changed the life and the armor to '100' as well, by the way I'll insert here the edited row as well, so you can see what i did. execute("UPDATE accounts SET x=?,y=?,z=?,interior=?,dimension=?,health=100,armor=100,money=0,rotation=?,team=?,skin=?,weapons=? WHERE id=?",x,y,z,int,dim,health,armor,money,rotation,team,skin,weaponsStr,id) And here is the whole script, so you see more details. addEvent("onPlayerAttemptLogin",true) addEventHandler("onPlayerAttemptLogin",root, function(username,password) if (singleQuery("SELECT * FROM accounts WHERE username=? LIMIT 1",string.lower(username))) then local accData = singleQuery("SELECT * FROM accounts WHERE username=? AND password=? LIMIT 1",string.lower(username),sha256(password)) if (accData) then outputChatBox("Welcome back "..getPlayerName(source),source,0,255,0) setElementData(source,"accountID",accData.id) setElementData(source,"accountUsername",accData.username) fadeCamera(source,false,1.0,0,0,0) setTimer(fadeCamera,2000,1,source,true,1.0,0,0,0) setCameraTarget(source,source) showChat(source,true) showPlayerHudComponent(source,"radar",true) showPlayerHudComponent(source,"area_name",true) spawnPlayer(source,accData.x,accData.y,accData.z+1,accData.rotation,accData.skin,accData.interior,accData.dimension,accData.team) local weapons = fromJSON(accData.weapons) if (weapons) then for k,v in pairs(weapons) do giveWeapon(source,tonumber(k),tonumber(v)) end end if (accData.health == 0) then killPed(source) else setElementHealth(source,tonumber(accData.health)) end setPedArmor(source,tonumber(accData.armor)) setPlayerMoney(source,tonumber(accData.money)) setElementData(source,"isGuestAccount",false) triggerClientEvent(source,"closeLoginWindow",source) triggerEvent("onAccountPlayerLogin",source,accData.id,accData.username) log(source) --store the login data. else outputChatBox("Your username and/or password is incorrect!",source,255,0,0) end else outputChatBox("This username doesn't exist!",source,255,0,0) end end) addEvent("onPlayerAttemptRegister",true) addEventHandler("onPlayerAttemptRegister",root, function(username,password1,password2,email) if (singleQuery("SELECT username FROM accounts WHERE username=? LIMIT 1",string.lower(username))) then outputChatBox("This username is taken! please choose another!",source,255,0,0) else local x,y,z = 1450.32421875, -2287.287109375, 13.546875 if (execute("INSERT INTO accounts (username,password,email,serial,x,y,z,interior,dimension,skin,health) VALUES (?,?,?,?,?,?,?,?,?,?,?)",string.lower(username),sha256(password1),email,getPlayerSerial(source),x,y,z+1,0,0,0,100)) then outputChatBox("Your account was registered successfully!",source,0,255,0) triggerClientEvent(source,"switchToLogin",source) end end end) function log(player) if (player) then local serial = getPlayerSerial(player) local ip = getPlayerIP(player) local name = getPlayerName(player) local username = getElementData(player,"accountUsername") local timestamp = getRealTime().timestamp execute("INSERT INTO logs (username,playerName,serial,ip,timestamp) VALUES (?,?,?,?,?)",username,name,serial,ip,timestamp) end end function prepair() setElementData(source,"isGuestAccount",true) outputChatBox("Welcome to the server.",source,0,255,0) end addEventHandler("onPlayerJoin",root,prepair) function saveData() if not (getElementData(source,"isGuestAccount") == true) then x,y,z = getElementPosition(source) int,dim = getElementInterior(source),getElementDimension(source) health,armor = getElementHealth(source),getPedArmor(source) money = getPlayerMoney(source) rotation = getElementRotation(source) team = getTeamName(getPlayerTeam(soure)) skin = getElementModel(source) weapons = {} for i=0,12 do local wep = getPedWeapon(source,i) if (wep > 0) then local ammo = getPedTotalAmmo(source,i) if (ammo > 0) then table.insert(weapons,{wep,ammo}) end end end weaponsStr = toJSON(weapons) id = getElementData(source,"accountID") execute("UPDATE accounts SET x=?,y=?,z=?,interior=?,dimension=?,health=100,armor=100,money=0,rotation=?,team=?,skin=?,weapons=? WHERE id=?",x,y,z,int,dim,health,armor,money,rotation,team,skin,weaponsStr,id) else return false end end addEventHandler("onPlayerQuit",root,saveData) addEventHandler("onPlayerWasted",root,saveData) Thank you If you read this, I hope I didn't make this too long.
    • setPedAnimation(thePlayer, "ped", "seat_down", -1, false, false, false, false) The first "false" in that line above is for the loop, if you wrote it true it will activate the animation loop But if you wrote "false" it won't. But remember, the first false in this line is for the loop argument..  
    • I know I can do it that way, but what I'm asking is: I want to something like the server events and client event, I can trigger them anywhere using addEventHandler only, example, so I use "addEventHandler("onPlayerLogin", ...) not triggerEvent("onPlayerLogin", ...). So what I'm looking for I want to create a function that when it function an event handler named 'onSettingsChange' will activate.. function logins() outputChatBox("Welcome....", source) end addEventHandler("onPlayerJoin", root, logins) Here once the player join, the event handler functions right? I want to create like it but when the settings[A custom settings window I created..] change the event handler will function... If it still unclear, I want to create a function that I can trigger in another resource using addEventHandler