Archinet

Members
  • Content Count

    8
  • Joined

  • Last visited

Community Reputation

2 Neutral

About Archinet

  • Rank
    Newbie

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I din't know that i can store with this method local pos = {getElementPosition(source)} Thanks for help me ­čśâ
  2. Archinet

    MTA vs SA-MP

    I have 7 years using SA:MP, but at this date that mod dont get any important update, the users claim for more security, free internet list in the client and dont get any reply for the main developer, i bring to MTA for the new features and the most important thing, the security.
  3. Thanks so much @IIYAMA is good way! what you think about this method? is bad practice? i still learning function pack(...) return {...} end pos = pack(getElementPosition(source)) playerData = { x = pos[1], y = pos[2], z = pos[3] }
  4. Hello guys of this excelent forum, im trying to get the GetElementPosition of my player inside a table PlayerData to store it after in a database, but no works, im not expert in Lua really, but i try to make it works, i search on the forum about this but i find nothing, i hope someone can help. function savePlayer() if(isElement(source)) then if(getElementData(source, "Logueado") == false) then return true end local playerData = { x = getElementPosition(source).x, -- Here "Attempt to index a numbe value. y = getElementPosition(source).y, z = getElementPosition(source).z, rx = getElementRotation(source).rx, ry = getElementRotation(source).ry, rz = getElementRotation(source).rz, dinero = getPlayerMoney(source), trabajo = getElementData(source, "trabajo"), repartidor_nivel = getElementData(source, "repartidor_nivel"), repartidor_puntos = getElementData(source, "repartidor_puntos") } for k,v in ipairs(playerData) do print(k.." - "..v) end end end addEventHandler("onPlayerQuit", getRootElement(), savePlayer)
  5. Hola a todos, estoy muy emocionado por empezar un nuevo proyecto en MTA pero estoy algo confundido con el uso de los resources. Desear├şa que por favor pudiesen ayudarme a dejar mi proyecto limpio sin nada para poder empezar un modo de juego desde cero, en la carpeta de mods hay muchas carpetas que me confunden y no se cual desactivar y cual dejar activadas. Si me dan una mano para poder configurar mi carpeta para poder empezar mi proyecto RPG seria de gran ayuda y lo agradecer├ę mucho, gracias por adelantado.
  6. Hello everyone, I am very excited to start a new project in MTA but I am somewhat confused with the use of resources. I wish you could please help me to leave my project clean with nothing to start a game mode from scratch, in the mod folder there are many folders that confuse me and I don't know which to deactivate and which to leave activated. If you give me a hand to be able to configure my folder to be able to start my RPG project, it would be very helpful and I would appreciate it very much, thanks in advance.
  7. @Alexs Gracias amigo, ya estoy entendiendo un poco mas lo del cliente - server Ahora continuo con mi duda relacionada con los datos cargados de la DB para asignarselos al jugador He visto como algunos utilizan tablas, si no setElementData y otros que usan setAccountData y la verdad es que es algo confuso En samp yo utilizaba un enum PlayerInfo[playerid][money] = db_money Pero aqui en mta es algo confuso que metodo utilizar para asignar los datos y poder trabajar con ellos in-game para restar o sumar y que este se guarde luego al salir del juego.
  8. Un saludos a todos en la comunidad He salido de SAMP para pasarme a MTA por todas las mejoras y diferencias que tiene. No he podido entender bien el uso que se tiene para el client y para el server, por ejemplo he estado utilizando un script que baje de la comunidad para el registro, login y save, funciona pero aqui viene mi otra duda. ┬┐Si quiero cargar el dinero de la base de datos como se lo agrego al jugador? ┬┐Que m├ętodo es mas seguro de hacerlo? En samp GetPlayerMoney retorna el dinero del cliente, ┬┐en MTA tambien es igual? o es una funcion server-side? Aqui les dejo el script que edite un poco porque daba algunos errores, funciona y todo pero tengo la duda de agregar el dinero al jugador de forma "incorrecta" y que puedan aprovecharse de eso. Apreciare sus respuestas de antemano, aqui el script por si pueden darme una mano para poder a├▒adir una forma segura el dinero cargado de la DB. --[[ * Author: Om (RipeMangoes69) * Project: None (FFA) * Date: 8 December 2016 * File: server.lua ]]-- root = getRootElement() function PlayerJoin() triggerClientEvent (source, "openLoginGUI", source, true) toggleControl(source, "chatbox", false) end addEventHandler ( "onPlayerJoin", root, PlayerJoin ) -- MySQL Handlers. db = dbConnect( "mysql", "dbname=db_mta;host=127.0.0.1", "root", "pass", "share=1") if db then outputDebugString( "Connection with database was successfully established." ) else outputDebugString( "Connection with database couldn't be established." ) end function loginPlayer(username, password) qh = dbQuery(db, "SELECT * FROM accounts WHERE BINARY username=? and password=?", username, md5(password)) result , numrows, errmsg = dbPoll (qh, -1) local row = result[1] if row then triggerClientEvent(client, "login.success", client) -- Connect to MTA Login System for Admin Access. local account = getAccount(username, password) if (account ~= false) then logIn(client, getAccount(username), password) outputChatBox("Te has conectado exitosamente como [Administrador].", client) else outputChatBox("Te has conectado exitosamente.", client) end setElementData(client, "isPlayedLoggedIn", true) setElementData(client, "getPlayerUsername", username) spawnPlayer(client, row["pos_x"], row["pos_y"], row["pos_z"], row["pos_r"], row["skin"], 0, 0, getPlayerTeam(client)) -- spawns player with random skin fadeCamera (client, true) setCameraTarget (client, client) toggleControl(client, "chatbox", true) outputServerLog("Login: User: " .. getPlayerName(client) .. " successfully logged in as " .. username .. "! (IP: " .. getPlayerIP(client) .. " | Serial: " .. getPlayerSerial(client) ..")") else outputChatBox("Oops! Something went wrong, have a check on your username and password.", client) end end addEvent("loginPlayer", true) addEventHandler("loginPlayer", resourceRoot, loginPlayer) -- Register Player function registerPlayer(username, password, email) qh = dbQuery(db, "SELECT * FROM accounts WHERE BINARY username=?", username) result , numrows, errmsg = dbPoll (qh, -1) local row = result[1] if row then outputChatBox("Sorry! Username already in use.", client) else cr = dbQuery(db, "INSERT INTO accounts (username, password, email) VALUES (?,?,?)", username, md5(password), email) triggerClientEvent(client, "register.success", client) outputChatBox("Te has registrado correctamente, ahora coloca tus datos para conectarte.", client) end end addEvent("registerPlayer", true) addEventHandler("registerPlayer", resourceRoot, registerPlayer) -- Bug Fixed. function rejoinMe(thePlayer) redirectPlayer(thePlayer,"",0) end addEvent("redirectPlr", true) addEventHandler("redirectPlr", root, rejoinMe) function saveData() x,y,z = getElementPosition(source) money = getPlayerMoney(source) skin = getPedSkin(source) local query = "UPDATE accounts SET skin='" .. skin .. "', pos_x='" .. x .. "', pos_y='" .. y .."', pos_z='" .. z .."' WHERE username='" .. getPlayerUsername(source) .."'" dbQuery(db, query) outputServerLog("Guardando jugador "..getPlayerUsername(source).."") end addEvent("saveData", true) addEventHandler("onPlayerQuit", root, saveData) -- Exports function getPlayerUsername(thePlayer) un = getElementData(thePlayer, "getPlayerUsername") return un end