Jump to content

[GUI]Alguien sabe por que no me funciona? :(


Recommended Posts

Holas de nuevo! :) pss ahora se me ocurrio hacer un "cheat panel" para admins y la cosa es que no se por que no me funciona :x y lo peor es que la consola no me da ningun error! S:

El gui si sale bien con el bind y solo si uno es admin pero al apretar los botones no pasa nada :cry: asi que creo que el error es al presionar lo botones, pero no estoy seguro S:

Este es el codigo completo...

Server-Side

--Comprueba si el jugador que se logueó esta en el grupo de admins o Smod del ACL 
addEventHandler ( "onPlayerLogin", getRootElement(), 
function () 
if (isGuestAccount(getPlayerAccount(source)) == false) then 
    accountname = getAccountName (getPlayerAccount(source))    
    if isObjectInACLGroup ( "user."..accountname, aclGetGroup ( "Admin" ) ) or isObjectInACLGroup ( "user."..accountname, aclGetGroup ( "SuperModerator" ) ) then 
        triggerClientEvent("adminPlayer", getRootElement()) 
    end 
end 
end 
) 

y aca el Client-Side

_BindKey = "F4" -- Cambia esto por el bind que quieras 
  
rootElement = getRootElement() 
resourceRoot = getResourceRootElement(getThisResource()) 
  
GUIEditor_Label = {} 
  
Window = guiCreateWindow(0.71,0.535,0.2813,0.4217,"~Admin Cheat Panel~",true) 
guiWindowSetSizable(Window,false) 
guiSetVisible(Window, false) 
autoAcuaticoButton = guiCreateButton(0.6257,0.1339,0.3216,0.0669,"ON/OFF",true,Window) 
GUIEditor_Label[1] = guiCreateLabel(0.0468,0.1299,0.5789,0.0787,"AutoAcuatico",true,Window) 
guiLabelSetHorizontalAlign(GUIEditor_Label[1],"center",false) 
GUIEditor_Label[2] = guiCreateLabel(0.0468,0.248,0.5789,0.0787,"AutoVolador",true,Window) 
guiLabelSetHorizontalAlign(GUIEditor_Label[2],"center",false) 
autoVoladorButton = guiCreateButton(0.6257,0.2441,0.3216,0.0669,"ON/OFF",true,Window) 
GUIEditor_Label[3] = guiCreateLabel(0.0468,0.3504,0.5789,0.0787,"ConejoBike",true,Window) 
guiLabelSetHorizontalAlign(GUIEditor_Label[3],"center",false) 
conejoBikeButton = guiCreateButton(0.6257,0.3465,0.3216,0.0669,"ON/OFF",true,Window) 
GUIEditor_Label[4] = guiCreateLabel(0.0468,0.4567,0.5789,0.0787,"SuperSalto",true,Window) 
guiLabelSetHorizontalAlign(GUIEditor_Label[4],"center",false) 
megaSaltoButton = guiCreateButton(0.6257,0.4567,0.3216,0.0669,"ON/OFF",true,Window) 
GUIEditor_Label[5] = guiCreateLabel(0.0468,0.563,0.5789,0.0787,"Godmode Veh",true,Window) 
guiLabelSetHorizontalAlign(GUIEditor_Label[5],"center",false) 
godmodeVehButton = guiCreateButton(0.6257,0.563,0.3216,0.0669,"ON/OFF",true,Window) 
dontBeNoobLabel = guiCreateLabel(0.0702,0.7756,0.8655,0.1693,"NO SEAS NOOB :)",true,Window) 
guiLabelSetVerticalAlign(dontBeNoobLabel,"center") 
guiLabelSetHorizontalAlign(dontBeNoobLabel,"center",false) 
guiSetFont(dontBeNoobLabel,"default-bold-small") 
otorrinoLaringologoDelParacutirimicuaroLabel = guiCreateLabel(0.0468,0.8858,0.9123,0.0866,"~~~~~~~~~~~~~~~~~~~~~~",true,Window) 
guiLabelSetColor(otorrinoLaringologoDelParacutirimicuaroLabel, 200, 255, 0) 
  
function setLabelColor () 
guiLabelSetColor(dontBeNoobLabel, math.random(0,255), math.random(0,255), math.random(0,255)) 
end 
setTimer(setLabelColor, 300,0) 
  
function visible () 
        if (guiGetVisible(Window) == false) then 
        guiSetVisible(Window, true) 
        showCursor(true,true) 
        addEventHandler("onClientRender", root, draw) 
        else 
        guiSetVisible(Window, false) 
        showCursor(false) 
        removeEventHandler("onClientRender", root, draw) 
        end 
end 
addEvent("adminPlayer", true)  
addEventHandler("adminPlayer", getRootElement(), 
function () 
bindKey(_BindKey, "down", visible) 
end) 
  
addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), --Es con este elemento? o con getRootElement? 
function () 
    if (source == autoAcuaticoButton) then 
    triggerEvent("onAutoAcuatico", getLocalPlayer()) --aca desencadena los eventos con el local player como source  
    elseif (source == autoVoladorButton) then 
    triggerEvent("onAutoVolador", getLocalPlayer()) 
    elseif (source == conejoBikeButton) then 
    triggerEvent("onConejoBike", getLocalPlayer()) 
    elseif (source == megaSaltoButton) then 
    triggerEvent("onMegaSalto", getLocalPlayer()) 
    elseif (source == godmodeVehButton) then 
    triggerEvent("onGodMode", getLocalPlayer()) 
    elseif (source == godmodePlayerButton) then 
    triggerEvent("onPlayerGodMode", getLocalPlayer()) 
    end 
end 
) 
  
function draw () 
    dxDrawText("Cheat Panel By MarioKart!",398.0,575.0,714.0,598.0,tocolor(150,255,0,255),0.7,"bankgothic","right","bottom",false,false,false) 
end 
  
--[[-------Cheat_Functions--------]] 
addEvent("onAutoAcuatico", true) 
addEventHandler("onAutoAcuatico", rootElement, autoAcuatico) --Y aca las funciones de los chetos que no se si van con el getResourceRootElement o con el getRootElement  
function autoAcuatico () 
    if not isWorldSpecialPropertyEnabled( "hovercars" ) then 
        setWorldSpecialPropertyEnabled( "hovercars", true ) 
        outputChatBox("Truco Activado! [Auto Acuatico] ", 0, 255, 0 ) 
        else 
        setWorldSpecialPropertyEnabled( "hovercars", false ) 
        outputChatBox("Truco desactivado! [Auto Acuatico]", 255, 0, 0 ) 
        end 
end 
  
addEvent("onAutoVolador", true) 
addEventHandler("onAutoVolador", rootElement, autoVolador) 
    function autoVolador () 
        if not isWorldSpecialPropertyEnabled( "aircars" ) then 
            setWorldSpecialPropertyEnabled( "aircars", true ) 
            outputChatBox("Truco Activado! [Auto Volador]", 0, 255, 0 ) 
        else 
            setWorldSpecialPropertyEnabled( "aircars", false ) 
            outputChatBox("Truco desactivado! [Auto Volador]", 255, 0, 0 ) 
        end 
    end 
  
addEvent("onConejoBike",true) 
addEventHandler("onConejoBike", rootElement, conejoBike) 
function conejoBike () 
        if not isWorldSpecialPropertyEnabled( "extrabunny" ) then 
            setWorldSpecialPropertyEnabled( "extrabunny", true ) 
            outputChatBox("Truco Activado! [Extra Bunny Bike]", 0, 255, 0 ) 
        else 
            setWorldSpecialPropertyEnabled( "extrabunny", false ) 
            outputChatBox("Truco desactivado! [Extra Bunny Bike]", 255, 0, 0 ) 
        end 
end 
  
addEvent("onMegaSalto", true) 
addEventHandler("onMegaSalto", rootElement, megaSalto) 
function megaSalto () 
        if not isWorldSpecialPropertyEnabled( "extrajump" ) then 
            setWorldSpecialPropertyEnabled( "extrajump", true ) 
            outputChatBox("Truco Activado! [Mega Salto]", 0, 255, 0 ) 
        else 
            setWorldSpecialPropertyEnabled( "extrajump", false ) 
            outputChatBox("Truco desactivado! [Mega Salto]", 255, 0, 0 ) 
        end 
end 
  
addEvent("onGodMode", true) 
addEventHandler("onGodMode", rootElement, godMode) 
function godMode () 
        if (isPedInVehicle(source) == true) then 
            vehicle = getPedOccupiedVehicle ( source ) 
            if ( isVehicleDamageProof(vehicle) == true ) then 
                    setVehicleDamageProof ( vehicle, false ) 
                    outputChatBox ("Godmode-vehiculo desactivado", 255, 0, 0, true) 
                else 
                    fixVehicle (vehicle) 
                    setVehicleDamageProof ( vehicle, true ) 
                    outputChatBox ("Godmode-vehiculo activado", 0, 255, 0, true) 
            end 
        else  
        outputChatBox("No estas en un vehiculo!", 255, 0, 0) 
        end 
end 
  
--[[ ------------------- ]] 

Me ayudan? :)

Link to comment

Es getRootElement la parte onClientGUIClick, pero solo con poner root basta

addEventHandler("onClientGUIClick", root,  

eso y ya

la otra es que esto no es nesesario

resourceRoot = getResourceRootElement(getThisResource()) 

con poner root y resourceRoot, el MTA los lee como getRootElement y getResourceRootElement(getThisResource())

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...