Jump to content

Flipi

Members
  • Posts

    321
  • Joined

  • Last visited

Everything posted by Flipi

  1. Flipi

    help

    thanks TAPL !
  2. Flipi

    help

    How I can add function of number of player in the server in automatic message from my script? local msgs = { '* welcome!', '* name server!', '* register and login!', '[u][i][b]* players online '..getPlayerCount()..' in the server[/b][/i][/u]' } setTimer( function() outputChatBox( msgs[math.random( 1, #msgs )], root, 255, 255, 255, true ) end, 25000, 0 )
  3. Flipi

    help

    hi, how to add a message that says the number of players on the server? local msgs = { '* welcome!', '* name server!', '* register and login!' } setTimer( function() outputChatBox( msgs[math.random( 1, #msgs )], root, 255, 255, 255, true ) end, 25000, 0 ) function that can be used is this? : ..getPlayerCount()..
  4. Flipi

    ayuda

    claro nose si me entiendes
  5. Flipi

    ayuda

    si pero si te fijas esta separado, lo que hace que se descordine y si lo modifico con el mismo tiempo de enviar los mensajes salen 2 juntos, la idea era que perteneciera a la tabla de local msgs local msgs = { '* bienvenido!', '* registrate!', '* logeate!' } setTimer( function() outputChatBox( msgs[math.random( 1, #msgs )], root, 255, 255, 255, true ) end, 25000, 0 ) function playerOn() ----[Esta es la funcion]---- [ESTA SEPARADO DEL PRIMERO] outputChatBox ('* Jugadores online: '..getPlayerCount()..' estan conectados!',getRootElement(),255,255,255,true) end setTimer(playerOn, 32000, 0)
  6. Flipi

    ayuda

    es que lo hacia aparte, el local msgs enviaba sus mensajes en el chatbox y el PlayerOn tambien pero el problema es que se descoordinaban, y al ponerlos al mismo tiempo se enviaban los 2 al mismo tiempo en el chatbox, por eso queria agregarlo al local msgs para que no ocurriera eso.
  7. Flipi

    ayuda

    aun me dice que hay 0 jugadores, yo creo que deberia ir unido a una función aparte, pero nose como hacerlo
  8. Flipi

    ayuda

    no funciona, en el chatbox aparece "* jugadores online: 0 estan conectados!" se supone que tendría que mostrar que estoy conectado..
  9. Flipi

    ayuda

    si se, la cosa es que al ponerlo en el local msgs = no funciona (no muestra la cantidad de players en el server)
  10. Flipi

    ayuda

    aca esta: "flipi" description="automensaje" type="script" version="1.3.3" />
  11. Flipi

    ayuda

    Creo que se refiere a añadir su outputChatBox a la tabla. local msgs = { '* bienvenido!', '* registrate!', '* logeate!' , '* Jugadores online: '..getPlayerCount()..' estan conectados!'} setTimer( function() outputChatBox( msgs[math.random( 1, #msgs )], root, 255, 255, 255, true ) end, 25000, 0 ) Asegúrate de que sea server-side. Claro eso mismo, pero el hecho es que al ponerlo no funciona (en el outputChatBox se muestra el mensaje jugadore online, pero no da el "numero" de jugadores conectados) [si esta en server-side]
  12. Flipi

    ayuda

    quiero que este mensaje :"* Jugadores online: '..getPlayerCount()..' estan conectados!" funcione al ponerlo en la tabla (local msgs = { '* bienvenido!', '* registrate!', '* logeate!' }), yo lo hice, pero no me funcionaba la parte del "getPlayerCount" (números de jugadores conectados en el server)..
  13. Flipi

    ayuda

    Hola, me gustaría saber como agregar esta función (playerOn) a la tabla de mensajes. local msgs = { '* bienvenido!', '* registrate!', '* logeate!' } setTimer( function() outputChatBox( msgs[math.random( 1, #msgs )], root, 255, 255, 255, true ) end, 25000, 0 ) function playerOn() ----[[i]Esta es la funcion[/i]]---- outputChatBox ('* Jugadores online: '..getPlayerCount()..' estan conectados!',getRootElement(),255,255,255,true) end setTimer(playerOn, 32000, 0)
  14. Flipi

    Edit

    @flipi prueba haciendo esto agregale esto haber.. function funcion ( ) fadeCamera(false,0,0,0,0) outputChatBox("Prueba") end addEventHandler("onClientResourceStart", resourceRoot, funcion) si funciona bien y si solo funciona el outputchatbox debe ser un error de la línea fadeCamera En que parte agrego eso? (en que linea)
  15. Flipi

    Edit

    Hola, tengo un problema con este script de logeo y registro, la cosa es que se supone que al iniciar la pantalla tiene que quedar en negro cuando uno ingresa al servidor y solo se ve el panel de registro, lo cual este no realiza... wdwLogin_Pannel = {} tabPannel_Main = {} tab_Login = {} tab_Register = {} blackLoginScreen = true blackScreenTime = 5 GuestEnable = true function open_log_reg_pannel() if not(isElement(wdwLogin_Pannel)) then if blackLoginScreen == true then fadeCamera(false,0,0,0,0) end local sWidth,sHeight = guiGetScreenSize() local Width,Height = 473,284 local X = (sWidth/2) - (Width/2) local Y = (sHeight/2) - (Height/2) wdwLogin_Pannel = guiCreateWindow(X,Y,Width,Height,"Panel de Registro",false) guiWindowSetSizable(wdwLogin_Pannel,false) tabPannel_Main = guiCreateTabPanel(9,23,455,251,false,wdwLogin_Pannel) tab_Login = guiCreateTab("Login",tabPannel_Main) lbl_Login = guiCreateLabel(103,72,42,19,"Login:",false,tab_Login) guiLabelSetVerticalAlign(lbl_Login,"center") guiLabelSetHorizontalAlign(lbl_Login,"right",false) guiSetFont(lbl_Login,"default-bold-small") edit_Login = guiCreateEdit(156,72,169,23,"",false,tab_Login) edit_password = guiCreateEdit(156,106,169,23,"",false,tab_Login) guiEditSetMaxLength ( edit_Login,25) guiEditSetMaxLength ( edit_password,25) guiEditSetMasked ( edit_password, true ) lbl_Password = guiCreateLabel(48,106,96,19,"Password:",false,tab_Login) guiLabelSetVerticalAlign(lbl_Password,"center") guiLabelSetHorizontalAlign(lbl_Password,"right",false) guiSetFont(lbl_Password,"default-bold-small") lbl_top_info = guiCreateLabel(80,6,300,35,"Por favor escriba su nombre de usuario y password.",false,tab_Login) guiLabelSetColor(lbl_top_info,0,128,255) guiLabelSetVerticalAlign(lbl_top_info,"center") guiLabelSetHorizontalAlign(lbl_top_info,"center",false) lbl_about_legth = guiCreateLabel(142,42,184,18,"Max. de largo: 25 simbolos",false,tab_Login) guiLabelSetColor(lbl_about_legth,0,128,255) guiLabelSetVerticalAlign(lbl_about_legth,"center") guiLabelSetHorizontalAlign(lbl_about_legth,"center",false) checkbox_save = guiCreateCheckBox(329,110,100,20,"[Guardar]",false,false,tab_Login) guiSetFont(checkbox_save,"default-small") btn_Login = guiCreateButton(164,162,147,41,"Login",false,tab_Login) guiSetFont(btn_Login,"default-bold-small") login_tab_error_msg = guiCreateLabel(31,131,419,25,"Error_login_tab",false,tab_Login) guiLabelSetColor(login_tab_error_msg,255,0,0) guiLabelSetVerticalAlign(login_tab_error_msg,"center") guiLabelSetHorizontalAlign(login_tab_error_msg,"center",false) guiSetFont(login_tab_error_msg,"default-bold-small") if GuestEnable == true then btnGuest = guiCreateButton(29,168,94,32,"Jugar como Invitado",false,tab_Login) guiSetFont(btnGuest,"default-small") guiSetVisible(btnGuest,true) else if isElement(btnGuest) then guiSetVisible(btnGuest,false) end btnGuest = nil end tab_Register = guiCreateTab("Register",tabPannel_Main) lbl_account_name = guiCreateLabel(43,39,119,21,"Usuario:",false,tab_Register) guiLabelSetVerticalAlign(lbl_account_name,"center") guiLabelSetHorizontalAlign(lbl_account_name,"right",false) guiSetFont(lbl_account_name,"default-bold-small") lbl_reg_top_info = guiCreateLabel(66,5,364,31,"Por favor, rellene todos los campos! [No utilice \"!@#$\"%'^&*()\"]",false,tab_Register) guiLabelSetColor(lbl_reg_top_info,0,128,255) guiLabelSetVerticalAlign(lbl_reg_top_info,"center") guiLabelSetHorizontalAlign(lbl_reg_top_info,"center",false) edit_account_name = guiCreateEdit(172,40,176,23,"",false,tab_Register) guiEditSetMaxLength ( edit_account_name,25) lbl__reg_tab_password = guiCreateLabel(43,71,119,21,"Password:",false,tab_Register) guiLabelSetVerticalAlign(lbl__reg_tab_password,"center") guiLabelSetHorizontalAlign(lbl__reg_tab_password,"right",false) guiSetFont(lbl__reg_tab_password,"default-bold-small") edit__reg_tab_password = guiCreateEdit(172,71,176,23,"",false,tab_Register) guiEditSetMaxLength ( edit__reg_tab_password,25) edit__reg_tab_Repassword = guiCreateEdit(172,102,176,23,"",false,tab_Register) guiEditSetMaxLength ( edit__reg_tab_Repassword,25) lvl_reg_tab_Repassword = guiCreateLabel(43,102,119,21,"Repite la password:",false,tab_Register) guiLabelSetVerticalAlign(lvl_reg_tab_Repassword,"center") guiLabelSetHorizontalAlign(lvl_reg_tab_Repassword,"right",false) guiSetFont(lvl_reg_tab_Repassword,"default-bold-small") btn_reg_tab_register = guiCreateButton(153,161,174,42,"Confirma y registra!",false,tab_Register) guiSetFont(btn_reg_tab_register,"default-bold-small") reg_tab_error_msg = guiCreateLabel(66,129,364,31,"Error_reg_ttab",false,tab_Register) guiLabelSetColor(reg_tab_error_msg,255,20,0) guiLabelSetVerticalAlign(reg_tab_error_msg,"center") guiLabelSetHorizontalAlign(reg_tab_error_msg,"center",false) guiSetFont(reg_tab_error_msg,"default-bold-small") guiSetVisible(wdwLogin_Pannel,true) showCursor(true) guiSetText(reg_tab_error_msg, "") guiSetText(login_tab_error_msg, "") local username, password = loadLoginFromXML() if not( username == "" or password == "") then guiCheckBoxSetSelected ( checkbox_save, true ) guiSetText ( edit_Login, tostring(username)) guiSetText ( edit_password, tostring(password)) else guiCheckBoxSetSelected ( checkbox_save, false ) guiSetText ( edit_Login, tostring(username)) guiSetText ( edit_password, tostring(password)) end addEventHandler("onClientGUIClick",btn_Login,onClickBtnLogin) addEventHandler("onClientGUIClick",btn_reg_tab_register,onClickBtnRegister) if GuestEnable == true then addEventHandler("onClientGUIClick",btnGuest,onClickGuest) end end end function start_cl_resource() open_log_reg_pannel() end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),start_cl_resource) function loadLoginFromXML() local xml_save_log_File = xmlLoadFile ("files/xml/userdata.xml") if not xml_save_log_File then xml_save_log_File = xmlCreateFile("files/xml/userdata.xml", "login") end local usernameNode = xmlFindChild (xml_save_log_File, "username", 0) local passwordNode = xmlFindChild (xml_save_log_File, "password", 0) if usernameNode and passwordNode then return xmlNodeGetValue(usernameNode), xmlNodeGetValue(passwordNode) else return "", "" end xmlUnloadFile ( xml_save_log_File ) end function saveLoginToXML(username, password) local xml_save_log_File = xmlLoadFile ("files/xml/userdata.xml") if not xml_save_log_File then xml_save_log_File = xmlCreateFile("files/xml/userdata.xml", "login") end if (username ~= "") then local usernameNode = xmlFindChild (xml_save_log_File, "username", 0) if not usernameNode then usernameNode = xmlCreateChild(xml_save_log_File, "username") end xmlNodeSetValue (usernameNode, tostring(username)) end if (password ~= "") then local passwordNode = xmlFindChild (xml_save_log_File, "password", 0) if not passwordNode then passwordNode = xmlCreateChild(xml_save_log_File, "password") end xmlNodeSetValue (passwordNode, tostring(password)) end xmlSaveFile(xml_save_log_File) xmlUnloadFile (xml_save_log_File) end addEvent("saveLoginToXML", true) addEventHandler("saveLoginToXML", getRootElement(), saveLoginToXML) function resetSaveXML() local xml_save_log_File = xmlLoadFile ("files/xml/userdata.xml") if not xml_save_log_File then xml_save_log_File = xmlCreateFile("files/xml/userdata.xml", "login") end if (username ~= "") then local usernameNode = xmlFindChild (xml_save_log_File, "username", 0) if not usernameNode then usernameNode = xmlCreateChild(xml_save_log_File, "username") end end if (password ~= "") then local passwordNode = xmlFindChild (xml_save_log_File, "password", 0) if not passwordNode then passwordNode = xmlCreateChild(xml_save_log_File, "password") end xmlNodeSetValue (passwordNode, "") end xmlSaveFile(xml_save_log_File) xmlUnloadFile (xml_save_log_File) end addEvent("resetSaveXML", true) addEventHandler("resetSaveXML", getRootElement(), resetSaveXML) function onClickBtnLogin(button,state) if(button == "left" and state == "up") then if (source == btn_Login) then username = guiGetText(edit_Login) password = guiGetText(edit_password) if guiCheckBoxGetSelected ( checkbox_save ) == true then checksave = true else checksave = false end triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password,checksave) end end end function onClickBtnRegister(button,state) if(button == "left" and state == "up") then
  16. Flipi

    ayuda

    Te dejo un pequeño tutorial de tablas que te lo explica mas en profundidad: http://lua-users.org/wiki/TablesTutorial Wow gracias !!
  17. Flipi

    ayuda

    'math.random' devuelve un valor entre el primer y el segundo argumento que provees y tabla[index] sirve para seleccionar un valor de la tabla, ejemplo: t = {5, 6, 8, 7} print(t[1]) > 5 print( t[3] ) > 8 También, es útil saber que utilizar '#' devuelve el tamaño de una tabla o el largo de un string: t = { 5, 8, 4, 6, 9, 14, 'ola k ase' } print( #t ) > 7 print( #t[7] ) --El séptimo valor de la tabla es un string que contiene 'ola k ase'. > 9 Oh gracias por explicarme eso ! te pasaste c:
  18. Flipi

    ayuda

    ah ok, muchas gracias
  19. Flipi

    ayuda

    asi como lo puso alexs pero modificale 50000 a 300000 para que sean 5 mins en vez de 50s (50*60=300) Una pregunta en el [math.random(1, #msgs)], no tiene nada que ver con la cantidad de [local msgs = {....}] ?, la funcion que cumple es seleccionar 1 de todos los msgs? (gracias Alexs, Gamer y Solidsnake)
  20. Flipi

    ayuda

    como entonces?
  21. Flipi

    ayuda

    algo asi o no? local msg = math.random(1, #msg) mensaje = msg outputChatBox("Bienvenido", getRootElement(), 255, 255, 255, true ) outputChatBox("Registrate", getRootElement(), 255, 255, 255, true ) setTimer(msg,50000,0)
  22. Flipi

    ayuda

    hola, quisiera saber como hacer un script que cada 5 min. en el chat box envie diferentes mensajes de avisos o noticias, yo habia intentado hacer uno pero me enviaban todos juntos .. gracias
  23. Flipi

    Question

    Of course!, But it could be adapted according to each player to join the server... or something....
  24. Flipi

    Question

    Would it be possible to make a script to know the real climate of the city? (would have to use city codes and url of the page containing the climates or something?)...
×
×
  • Create New...