_SAXI_
Members-
Posts
80 -
Joined
-
Last visited
-
Days Won
3
Everything posted by _SAXI_
-
Si está descompilado, necesitamos ver el código del lado servidor para poder ayudarte
-
local godtime = 5; -- seconds local godmode = false; -- variable for godmode local godtimer addEventHandler('onClientPlayerSpawn',localPlayer,function() godmode = true; setElementAlpha(localPlayer,255/2) -- set player alpha to 50% -- with this chunk we reset the timer (if this exists) if(godtimer)then isTimer(godtimer)then killTimer(godtimer); end end setTimer(disableGod,godtime*1000,1); -- set timer for disable godmode end) function disableGod() godmode = false; setElementAlpha(localPlayer,255); -- return player alpha end addEventHandler('onClientPlayerDamage',localPlayer,function() -- if godmode is active then if(godmode)then cancelEvent(); -- cancel damage for player with this event (onClientPlayerDamage) end end) Hi, I have commented the code so that you can understand what it does and learn
-
playerMarkers = {}; function onSpawn(x,y,z) -- reset table if(playerMarkers[source])then for i,m in pairs(playerMarkers)do if(m)then if(isElement(m))then destroyElement(m); end end end end playerMarkers[source] = nil; if(getElementData('jogo') == 'sim')then playerMarkers[source] = {}; local frente = createMarker (x+1.2,y,z,"cylinder",1,255,255,255,255); local tras = createMarker (x-1.2,y,z,"cylinder",1,255,255,255,255); local direita = createMarker (x,y+1.2,z,"cylinder",1,255,255,255,255); local esquerda = createMarker (x,y-1.2,z,"cylinder",1,255,255,255,255); playerMarkers[source] = {frente,tras,direita,esquerda}; addEventHandler ("onMarkerHit",frente,matar); addEventHandler ("onMarkerHit",tras,matar); addEventHandler ("onMarkerHit",direita,matar); addEventHandler ("onMarkerHit",esquerda,matar); end end addEventHandler('onPlayerSpawn',root,onSpawn); function matar(elem,dim) if(type(elem) == 'player') and (dim == getElementDimension(source))then if(playerMarkers[elem])then for _,m in pairs(playerMarkers[elem])do if(m == source)then killPed(source); end end end end end function muerteJogador() if(playerMarkers[source])then for i,m in pairs(playerMarkers)do if(isElement(m))then destroyElement(m); end end playerMarkers[source] = {}; end end addEventHandler('onPlayerWasted',root,muerteJogador); -- OPCIONAL -- addEventHandler('onResourceStart',resourceRoot,function() for _,j in pairs(getElementsByType('player'))do if(getElementData(j,'jogo') == 'sim')then local x,y,z = getElementPosition(j); playerMarkers[j] = {}; local frente = createMarker (x+1.2,y,z,"cylinder",1,255,255,255,255); local tras = createMarker (x-1.2,y,z,"cylinder",1,255,255,255,255); local direita = createMarker (x,y+1.2,z,"cylinder",1,255,255,255,255); local esquerda = createMarker (x,y-1.2,z,"cylinder",1,255,255,255,255); playerMarkers[j] = {frente,tras,direita,esquerda}; addEventHandler ("onMarkerHit",frente,matar); addEventHandler ("onMarkerHit",tras,matar); addEventHandler ("onMarkerHit",direita,matar); addEventHandler ("onMarkerHit",esquerda,matar); end end end);
-
outputChatBox('O jogador: '..getPlayerName(v)..'#ffffff Tem R$: #00ff00'..dinheiro.. ' #ffffffDe Dinheiro Na Mão !',playerSource, 255, 255, 255, true)
-
La sintaxis de la consulta está mal escrita. Intenta con este código: db = dbConnect("sqlite", "posiciones.db"); function contando(j) local coor = dbQuery(db,"SELECT * FROM coordenadas"); local result = dbPoll(coor,-1); outputChatBox(tostring(#result),j); end addCommandHandler("contar", contando);
-
You can use an array to solve that. local Ranks = { {1,400}, {2,200}, {3,100}, {4,80}, {5,50}, {6,30}, {7,20}, {8,20}, {9,20}, {10,10}, {11,10}, {12,10}, {13,10}, {14,10}, {15,10}, {16,5}, {17,5}, {18,5}, {19,5}, {20,5} } local payToPlayer={}; addEventHandler('onPlayerWasted',root,function() for _,v in ipairs(Ranks) do if(exports["race"]:getPlayerRank(source) == v[1] )then payToPlayer[source] = v[2]; end end end) addEventHandler('onPlayerSpawn',root,function() if(payToPlayer[source])then givePlayerMoney(source,payToPlayer[source]); payToPlayer[source] = nil; -- reset the array end end)
-
Your error is in the second argument of the triggerServerEvent: Syntax: triggerServerEvent("eventName",sourceElement,...) fix: triggerServerEvent("yourEvent",localPlayer,...)
-
You had a problem in the table. Here's the fix: local Ranks = { {1,400}, {2,200}, {3,100}, {4,80}, {5,50}, {6,30}, {7,20}, {8,20}, {9,20}, {10,10}, {11,10}, {12,10}, {13,10}, {14,10}, {15,10}, {16,5}, {17,5}, {18,5}, {19,5}, {20,5} }
-
Hola, eso sucede porque estás haciendo mal la condicional; estás usando setPedStat -- devuelve true solo si se pudo establecer el valor. En caso de que el ped o jugador ya tengan el stat establecido, devolverá false Cuando deberías usar getPedStat Aquí la corrección: if burgereat == 2 then if getPedStat( thePlayer , 21 ) == 0 then setPedStat( thePlayer , 21 , 300 ) executeCommandHandler ( "stopeatburgerB", thePlayer ) burgereat = 0 elseif getPedStat( thePlayer , 21) == 300 then setPedStat( thePlayer , 21 , 400 ) executeCommandHandler ( "stopeatburgerB", thePlayer ) burgereat = 0 end end
- 1 reply
-
- 1
-
Eso pasa porque sí te está ubicando en tu posición, pero tienes que agregar que volviste al interior 0. function La_Salida(hitElement) setElementPosition(hitElement, 1363.81640625, -1279.626953125+4, 13.546875) setElementInterior(0) end
- 3 replies
-
- marker
- setelementposition
-
(and 1 more)
Tagged with:
-
Hola, puedes guiarte con éste recurso de la comunidad, es una de las maneras más sencillas.
-
El problema en tu código es que 'source' es el objeto, debes cambiar el parametro y usar el de player.
-
Prueba con el evento onClientObjectDamage sería algo así: local myObj = createObject(...); addEventHandler("onClientObjectDamage",myObj,function(_,jugador) local weapon = getPedWeapon(jugador) if(weapon == 39)then destroyElement(myObj); end end);
-
function info (thePlayer) bindKey(thePlayer,"f3","down","pvp") exports["a_infobox"]:addBox(thePlayer, "info", "Para entrar al PVP con mp4 usa el comando /pvp o presiona la tecla f3") end addEventHandler("onMarkerHit", matchmarker, info)
-
Server-side -- Function for give weapon function giveWeaponToPlayer() --The weapon is given to the player giveWeapon(client,31,60); end -- A new event is created addEvent("giveMeWeapon"); -- Execute the `giveWeaponToPlayer` function when calling the event from the client side addEventHandler("giveMeWeapon",root,giveWeaponToPlayer); Client-side function onLocalPlayerClick(button,state) if button == "left" then if state == "up" then -- The `giveMeWeapon` event is executed triggerServerEvent("giveMeWeapon",localPlayer); end end end addEventHandler("onClientClick",localPlayer,onLocalPlayerClick);
-
Você se esqueceu de fechar o primeiro e o último sim. function info(source) if isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(source)), aclGetGroup ("Staff")) then --Ajudante local ownedVehicle = getElementData ( source, "Masculino" ) if (ownedVehicle ~= true) then setElementModel (source, 217) end local ownedVehicle = getElementData ( source, "Feminino" ) if (ownedVehicle ~= true) then setElementModel (source, 11) end end end addCommandHandler("staffon", info)
-
[APORTE] Script de policías | Orden de búsqueda y captura
_SAXI_ replied to aka Blue's topic in Recursos y aportes
Tendrías que modificar la condicional que verifica que es por equipos hacer que sea por facción. Desconozco cual es la función de tu roleplay para obtener la facción de tu jugador, pero suponiendo sería algo más o menos así: if exports.roleplay_resource:isPlayerInFaction(player,"Policia") then -
function ifPlayerEnterOnMarker (hit ) if getElementType(hit) == 'player' or getElementType(hit) == 'ped' then if isPedInVehicle(hit) then if not isElementWithinMarker(hit, ppcik[source]) then return end if isElement(ppcik[source]) then local vh = getPedOccupiedVehicle(hit) local id = getElementModel(vh) if id == 514 then if ( getVehicleTowedByVehicle ( vh ) == CargaPet[hit] ) then local rname = getElementData(source,"rtname") or nil if rname == nil then return end destroyElement(ppcik[source]) triggerClientEvent(hit,"JOBUS>blips<Client",resourceRoot,false) if atualrotnumber[hit] <= #rotas[rname] then gerarrota(hit) elseif atualrotnumber[hit] == #rotas[rname]+1 then setElementData(hit,"rtname",rname) atualrotnumber[hit] = 1 local rec = pay[rname] givePlayerMoney(hit,tonumber(rec)) local vh = getPedOccupiedVehicle(hit) destroyElement ( CargaPet[hit] ) setElementData(hit,"rtname",nil) exports.Scripts_Dxmessages:outputDx(hit, "Su carga se descargó y recibió $"..rec.." Por su servicio!", "success") unbindKey ( hit, LetraParaMarkers, "down", ifPlayerEnterOnMarker ) exports.Scripts_OnMarkerMsgs_:delete(source) end else exports.Scripts_Dxmessages:outputDx(hit, "No puede descargar su camión sin su carga!", "error") end end end end end end Si no me equivoco esa es la función, búscala y reemplaza. Debería funcionar de ésta manera
-
Puedes mostrar el código del cliente?
-
local sql = executeSQLQuery addEventHandler('onResourceStart',resourceRoot,function() sql('CREATE TABLE IF NOT EXISTS ´AccountsRegister´ (IP TEXT)') end) function isIPRegister(jugador) local user = jugador or client or source if not user then return end local qh = sql('SELECT IP FROM ´AccountsRegister´ WHERE IP=?',getPlayerIP(user)) -- Devolverá true si es que ya hay cuentas creadas con la dirección IP y false cuando no existan cuentas return #qh > 0 end function registerIP(str) sql('INSERT INTO ´AccountsRegister´ (IP) VALUES(?)',str) end addEventHandler('onPlayerCommand',root,function(cmd) if cmd == 'register' then if isIPRegister(source) then outputChatBox('Esta dirección IP ya tiene una cuenta asociada',source,255,0,0) else registerIP(getPlayerIP(source)) outputChatBox('Ahora tu cuenta tiene una dirección IP asociada!',source,0,255,0) end end end) Podrías intentar esto, no lo he probado, pero debería funcionar de manera correcta en cuanto a lo que pides.
-
[Ayuda] ¿Que debo saber para crear un servidor?
_SAXI_ replied to SebasPB's topic in Ayuda relacionada al cliente/servidor
La verdad si quieres ser original en cuanto a tu proyecto debes aprender y dominar el lenguaje de programación Lua; el lenguaje utilizado en MTA. También deberás aprender manejo de bases de datos (Recomendable con estructura MySQL). Aquí puedes echar un vistazo al manual de LUA: https://www.lua.org/manual/5.1/es/ No te asustes, para mta solo debes comprender lo básico de lua, pero si nunca haz programado deberás abrir tu mente en cuanto los tipos de datos del lenguaje, entre los básicos están los String, number y tablas (arrays) y dentro lo posible la programación orientada a objetos, pero eso es un poco más avanzado, pero bastante útil a la hora de programar. También está la wiki de MTA (Manejada con Lua) donde encontrarás todas las funciones y eventos de MTA: https://wiki.multitheftauto.com Dentro de la misma wiki encontrarás algunos tutoriales en español de como comenzar a programar en MTA: https://wiki.multitheftauto.com/wiki/ES/Introducción_a_Lua https://wiki.multitheftauto.com/wiki/ES/Introducción_a_la_Programación_de_GUI https://wiki.multitheftauto.com/wiki/ES/Resources Otra opción que tienes es buscar tutoriales en Youtube de como programar en MTA, hay muchos usuarios que se dedicaron en su momento a crear éstos tutoriales para los novatos en creación de servidores. Espero haberte ayudado. Un Saludo. -
Perdón la demora. function abrirGUIConcesionario(sql) if not ventana then ventana = guiCreateWindow(431, 215, 429, 455, "Interiores a la venta", false) else if guiGetVisible(ventana) then return end showCursor(true) guiWindowSetSizable(ventana, false) listatodos = guiCreateGridList(30, 44, 245, 387, false, ventana) guiGridListAddColumn(listatodos, "ID", 0.2) guiGridListAddColumn(listatodos, "Nombre", 0.5) guiGridListAddColumn(listatodos, "Precio", 0.2) rAct = 0 sigCat = 0 -- Categoría -- for i = 1, 2 do guiGridListAddRow(listatodos) if sigCat == 1 then rAct = rAct + 1 sigCat = 0 end guiGridListSetItemText(listatodos, rAct, 2, tostring(catVeh[i][1]), false, false) guiGridListSetItemColor(listatodos, rAct, 2, 0, 255, 0) for k, v in ipairs(sql) do if tonumber(v.interiorType) == tonumber(i) then rAct = (rAct+1) guiGridListAddRow(listatodos) guiGridListSetItemText(listatodos, rAct, 1, tostring(v.interiorID), false, false) guiGridListSetItemText(listatodos, rAct, 2, tostring(v.interiorName), false, false) guiGridListSetItemText(listatodos, rAct, 3, tostring(v.interiorPrice), false, false) end sigCat = 1 end end -- Fin Categoría -- botonmarcar = guiCreateButton(300, 290, 119, 56, "Marcar Posición", false, ventana) addEventHandler('onClientGUIClick', botonmarcar, regularBotonGUI) botoncerrar = guiCreateButton(300, 375, 119, 56, "Cerrar", false, ventana) addEventHandler('onClientGUIClick', botoncerrar, regularBotonGUI) precio = guiCreateLabel(257, 88, 152, 21, "", false, ventana) end end addEvent("abririnmo", true) addEventHandler("abririnmo", root, abrirGUIConcesionario) Con eso debería bastar
-
function abrirGUIConcesionario(sql) if not ventana then showCursor(true) ventana = guiCreateWindow(431, 215, 429, 455, "Interiores a la venta", false) guiWindowSetSizable(ventana, false) listatodos = guiCreateGridList(30, 44, 245, 387, false, ventana) guiGridListAddColumn(listatodos, "ID", 0.2) guiGridListAddColumn(listatodos, "Nombre", 0.5) guiGridListAddColumn(listatodos, "Precio", 0.2) rAct = 0 sigCat = 0 -- Categoría -- for i = 1, 2 do guiGridListAddRow(listatodos) if sigCat == 1 then rAct = rAct + 1 sigCat = 0 end guiGridListSetItemText(listatodos, rAct, 2, tostring(catVeh[i][1]), false, false) guiGridListSetItemColor(listatodos, rAct, 2, 0, 255, 0) for k, v in ipairs(sql) do if tonumber(v.interiorType) == tonumber(i) then rAct = (rAct+1) guiGridListAddRow(listatodos) guiGridListSetItemText(listatodos, rAct, 1, tostring(v.interiorID), false, false) guiGridListSetItemText(listatodos, rAct, 2, tostring(v.interiorName), false, false) guiGridListSetItemText(listatodos, rAct, 3, tostring(v.interiorPrice), false, false) end sigCat = 1 end end -- Fin Categoría -- botonmarcar = guiCreateButton(300, 290, 119, 56, "Marcar Posición", false, ventana) addEventHandler('onClientGUIClick', botonmarcar, regularBotonGUI) botoncerrar = guiCreateButton(300, 375, 119, 56, "Cerrar", false, ventana) addEventHandler('onClientGUIClick', botoncerrar, regularBotonGUI) precio = guiCreateLabel(257, 88, 152, 21, "", false, ventana) end end addEvent("abririnmo", true) addEventHandler("abririnmo", root, abrirGUIConcesionario)