Jump to content

therenex

Members
  • Posts

    48
  • Joined

  • Last visited

Everything posted by therenex

  1. i'm passing 'source' to the triggerFor argument, but still not working
  2. Niiiiiiiice :B Thanks! ^^ This caused me a lot of headaches, because when someone clicked on a GUI element for another player, server crashed.
  3. i have a new problem... can you help me? : D I'd updated the first post.
  4. Hey guys! Well, i solved the crashing server problem. But now i have another prob: GUI changes (like hiding or showing windows) are synced for all the players, not for the local only, like it should be. D: ! local rootElement = getRootElement() function aRegister ( localPlayerName, username_register , password_register) if ( password_register ~= nil ) then if ( string.len ( password_register ) < 4 ) then outputChatBox ( "Tu clave de acceso debe tener al menos cuatro caracteres.", localPlayerName, 243, 0, 0 ) elseif ( addAccount ( username_register , password_register ) ) then local theAccount = getAccount ( username_register ) outputChatBox ( "Bienvenido a Drift City, '"..username_register..", Recuerda tu clave: '"..password_register.."'", localPlayerName, 109, 243, 0 ) outputChatBox ( "Por razones de seguridad, debes loguearte. Por favor logueate para continuar.", localPlayerName, 109, 243, 0 ) setAccountData ( theAccount, "dc.listo", 0 ) setAccountData ( theAccount, "dc.auto", 0 ) setAccountData ( theAccount, "dc.dinero", 20000 ) setAccountData ( theAccount, "dc.consecionario", 0 ) triggerClientEvent ( localPlayerName, "esconRegistro", getRootElement() ) elseif ( getAccount ( username_register ) ) then outputChatBox ( "Ya existe una cuenta con este nombre.", localPlayerName, 243, 0, 0 ) else outputChatBox ( "Error desconocido. Contacta a un administrador.", localPlayerName, 243, 0, 0 ) end else outputChatBox ( "Debes escribir una clave de acceso!", localPlayerName, 243, 0, 0 ) end end addEvent("onRegister", true) addEventHandler("onRegister", getRootElement(), aRegister) function aLogin (localplayername, username_login , password_login ) if ( password_login ~= nil ) then if ( string.len ( password_login ) < 4 ) then outputChatBox ( "Tu clave de acceso debe ser de mas de cuatro caracteres.", localplayername, 243, 0, 0) elseif (getAccount (username_login, password_login) ) then local theAccount = getAccount (username_login, password_login) if (theAccount) then local playerlogin = logIn (source, theAccount, password_login) if (playerlogin) then setElementData ( source, "username", username_login ) setElementData ( source, "password", password_login ) outputChatBox ( "Bienvenido a Drift City, "..username_login.."!", localplayername, 109, 243, 0 ) triggerClientEvent ( localplayername, "esconLogin", getRootElement() ) local dinero = getAccountData ( theAccount, "dc.dinero" ) setPlayerMoney ( source, dinero ) local status = getAccountData ( theAccount, "dc.listo" ) local consecionario = getAccountData ( theAccount, "dc.consecionario" ) local vehiculo = getAccountData ( theAccount, "dc.auto" ) if ( status == "0" ) then outputChatBox ( "Asi que eres nuevo por aqui, eh?", localplayername, 109, 243, 0 ) outputChatBox ( "Vas a necesitar un auspiciador para iniciarte.", localplayername, 109, 243, 0 ) outputChatBox ( "Elige un consecionario y comenzemos de una vez.", localplayername, 109, 243, 0 ) triggerClientEvent ( "abrirCons", getRootElement() ) elseif ( status == "1" ) then spawnPlayer ( source, 0, 0, 0 ) outputChatBox ( "Bienvenido de vuelta!", source, 109, 243, 0 ) local color = getAccountData ( theAccount, "dc.autocolor" ) if ( consecionario == "grotti" ) then local auto = createVehicle ( vehiculo, 554.3156, -1278.9517, 22.0508 ) setVehicleColor ( auto, color, color ) setVehicleDamageProof ( auto, true ) warpPlayerIntoVehicle ( source, auto ) elseif ( consecionario == "autobahn" ) then local auto = createVehicle ( vehiculo, 2135.6921, 1409.2946, 13.6231 ) setVehicleColor ( auto, color, color ) setVehicleDamageProof ( auto, true ) warpPlayerIntoVehicle ( source, auto ) elseif ( consecionario == "wang" ) then local auto = createVehicle ( vehiculo, -1933.7096, 271.9773, 45.6677 ) setVehicleColor ( auto, color, color ) setVehicleDamageProof ( auto, true ) warpPlayerIntoVehicle ( source, auto ) end end end end elseif (theAccount ~= getAccount (username_login, password_login) ) then outputChatBox ( "Contrasena erronea!", localplayername, 243, 0, 0 ) else outputChatBox ( "Esa cuenta no existe!", localplayername, 243, 0, 0 ) end else outputChatBox ( "Debes escribir usuario y contrasena!", localplayername, 243, 0, 0 ) end end addEvent("onLogin", true) addEventHandler("onLogin", getRootElement(), aLogin) --Funciones de Consecionarios function defGrotti ( localPlayerName ) local nombre = getElementData ( source, "username" ) local theAccount = getAccount ( nombre ) setAccountData ( theAccount, "dc.consecionario", "grotti" ) triggerClientEvent ( "esconCons", localPlayerName ) triggerClientEvent ( "abrirConsGrotti", localPlayerName ) end addEvent ( "definirGrotti", true ) addEventHandler ( "definirGrotti", getRootElement(), defGrotti ) function defAutobahn ( localPlayerName ) local nombre = getElementData ( source, "username" ) local theAccount = getAccount ( nombre ) setAccountData ( theAccount, "dc.consecionario", "autobahn" ) triggerClientEvent ( "esconCons", localPlayerName ) triggerClientEvent ( "abrirConsAutobahn", localPlayerName ) end addEvent ( "definirAutobahn", true ) addEventHandler ( "definirAutobahn", getRootElement(), defAutobahn ) function defWang ( localPlayerName ) local nombre = getElementData ( source, "username" ) local theAccount = getAccount ( nombre ) setAccountData ( theAccount, "dc.consecionario", "wang" ) triggerClientEvent ( "esconCons", localPlayerName ) triggerClientEvent ( "abrirConsWang", localPlayerName ) end addEvent ( "definirWang", true ) addEventHandler ( "definirWang", getRootElement(), defWang ) --Funciones de Vehículos --GROTTI --Sentinel function defGrottiSentinel ( localPlayerName ) local nombre = getElementData ( source, "username" ) local theAccount = getAccount ( nombre ) setAccountData ( theAccount, "dc.auto", 405 ) setAccountData ( theAccount, "dc.listo", 1 ) local color = randInt ( 0, 125 ) setAccountData ( theAccount, "dc.autocolor", color ) triggerClientEvent ( "esconConsCualq", localPlayerName ) outputChatBox ( "Hemos terminado. Reconectate y logueate!", localPlayerName, 109, 243, 0 ) end addEvent ( "definirGrottiSentinel", true ) addEventHandler ( "definirGrottiSentinel", getRootElement(), defGrottiSentinel ) --Primo function defGrottiPrimo ( localPlayerName ) local nombre = getElementData ( source, "username" ) local theAccount = getAccount ( nombre ) setAccountData ( theAccount, "dc.auto", 547 ) setAccountData ( theAccount, "dc.listo", 1 ) local color = randInt ( 0, 125 ) setAccountData ( theAccount, "dc.autocolor", color ) triggerClientEvent ( "esconConsCualq", localPlayerName ) outputChatBox ( "Hemos terminado. Reconectate y logueate!", localPlayerName, 109, 243, 0 ) end addEvent ( "definirGrottiPrimo", true ) addEventHandler ( "definirGrottiPrimo", getRootElement(), defGrottiPrimo ) --Elegant function defGrottiElegant ( localPlayerName ) local nombre = getElementData ( source, "username" ) local theAccount = getAccount ( nombre ) setAccountData ( theAccount, "dc.auto", 507 ) setAccountData ( theAccount, "dc.listo", 1 ) local color = randInt ( 0, 125 ) setAccountData ( theAccount, "dc.autocolor", color ) triggerClientEvent ( "esconConsCualq", localPlayerName ) outputChatBox ( "Hemos terminado. Reconectate y logueate!", localPlayerName, 109, 243, 0 ) end addEvent ( "definirGrottiElegant", true ) addEventHandler ( "definirGrottiElegant", getRootElement(), defGrottiElegant ) --AUTOBAHN --Infernus function defAutobahnInfernus ( localPlayerName ) local nombre = getElementData ( source, "username" ) local theAccount = getAccount ( nombre ) setAccountData ( theAccount, "dc.auto", 411 ) setAccountData ( theAccount, "dc.listo", 1 ) local color = randInt ( 0, 125 ) setAccountData ( theAccount, "dc.autocolor", color ) triggerClientEvent ( "esconConsCualq", localPlayerName ) outputChatBox ( "Hemos terminado. Reconectate y logueate!", localPlayerName, 109, 243, 0 ) end addEvent ( "definirAutobahnInfernus", true ) addEventHandler ( "definirAutobahnInfernus", getRootElement(), defAutobahnInfernus ) --Cheetah function defAutobahnCheetah ( localPlayerName ) local nombre = getElementData ( source, "username" ) local theAccount = getAccount ( nombre ) setAccountData ( theAccount, "dc.auto", 415 ) setAccountData ( theAccount, "dc.listo", 1 ) local color = randInt ( 0, 125 ) setAccountData ( theAccount, "dc.autocolor", color ) triggerClientEvent ( "esconConsCualq", localPlayerName ) outputChatBox ( "Hemos terminado. Reconectate y logueate!", localPlayerName, 109, 243, 0 ) end addEvent ( "definirAutobahnCheetah", true ) addEventHandler ( "definirAutobahnCheetah", getRootElement(), defAutobahnCheetah ) --Banshee function defAutobahnBanshee ( localPlayerName ) local nombre = getElementData ( source, "username" ) local theAccount = getAccount ( nombre ) setAccountData ( theAccount, "dc.auto", 429 ) setAccountData ( theAccount, "dc.listo", 1 ) local color = randInt ( 0, 125 ) setAccountData ( theAccount, "dc.autocolor", color ) triggerClientEvent ( "esconConsCualq", localPlayerName ) outputChatBox ( "Hemos terminado. Reconectate y logueate!", localPlayerName, 109, 243, 0 ) end addEvent ( "definirAutobahnBanshee", true ) addEventHandler ( "definirAutobahnBanshee", getRootElement(), defAutobahnBanshee ) --WANG --Jester function defWangJester ( localPlayerName ) local nombre = getElementData ( source, "username" ) local theAccount = getAccount ( nombre ) setAccountData ( theAccount, "dc.auto", 559 ) setAccountData ( theAccount, "dc.listo", 1 ) local color = randInt ( 0, 125 ) setAccountData ( theAccount, "dc.autocolor", color ) triggerClientEvent ( "esconConsCualq", localPlayerName ) outputChatBox ( "Hemos terminado. Reconectate y logueate!", localPlayerName, 109, 243, 0 ) end addEvent ( "definirWangJester", true ) addEventHandler ( "definirWangJester", getRootElement(), defWangJester ) --Sultan function defWangSultan ( localPlayerName ) local nombre = getElementData ( source, "username" ) local theAccount = getAccount ( nombre ) setAccountData ( theAccount, "dc.auto", 560 ) setAccountData ( theAccount, "dc.listo", 1 ) local color = randInt ( 0, 125 ) setAccountData ( theAccount, "dc.autocolor", color ) triggerClientEvent ( "esconConsCualq", localPlayerName ) outputChatBox ( "Hemos terminado. Reconectate y logueate!", localPlayerName, 109, 243, 0 ) end addEvent ( "definirWangSultan", true ) addEventHandler ( "definirWangSultan", getRootElement(), defWangSultan ) --Elegy function defWangElegy ( localPlayerName ) local nombre = getElementData ( source, "username" ) local theAccount = getAccount ( nombre ) setAccountData
  5. functions are case-sensitive, so function must be logIn , not login.
  6. im not going to do this anymore. if you want, just close the topic.
  7. ok im trying to do a script with just this, as a gamemode. this is what i have: Client function joinHandler(player) fadeCamera ( true ) --create our button btnOutput = guiCreateButton( 0.7, 0.1, 0.2, 0.1, "Loguear", true ) --Create an edit box and define it as "editBox". usernameBox = guiCreateEdit( 0.3, 0.1, 0.4, 0.1, "Usuario", true ) passwordBox = guiCreateEdit( 0.3, 0.2, 0.4, 0.1, "Password", true ) guiEditSetMaxLength ( usernameBox, 128 ) --the max chatbox length is 128, so force this guiEditSetMaxLength ( passwordBox, 128 ) --the max chatbox length is 128, so force this guiEditSetReadOnly ( usernameBox, false ) guiEditSetReadOnly ( passwordBox, false ) --setup our function to output the message to the chatbox function outputEditBox (button) local user = guiGetText ( usernameBox )--get the text from the edit box local pass = guiGetText ( passwordBox )--get the text from the edit box outputChatBox ( "..." ) triggerServerEvent ( "loginEvent", getLocalPlayer(), getLocalPlayer(), user, pass ) end --and attach our button to the outputEditBox function addEventHandler ( "onClientGUIClick", btnOutput, outputEditBox ) end addEventHandler('onClientPlayerJoin', getRootElement(), joinHandler) Server addEvent ( "loginEvent", true ) addEventHandler ( "loginEvent", getRootElement(), logIn ) now i dont see anything on the screen! damn this sounds so lame.
  8. i tried that but nothing happens =/ just... nothing, i dont even get anything with debugscript or in console...
  9. therenex

    Account GUI

    Hey guys! I wanna know if it is possible to do a login gui, i have something like this, client-side: function joinHandler(player) --boton de logueo botonLogin = guiCreateButton( 0.7, 0.1, 0.2, 0.1, "Loguear", true ) --creacion de cajas de escritura usernameBox = guiCreateEdit( 0.3, 0.1, 0.4, 0.1, "Usuario", true ) passwordBox = guiCreateEdit( 0.3, 0.2, 0.4, 0.1, "Password", true ) guiEditSetReadOnly ( usernameBox, false ) guiEditSetReadOnly ( passwordBox, false ) --funcion de logueo function loginUser ( button ) local user = guiGetText ( usernameBox ) --obtener usuario local pass = guiGetText ( passwordBox ) --obtener contraseña logIn ( user, pass ) -- loguear end --and attach our button to the outputEditBox function addEventHandler ( "onClientGUIClick", botonLogin, loginUser ) end I know that logIn is a server-side function, so i want to know what should i do to make possible the login with this GUI. Its based on the example of "guiCreateEdit". What happens if i create an event on server-side script called loginEvent, i make an event handler for it with the function logIn and then i use triggerServerEvent on the clientside script? it would work?
  10. one thing is not being very good at english, and another one being a complete lamer in english. take classes or something. you need them. everyone needs them.
  11. adding the argument to the doSpawn function doesnt fix anything, it stills showing the gay black screen. and about the teleports and tables, im making them sa-mp style, before learning more about lua, im starting with basics things. this script worked, i dunno why is fuckd up now D: dont think im a pro or something lol >.<
  12. i pasted my code and it didnt show :wtf: the problem is that my players doesnt spawn, they only see that fkin black screen. http://therenex.pastebin.com/f4ef3ae88 there's the code can you tell me whats the mistake
  13. mmm dont care. i have a bigger problem with my script and i need to fix it before starting with the dm.
  14. i know about lua, im making a freeroam now, but damn i dont got how to make it work... i tried with somehting like local dmMode = {} and i did all the commands and shit but they dont work -.-
  15. therenex

    Gotocar

    you should do something like player2 = getPlayerFromNick ( player2nick) because you arent specifying what is player2 . well it does need alot more of code, this even needs some 'end's...
  16. i want to make a 'dm' mode, i did this in sa:mp, now i want to do it in lua, but seems to work different. for example, at joining players arent in dm mode, but when they type /dm the deathmatch mode is activated: their weapons are removed, theyre teleported to a special island and when they die, they appear again in that island. so if now they type /dmoff they get spawned normally and everything runs normally (they weps are back and when they die they spawn normally again). if you want i can post how i did it on pawn. thanks
  17. therenex

    Freeroam?

    interesting... lol thx
  18. therenex

    Freeroam?

    btw, how broph works? i cant loadit as a map, i cant load it as a gamemode. what the hell i do?
  19. maybe you should define something as your root element. gamemode_root = getRootElement() so instead of using getRootElement() on your codes, put gamemode_root.
  20. umm Max... it seems that you're a little bit angry. but that doesnt mean that we must hear you saying all that sh*t and being so idiot with people that wants to help you. if you dont get help, dont ask why. btw, i have the same problem
  21. mmm hold the secondary button of the mouse to toggle driveby
  22. ummm if you put playerSource in the first outputChatBox only he will see the message... just change "playerSource" by "getRootElement()". That should work.
  23. hi guys i have a little question... where i should put my installSabre function? (it installs a vehicle mod called "super sabre") function installSabre() txd = engineLoadTXD ( "sabre.txd" ) engineImportTXD ( txd, 475 ) dff = engineLoadDFF ( "sabre.dff", 475 ) engineReplaceModel ( dff, 475 ) end i mean, in what event ? thanks i have it on the onClientPlayerSpawn function, but it installs the sabre everytime someone joins or spawn... if someone joins after the installSabre function is executed, he will see the sabre? or this function needs to be called everytime any player should see the new car? when im on the sabre, and someone joins, mta expulses me from the car D:
×
×
  • Create New...