Jump to content

Enargy,

Members
  • Posts

    1,102
  • Joined

Everything posted by Enargy,

  1. Prueba esto: addEventHandler("onPlayerWasted", root, function(_, killer) if killer ~= source then if isPlayerWastedByHelicopter( killer ) then outputChatBox(getPlayerName( source ).. " murió por un ".. getVehicleType( killer ), getRootElement()); end end end) function isPlayerWastedByHelicopter ( car ) if ( getElementType( car ) == "vehicle" and getVehicleType ( car ) == "Helicopter" ) then return true; end return false; end
  2. Hello, I 'm looking for a library to make gui designs personalized way. whether there would be very helpful because I need one because the GUI's MTA default is very bad. Thanks.
  3. Sencillo pero no lo sabe hacer . En fin, te recomiendo que no toques el killmessages porque alguno de estas ocasiones vas a hacer que deje de funcionar. si ya lo tienes editado a tu preferencia y quieres agregar otra cosa como la que sugieres pues hazlo en otro script, usando algunas funciones de sí que se pueden exportar. exports: outputKillMessage -- creo que era esta.
  4. 3 letter, not 4. No One Out Beauty BIC
  5. What i already tested it , working fine try to stop the resource delete the db then start the resource. I reconnected from my server and work finally Thank you.
  6. I have tried adding outputs in the part where the values ​​are saved and don't appear. -- Never run this part. if AccountExist ( accountName ) then dbExec(database, "UPDATE accounts SET money = ? WHERE account = ?",playerMoney,accountName) outputDebugString("database was updated.") else dbExec(database, "INSERT INTO accounts VALUES (? , ?) ",accountName,playerMoney) outputDebugString("Some values inserted in database") end here might be the possible error function AccountExist ( AccountName ) local result = dbPoll(dbQuery(database, "SELECT * FROM accounts WHERE account = ?", tostring (AccountName)),-1) if ( type ( result ) == "table" and #result == 0 or not result ) then return false else return true end end EDIT: I tried your solutions but not work, return false.
  7. I've changed but it's the same. function makeDB () dbExec(database, "CREATE TABLE IF NOT EXISTS accounts (account TEXT, money INTEGER)"); end function saveDataBase() local playerAccount = getPlayerAccount ( source ); local playerMoney = getPlayerMoney ( source ); if playerAccount and not isGuestAccount(playerAccount) then local accountName = getAccountName(playerAccount) if AccountExist ( accountName ) then dbExec(database, "UPDATE accounts SET money = ? WHERE account = ?",playerMoney,accountName) else dbExec(database, "INSERT INTO accounts VALUES (? , ?) ",accountName,playerMoney) end end --setPlayerMoney(source, 0) end function AccountExist ( AccountName ) local result = dbPoll(dbQuery(database, "SELECT * FROM accounts WHERE account = ?", tostring (AccountName)),-1) if ( type ( result ) == "table" and #result == 0 or not result ) then return false else return true end end function loadDataBase ( _,cur) local acountName = getAccountName(cur) local moneyData = getPlayerMoneyFromDb(accountName) outputChatBox(moneyData, source) end function getPlayerMoneyFromDb(accountName) local check = dbPoll(dbQuery(database, "SELECT * FROM accounts WHERE account = ?",tostring(accountName)), -1) if type(check) == "table" and #check == 0 or not check then return false else return tostring(check[1]["money"]) end end addEventHandler("onPlayerLogin", root, loadDataBase) --addEventHandler("onPlayerQuit", getRootElement(), saveDataBase) addEventHandler("onPlayerLogout", root, saveDataBase) addEventHandler("onResourceStart", resourceRoot, makeDB)
  8. I've changed but it's the same.
  9. I tried this but not working. function loadDataBase ( _,cur) local acountName = getAccountName(cur) local moneyData = getPlayerMoneyFromDb(accountName) outputChatBox(moneyData, source) end Bad argument @ 'outputChatBox' [Expected string at argument 1, got boolean]
  10. You must specify from which array you want to get the value so you need to use "WHERE" like this dbQuery(database, "SELECT * FROM accounts WHERE account = ?, --[[ account name here ]]") e.g, getting player money function loadDataBase ( _, account ) local moneyData= dbQuery(database, "SELECT * FROM accounts WHERE account = ?", getAccountName(account) ) --- as you should get the value I have inserted is known as money. end addEventHandler ( "onPlayerLogin", root, loadDataBase );
  11. and when the time to enter an account as I do to get the values ​​of the table? dbQuery(database, "SELECT * FROM accounts") ??
  12. Hello, I decided to learn to make my own sqlite saved but I'm as stuck and having a lot mistakes about himself. If someone has something to suggest or what is exactly that can do (dbExec, dbPoll, dbQuery, dbFree) I've taken examples from different topics and as results got this: local database = dbConnect( "sqlite", "files.db" ); function makeDB () dbExec(database, "CREATE TABLE IF NOT EXISTS accounts ( money TEXT, account TEXT)"); end function saveDataBase() local playerAccount = getPlayerAccount ( source ); local playerMoney = getPlayerMoney ( source ); --if (not isGuestAccount( playerAccount )) then -- if player has not an account. local query = dbExec(database, "SELECT * FROM accounts WHERE money = ?", playerMoney); local _, rows = dbPoll(query, -1); if rows == 0 then dbExec(database, "INSERT INTO accounts SET money = ?", playerMoney); end dbExec(database, "UPDATE accounts SET money = ?", playerMoney); --end end --addEventHandler("onPlayerQuit", getRootElement(), saveDataBase) addEventHandler("onPlayerLogout", getRootElement(), saveDataBase) addEventHandler("onResourceStart", resourceRoot, makeDB) When I leave the server or logout shows: Bad argument @ 'dbPoll' [Expected db-query at argument 1, got boolean] I'll wait your answers. Thanks.
  13. Save Fork Smallest ITO
  14. Puedes comprobar de que haya algún jugador dentro del cuboid usando getElementsWithinColShape y luego hacer un loop como te lo indica la wiki.
  15. If I get you, you're looking for this? teamList = { -- you must add some teams here. ["SWAT"] = true, ["Police"] = true, ["Civil"] = true } function checkPlayerInTeam( ) local team = getPlayerTeam( getLocalPlayer() ) if team then if ( teamList[getTeamName( team )] ) then toggleControl("fire", false); end else toggleControl("fire", true); end end setTimer(checkPlayerInTeam, 1000, 0 ) -- every second it will check if you are in team.
  16. Cuando dos personas ejecutan el conteo pues como estan definidas con el mismo nombre se interconectan y uno hace todo el funcionamiento y el otro regresara false a todo. prueba mark = {} count = {} function conteo(thePlayer) if (not isTimer(count[thePlayer])) then local x, y, z = getElementPosition(thePlayer) local dim = getElementDimension(thePlayer) local int = getElementInterior(thePlayer) mark[thePlayer] = createColCuboid(x-15, y-15, z-15, 30, 30, 30) count[thePlayer] = setTimer(function() outputDebugString("Anti-Spam finalizado. Creador: "..getPlayerName(thePlayer)) killTimer(count[thePlayer]) end, 15000, 1) else outputChatBox("Ya hay un conteo en marcha.", thePlayer, 255,0,0,true) return end outputDebugString("Conteo iniciado por: "..getPlayerName(thePlayer)) end addCommandHandler("conteo", conteo)
  17. function delayedKill (player) setTimer ( function () killPed(player) end, 1500, 1) end addCommandHandler ("test1", delayedKill) function asd(Player, Command) setTimer(killPed,2000,1,Player) end addCommandHandler("test1",asd) Is the same practically.
  18. Puedes usarlo para algo asi local duelo_rechazado = false function invitar(thePlayer, _, victima) local victima = getPlayerFromName(victima); if victima ~= thePlayer then if victima then setElementData(victima, getPlayerName(thePlayer).." me reta a duelo", true); outputChatBox("retaste a ".. getPlayerName(victima).." a un duelo", thePlayer); end end end addCommandHandler("invitar",invitar) function aceptar(thePlayer, _, victima) local retante = getPlayerFromName(victima); local duelo = getElementData(thePlayer, victima.." me reta a duelo"); if duelo then if duelo_rechazado == false then outputChatBox("Aceptaste el duelo", thePlayer); duelo_rechazado = true; end else outputChatBox("No hay ningun retador.", thePlayer); end end addCommandHandler("aceptar", aceptar) function rechazar(thePlayer, _, victima) local retante = getPlayerFromName(victima); local duelo = getElementData(thePlayer, victima.." me reta a duelo"); if duelo then removeElementData(thePlayer, victima.." me reta a duelo"); outputChatBox("rechazaste el duelo", thePlayer); duelo_rechazado = false; end end addCommandHandler("rechazar", rechazar) /invitar /aceptar /rechazar
  19. Pienso que puedes crearlo por elementData.
  20. Funciona, gracias. Lástima que no se pudo mantener lo de esperar el doble de tiempo De nada, puedes editar la parte del comando para que hagas lo de tu "tiempo de espera".
  21. Gracias feo . Hmm ok, gracias por sus palabras Lock topic please.
  22. Prueba con esta versión que hice: bomb = {}; function createBomb(player, x, y, z, delay ) if not isBombExists(bomb[player]) then bomb[player] = createObject( 1252, x, y, z, 0,0,0, false); setPedAnimation (player, "BOMBER", "BOM_Plant", 4000, false, true, false); outputChatBox("#FFFF99¡La bomba explotará en #00FF0015 segundos#FFFF99! ¡CORRE!", player, 255, 0, 0, true); setTimer(function() local x, y, z = getElementPosition ( bomb[player] ); createExplosion ( x, y, z, 10 ); destroyElement( bomb[player] ); bomb[player] = nil end, delay, 1 ); else outputChatBox("#FFFF99¡Ya pusiste una bomba! ¡Espera un tiempo!", player, 255, 255, 255, true); end end function isBombExists( element ) if element then return true end end function bomba( thePlayer ) local x, y, z = getElementPosition ( thePlayer ); createBomb(thePlayer, x, y, z, 15000); end addCommandHandler("bomba", bomba) addCommandHandler("c4", bomba) source createBomb( el_creador, x, y, z, tiempo_detonacion )
  23. Nah.. no quiero copiar el estilo del GTA V, ya que hay servidores que intentan hacer algo similar a eso.
×
×
  • Create New...