-
Posts
1,102 -
Joined
Everything posted by Enargy,
-
Hola, Estoy haciendo un sistema de chat personalizado que cancela el mensaje y envía el mensaje, elemento, tipo de mensaje, mediante un triggeo. En sí; no estoy usando onPlayerChat, solo lo hago para cancelar el mensaje y enviar un triggeo global(triggerEvent), uso un addCommandHandler para enviar el mensaje function isCommand(player, text) local c1, c2 = string.find(text, "/") if not c1 or c1 ~= 1 then return false end text = text:sub(2, #text) if #text:gsub("%s", "") == 0 then return true end local command = text:split(" ") local argList = "" for i=2, #command do argList = argList.." "..command[i] end if not hasObjectPermissionTo(player, "command.".. text, true) then return end executeCommandHandler(command[1], player, argList) triggerClientEvent(player, "onClientExecuteCommand", player, command, argList) return true end function string:split(sep) local sep, fields = sep or ":", {} local pattern = string.format("([^%s]+)", sep) self:gsub(pattern, function(c) fields[#fields+1] = c end) return fields end Este código me permite ejecutar comandos existente; pero solo comandos que están dentro de un script pero al momento de usarlo con comandos de MTA como debugscript, nick, whois, etc... No funciona. Así trabaja mi código: addEvent("onPlayerSendMessage", true) function chatMessage( player, type, message ) if isCommand(player,message) then return end if type == "Global" then --bla bla bla end end addEventHandler( "onPlayerSendMessage", root, chatMessage)
-
No me funciono, gracias por responder . Lo veo bien lol. elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Everyone")) then cancelEvent() local lvl = getElementData(source, "level") local r, g, b = getPlayerNametagColor(source) local gang = exports.gang_system:getPlayerGang ( source ) or "N/A" outputChatBox( "#FFFFFF["..gang.."] " .. getPlayerName ( source ) ..":#FFFFFF " .. text, getRootElement(), r, g, b, true ) outputServerLog("CHAT: [user] " .. getPlayerName ( source ) .. ": " .. text)
-
elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Everyone")) then cancelEvent() local lvl = getElementData(source, "level") local r, g, b = getPlayerNametagColor(source) local gang = exports.gang_system:getPlayerGang ( source) local gangTag if ( gang ) then gangTag = gang outputChatBox( "#FFFFFF["..gangTag.."] " .. getPlayerName ( source ) ..":#FFFFFF " .. text, getRootElement(), r, g, b, true ) else gangTag = "User" outputChatBox( "#FFFFFF["..gangTag.."] " .. getPlayerName ( source ) ..":#FFFFFF " .. text, getRootElement(), r, g, b, true ) end outputServerLog("CHAT: [user] " .. getPlayerName ( source ) .. ": " .. text)
-
[1.5 Freeroam][Proyecto]Super Weones Anti Terroristas [SWAT]
Enargy, replied to Pipin's topic in Servidores en donde jugar
:* -
Gracias, ahora lo pruebo.
-
Si.
-
Hola, Lo que dice en el titulo .
-
type = { [22] = "handguns", [23] = "handguns", [24] = "handguns", [25] = "shotguns", [26] = "shotguns", [27] = "shotguns", [28] = "sub-machine_guns", [29] = "sub-machine_guns", [32] = "sub-machine_guns", [30] = "machine_guns", [31] = "machine_guns", [33] = "rifles", [34] = "rifles", [35] = "heavy_weapons", [36] = "heavy_weapons", [37] = "heavy_weapons", [38] = "heavy_weapons", } function getWeaponCategory( id ) local myWeapon = getPlayerWeapon( localPlayer ) if ( myWeapon ) then return type[id] end return false end weapons = { ["handguns"] = true,["shotguns"] = true,["sub-machine_guns"] = true, ["machine_guns"] = true,["rifles"] = true,["heavy_weapons"] = true, } function blockWeapon( ) if (not weapons[getWeaponCategory( getPlayerWeapon(localPlayer) )] ) then toggleControl("fire", true) return end if ( getPedTotalAmmo( getLocalPlayer() ) == 1 ) then toggleControl("fire", false) else toggleControl("fire", true) end end addEventHandler( "onClientPlayerWeaponFire", root, blockWeapon ) addEventHandler( "onClientPlayerWeaponSwitch", root, blockWeapon ) addEventHandler( "onClientResourceStop", resourceRoot, function() toggleControl("fire", true) end )
-
You must use hitElement instead of thePlayer.
-
function rewardOnWasted ( ammo, killer, killerweapon, bodypart ) if ( killer ) and ( killer ~= source ) then if isPlayerInTeam( killer, "POLICE" ) and isPlayerInTeam( source, "CRIMINAL" ) then givePlayerMoney ( killer, 1000 ) end end end addEventHandler ( "onPlayerWasted", getRootElement(), rewardOnWasted ) function isPlayerInTeam(player, team) assert(isElement(player) and getElementType(player) == "player", "Bad argument 1 @ isPlayerInTeam [player expected, got " .. tostring(player) .. "]") assert((not team) or type(team) == "string" or (isElement(team) and getElementType(team) == "team"), "Bad argument 2 @ isPlayerInTeam [nil/string/team expected, got " .. tostring(team) .. "]") return getPlayerTeam(player) == (type(team) == "string" and getTeamFromName(team) or (type(team) == "userdata" and team or (getPlayerTeam(player) or true))) end
-
Edit: Deberias subir tus resources en la comunidad de MTA y postear el codigo completo aca, Supongo.
-
attachElements(musica, localPlayer)
-
Coloca esto en asd2. if isPedOnGround( localPlayer ) then local _,_,mz = getElementPosition( markerPass ); local _,_,pz = getElementPosition( localPlayer ); if ( math.floor(pz) == math.floor(mz) ) then --- outputBarMessage(...) end end
-
string.find string.gsub
-
addCommandHandler("password", marker123)
-
El codigo de venad funciona, pero el codigo en tu caso esta en cliente. Los parametros de addCommandHandler no necesita definir source. "Funcion( cmd, arg1 )". Debes eliminar source.
-
Raras en que sentido? Explícate mejor.
-
53 no es la id de un arma, sino un tipo de muerte ( Drowned - ahogado ), no te serviría usando esto pero puedes cancelar el daño por falta de oxigeno, usando onClientPlayerDamage e isPlayerInWater como condicional cancelas el evento. Tambien tienes que definir que no haya un atacante. En este caso, wep es state. Los argumentos pueden llamarse 'askjdashk' o 'perro' e igual funcionaria.
-
Estas comparando una string con un numero. if wep == 53 then -- wep en este caso, es conocido como el estado del boton, ya sea presionado o no ( up - down ) -- end Usa esto function agua(_,wep) if ( source == BucearSinMorir ) then if ( wep == "up" ) then addEventHandler( "onClientPlayerDamage",localPlayer, cancelEvent() ) end end end addEventHandler("onClientGUIClick", root, agua)
-
local scX, scY = ( sx / screenX ), ( sy / screenY )
-
Donde esta definida 'sx', 'maxResistencia'? si no aparece nada es por que hay error en esas dos variables. y el error ? y en la linea 13 no está la aritmética en " scY (198) " dxDrawRectangle(scX * (848), scY (198), scX * (124), scY * (14), tocolor(0, 0, 0, 255), false)
-
La de MTA. El monitor no tiene nada que ver con la resolución del mta, pero eso si, si tu monitor es muy pequeño, algunas resoluciones no te saldrán en las opciones de igual manera se pueden mostrar todas al hacer lo que escribí arriba, pero es algo que mta trae desactivado por defecto.
-