Jump to content

[HELP]addcommandhandler


Recommended Posts

failed

the code is right?

local x, y = guiGetScreenSize ( ) 
local player = getLocalPlayer()
 
--Define el color de tu team aquí en R,G,B
CR,CG,CB = 0,255,255
 
--Define el color de tu team en HEX
hexTeamColor = "#00ffff"
 
--
alphaDefaul=200
teamColor = tocolor ( CR, CG, CB, alphaDefaul )
--
mute = "#00ff00*#ffffff"
kick = "#ffff00**#ffffff"
ban = "#ff0000***#ffffff"
--
mapper = "#00ff00*#ffffff"
scripter = "#ffff00*#ffffff"
leader = "#ff0000*#ffffff"
owner = "#0000ff*#ffffff"
--
 
-----------
--Español--
-----------
 
btMessES = "Panel de Informacion"
    --Reglas
ReglasES = "Reglas"
reglasListES =   mute.."NO hacer publicidad. \n"..
                 (mute.."NO insultar a los administradores o moderadores. \n")..
                 (ban.."NO usar hack.\n")..
                 (kick.."Respetar a los demas jugadores.\n")..
                 (mute.."NO pedir mapas.\n")..
                 (mute.."NO pedir 'Test'.\n")..
                 (ban.."NO usar el TAG de el team sin autorizacion.\n")..
                 (mute.."NO publicar IP de otros servidores.\n")..
                 (kick.."NO usar binds repetitivamente.\n")..
                 (ban.."NO usar una falsa identidad.\n")
 
    --Team
TeamES = "Equipo"
teamLevelES = mapper.."Mapper    "..scripter.."Scripter   "..leader.."Lider     "..owner.."Fundadores"
 
    --Server
    ServerES = "Servidor"
    infoServerES = hexTeamColor.."Informacion sobre el Servidor#ffffff\n"..
               ("   \n")..
               ("   \n")..
               ("   \n")..
               ("   \n")..
               ("\n")..
               (hexTeamColor.."Desarrollo del Servidor#ffffff\n")..
               ("   \n")..
               ("   \n")..
               ("   \n")
    infoScripterES = "¿Necesitas Scripter? Contactame a mi Skype: geek1997"
 
-----------
--English--
-----------
 
btMessEN = "Information Panel"
    --Reglas
ReglasEN = "Rules"
reglasListEN =   mute.."NO advertising. \n"..
                 (mute.."NOT insult the administrators or moderators. \n")..
                 (ban.."DO NOT use hack.\n")..
                 (kick.."Respect other players.\n")..
                 (mute.."NO ask for maps.\n")..
                 (mute.."NO ask for 'Test'.\n")..
                 (ban.."NO TAG team use without permission.\n")..
                 (mute.."NO other servers IP post.\n")..
                 (kick.."NO binds repeatedly use.\n")..
                 (ban.."DO NOT use a false identity.\n")
 
    --Team
TeamEN = "Team"
teamLevelEN = mapper.."Mapper    "..scripter.."Scripter   "..leader.."Leader     "..owner.."Owner"
 
    --Server
ServerEN = "Server"
infoServerEN = hexTeamColor.."Server Information#ffffff\n"..
                ("\n")..
               ("\n")..
               ("\n")..
               ("\n")..
               ("\n")..
               (hexTeamColor.."Development server#ffffff\n")..
               ("   \n")..
               ("   \n")..
               ("\n")
infoScripterEN = "Need Scripter? Contact me at my Skype: geek1997"
 
---------------------
--Variables default--
---------------------
    btMess = btMessES
    --Reglas--
    Reglas = ReglasES
    reglasList = reglasListES
    reglasLevel = mute.."Mute    "..kick.."Kick    "..ban.."Ban"
 
    --Team--
    Team = TeamES
    teamList1 = "Olkase   "..mapper..leader.."\n"..
               ("Player2   \n")..
               ("Player3   \n")..
               ("Player4   \n")..
               ("Player5   \n")..
               ("   \n")..
               ("   \n")..
               ("   \n")..
               ("   \n")..
               ("   \n")
 
    teamList2 = "Player6   \n"..
               ("Player7   \n")..
               ("Player8   \n")..
               ("Player9   \n")..
               ("   \n")..
               ("   \n")..
               ("   \n")..
               ("   \n")..
               ("   \n")..
               ("   \n")
 
    teamLevel = teamLevelES
 
    --Server--
    Server = ServerES
    infoServer = infoServerES
    infoScripter = infoScripterES
 
    --Color Down Bar--
    rR,gR,bR = 0,0,0
    rT,gT,bT = 0,0,0
    rS,gS,bS = 0,0,0
 
    alphaR = 200
    alphaT = 200
    alphaS = 200
 
function main(key, keyState)
    showCursor(true)
    removeEventHandler("onClientRender", getRootElement(), contenido)
    removeEventHandler("onClientRender", getRootElement(), window)
    removeEventHandler("onClientRender", getRootElement(), contReglas)
    removeEventHandler("onClientRender", getRootElement(), contTeam)
    removeEventHandler("onClientRender", getRootElement(), contServer)
    start = getTickCount()
    addEventHandler ( "onClientRender", getRootElement(), window )
    setTimer ( function()
        guiIdiomas()
        guiContenido()
        addEventHandler ( "onClientRender", getRootElement(), contenido )
        addEventHandler ( "onClientRender", getRootElement(), contReglas )
    end, 1500, 1 )
 
end
 
addCommandHandler('info',
    function (      )
        guiSetVisible ( gElement,true );
    end
);
 
 
function guiIdiomas()
    ancho = 600
    alto = 520
 
    midAncho = ancho/2
    midAlto = alto/2
 
    medX = x/2
    medY = y/2
 
    cantBot = 2
 
    botScale = 20
    botSpace = (botScale*cantBot)+(5*cantBot)
 
    alphaEs = 100
    alphaEn = 100
    alphaQuit = 200
 
    es = guiCreateButton(medX+midAncho-botSpace, medY-midAlto+5, botScale, botScale, "EN", false)
        addEventHandler("onClientGUIClick",es,onClickES)
        addEventHandler( "onClientMouseEnter",es,onEnterES)
        addEventHandler("onClientMouseLeave",es,onLeaveES)
    en = guiCreateButton(medX+midAncho-botSpace+botScale+5, medY-midAlto+5, botScale, botScale, "ES", false)
        addEventHandler("onClientGUIClick",en,onClickEN)
        addEventHandler( "onClientMouseEnter",en,onEnterEN)
        addEventHandler("onClientMouseLeave",en,onLeaveEN)
 
    quit = guiCreateButton(medX+midAncho-botSpace+botScale+5, medY-midAlto-25, 25, 25, "Quit", false)
        addEventHandler("onClientGUIClick",quit,onClickQuit)
        addEventHandler( "onClientMouseEnter",quit,onEnterQuit)
        addEventHandler("onClientMouseLeave",quit,onLeaveQuit)
 
    guiSetAlpha(en, 0)
    guiSetAlpha(es, 0)
    guiSetAlpha(quit, 0)
 
end
 
function guiContenido()
    sizeX = ancho/3
    sizeY = 40
 
    mitSize = sizeX*0.5
 
    botX = medX-mitSize
    botY = medY+midAlto-sizeY
 
    reglas = guiCreateButton(botX-sizeX , botY, sizeX, sizeY, "Reglas", false)
        addEventHandler("onClientGUIClick",reglas,onClickReglas)
        addEventHandler( "onClientMouseEnter",reglas,onEnterReglas)
        addEventHandler("onClientMouseLeave",reglas,onLeaveReglas)
    team = guiCreateButton(botX, botY, sizeX, sizeY, "Equipo", false)
        addEventHandler("onClientGUIClick",team,onClickTeam)
        addEventHandler( "onClientMouseEnter",team,onEnterTeam)
        addEventHandler("onClientMouseLeave",team,onLeaveTeam)
    server = guiCreateButton(botX+sizeX, botY, sizeX, sizeY, "Servidor", false)
        addEventHandler("onClientGUIClick",server,onClickServer)
        addEventHandler( "onClientMouseEnter",server,onEnterServer)
        addEventHandler("onClientMouseLeave",server,onLeaveServer)
 
    guiSetAlpha(reglas, 0)
    guiSetAlpha(team, 0)
    guiSetAlpha(server, 0)
end
 
function window()
    ancho = 600
    alto = 520
 
    btAncho = 600
    btAlto = 25
 
    local now = getTickCount()
    local elapsedTime = now - start
    local endTime = start + 1500
    local duration = endTime - start
    local progress = elapsedTime / duration
    local x1, y1, z1 = interpolateBetween ( 0, 0, 0, ancho, alto, 255, progress, "OutBounce")
    local x2, y2, z2 = interpolateBetween ( 0, 0, 0, btAncho, btAlto, 200, progress, "OutBounce")
 
    posx = (x/2)-(x1/2)
    posy =
Link to comment

WTF??

addCommandHandler('info', 
    function (      ) 
        guiSetVisible ( gElement,true ); 
    end 
); 
  

Use it (Don't add " ; " ).

addCommandHandler('info', 
    function (      ) 
        guiSetVisible ( gElement,true ) 
    end 
) 

Link to comment
WTF??
addCommandHandler('info', 
    function (      ) 
        guiSetVisible ( gElement,true ); 
    end 
); 
  

Use it (Don't add " ; " ).

addCommandHandler('info', 
    function (      ) 
        guiSetVisible ( gElement,true ) 
    end 
) 

Do you think this is problem? Tell me why.

Link to comment
WTF??
addCommandHandler('info', 
    function (      ) 
        guiSetVisible ( gElement,true ); 
    end 
); 
  

Use it (Don't add " ; " ).

addCommandHandler('info', 
    function (      ) 
        guiSetVisible ( gElement,true ) 
    end 
) 

Do you think this is problem? Tell me why.

As far as I know in scripts can not be used ";" I've never seen a mta script that uses the ";".

Edited by Guest
Link to comment
WTF??
addCommandHandler('info', 
    function (      ) 
        guiSetVisible ( gElement,true ); 
    end 
); 
  

Use it (Don't add " ; " ).

addCommandHandler('info', 
    function (      ) 
        guiSetVisible ( gElement,true ) 
    end 
) 

Do you think this is problem? Tell me why.

As far as I know in scripts can not be used "" I've never seen a mta script that uses the ";".

Doesn't matter it'll work anyways .

Link to comment

ex:

local wnd = guiCreateWindow ( 0, 0, 0.5, 0.4, "Information", true ) 
  
addCommandHandler('info', -- the command for open the window 
    function (      ) 
        guiSetVisible ( wnd,true ); -- gElement = the window 
    end 
); 
  

wnd = the window that you made it.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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