Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. GUIEditor_Window = {} GUIEditor_TabPanel = {} GUIEditor_Tab = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Checkbox = {} GUIEditor_Label = {} GUIEditor_Edit = {} addEventHandler("onClientResourceStart",resourceRoot, function() GUIEditor_Window[1] = guiCreateWindow(130,156,513,341,"GUI Login-Register By ElMota",false) GUIEditor_TabPanel[1] = guiCreateTabPanel(9,38,495,294,false,GUIEditor_Window[1]) GUIEditor_Tab[1] = guiCreateTab("Login",GUIEditor_TabPanel[1]) GUIEditor_Label[1] = guiCreateLabel(12,46,21,21,"Nick",false,GUIEditor_Tab[1]) guiLabelSetColor(GUIEditor_Label[1],200, 0, 0) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Edit[1] = guiCreateEdit(42,42,158,23,"",false,GUIEditor_Tab[1]) guiEditSetMaxLength(GUIEditor_Edit[1],22) GUIEditor_Label[2] = guiCreateLabel(8,113,63,19,"Contrase?a",false,GUIEditor_Tab[1]) guiLabelSetColor(GUIEditor_Label[2],200 ,0 ,0) guiSetFont(GUIEditor_Label[2],"default-bold-small") GUIEditor_Edit[2] = guiCreateEdit(75,108,134,26,"",false,GUIEditor_Tab[1]) guiEditSetMasked(GUIEditor_Edit[2],true) guiEditSetMaxLength(GUIEditor_Edit[2],10) GUIEditor_Button[1] = guiCreateButton(17,182,190,54,"Loggearme",false,GUIEditor_Tab[1]) guiSetFont(GUIEditor_Button[1],"sa-header") GUIEditor_Memo[1] = guiCreateMemo(260,25,222,108,"Favor Loggearse :\n\nPrivilegios de estar loggeado :\n\n- se te guardaran todos tus datos en mi sistema mySQL",false,GUIEditor_Tab[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) GUIEditor_Label[3] = guiCreateLabel(213,228,268,34,"GUI Creada por ElMota CopyRight 2011-2012 (c)",false,GUIEditor_Tab[1]) guiLabelSetColor(GUIEditor_Label[3],200,0,0) guiSetFont(GUIEditor_Label[3],"default-bold-small") GUIEditor_Checkbox[1] = guiCreateCheckBox(132,146,354,28,"Acepto los Terminos y Condiciones de este Servidor",false,false,GUIEditor_Tab[1]) guiSetFont(GUIEditor_Checkbox[1],"default-bold-small") GUIEditor_Checkbox[2] = guiCreateCheckBox(28,80,194,22,"Mostrar Contrase?a",false,false,GUIEditor_Tab[1]) guiSetFont(GUIEditor_Checkbox[2],"default-bold-small") GUIEditor_Tab[2] = guiCreateTab("Register",GUIEditor_TabPanel[1]) GUIEditor_Label[4] = guiCreateLabel(4,32,26,16,"Nick",false,GUIEditor_Tab[2]) guiLabelSetColor(GUIEditor_Label[4],200,0,0) guiSetFont(GUIEditor_Label[4],"default-bold-small") GUIEditor_Edit[3] = guiCreateEdit(35,23,176,30,"",false,GUIEditor_Tab[2]) guiEditSetMaxLength(GUIEditor_Edit[3],23) GUIEditor_Label[5] = guiCreateLabel(2,80,65,22,"Contrase?a",false,GUIEditor_Tab[2]) guiLabelSetColor(GUIEditor_Label[5],200,0,0) guiSetFont(GUIEditor_Label[5],"default-bold-small") GUIEditor_Edit[4] = guiCreateEdit(73,74,140,31,"",false,GUIEditor_Tab[2]) guiEditSetMasked(GUIEditor_Edit[4],true) guiEditSetMaxLength(GUIEditor_Edit[4],10) GUIEditor_Label[6] = guiCreateLabel(3,128,40,16,"e-mail",false,GUIEditor_Tab[2]) guiLabelSetColor(GUIEditor_Label[6],200,0,0) guiSetFont(GUIEditor_Label[6],"default-bold-small") GUIEditor_Edit[5] = guiCreateEdit(47,118,168,30,"",false,GUIEditor_Tab[2]) guiEditSetMaxLength(GUIEditor_Edit[5],20) GUIEditor_Button[2] = guiCreateButton(14,179,207,68,"Registrarme",false,GUIEditor_Tab[2]) guiSetFont(GUIEditor_Button[2],"sa-header") GUIEditor_Memo[2] = guiCreateMemo(243,17,240,128,"Recuerda antes De loggearte debes estar registrado aqui osino no podras jugar ^^ GUI Creada por ElMota (c)",false,GUIEditor_Tab[2]) guiMemoSetReadOnly(GUIEditor_Memo[2],true) GUIEditor_Checkbox[3] = guiCreateCheckBox(246,162,215,28,"Mostrar Contrase?a",false,false,GUIEditor_Tab[2]) guiSetFont(GUIEditor_Checkbox[3],"default-bold-small") GUIEditor_Checkbox[4] = guiCreateCheckBox(223,217,263,21,"Acepto los terminos y Condiciones de este server",false,false,GUIEditor_Tab[2]) guiSetFont(GUIEditor_Checkbox[4],"default-small") guiSetVisible(GUIEditor_Window[1], false) addEventHandler("onClientGUIClick", GUIEditor_Button[1], clientSubmitLogin, false) showTheGUI() end ) addEventHandler ( "onClientGUIClick", root, function ( ) if ( source == GUIEditor_Checkbox[1] ) then guiEditSetMasked ( GUIEditor_Edit[2], guiCheckBoxGetSelected ( source ) ) end end ) function showTheGUI() outputChatBox("Bienvenido a mi Servidor de MTA porfavor Loggeate.") -- if the GUI was successfully created, then show the GUI to the player if (GUIEditor_Window[1] ~= nil) then guiSetVisible(GUIEditor_Window[1], true) else -- if the GUI hasnt been properly created, tell the player outputChatBox("An unexpected error has occurred and the log in GUI has not been created.") end -- enable the players cursor (so they can select and click on the components) showCursor(true) -- set the input focus onto the GUI, allowing players (for example) to press 'T' without the chatbox opening guiSetInputEnabled(true) end function clientSubmitLogin ( button, state ) if ( button == "left" and state == "up" ) then local username = guiGetText(GUIEditor_Edit[1]) local password = guiGetText(GUIEditor_Edit[2]) -- if the username and password both exist if ( username and password ) then triggerServerEvent("submitLogin", localPlayer, username, password) guiSetInputEnabled(false) guiSetVisible(GUIEditor_Window[1], false) showCursor(false) else outputChatBox("Porfavor pon tu Nick y tu Contrase?a.") end end end
  2. 1: Did your script ever worked? because I got many errors in the client side. 2: You we're using 'client' argument, but you never triggered it. 3: You forgot about logIn function to login the player. -- client side: function createLoginWindow() -- define the X and Y positions of the window local X = 0.375 local Y = 0.375 -- define the width and height of the window local Width = 0.25 local Height = 0.25 -- create the window and save it's element value into the variable "wdwLogin" -- click on the function's name to read its documentation. wdwLogin = guiCreateWindow(X, Y, Width, Height, "Please login with your username and password", true) -- define new X and Y positions for the first label. X = 0.0825 y = 0.2 -- define new Width and Height values for the first label. Width = 0.25 Height = 0.25 -- create the first label, note the final argument passed is 'wdwLogin' meaning the window -- we created above is the parent of this label (so all the position and size values are now relative to the position of that window). guiCreateLabel (X, Y, Width, Height, "Username", true, wdwLogin) -- alter the Y value so the second label is slightly below the first. Y = 0.5 guiCreateLabel (X, Y, Width, Height, "password", true, wdwLogin) X = 0.415 Y = 0.2 Width = 0.5 Height = 0.15 edtUser = guiCreateEdit (X, Y, Width, Height, "", true, wdwLogin) Y = 0.5 edtPass = guiCreateEdit (X, Y, Width, Height, "", true, wdwLogin) -- set the maximum character length for the username and password fields to 50. guiEditSetMaxLength(edtUser, 50) guiEditSetMaxLength(edtPass, 50) X = 0.415 Y = 0.7 Width = 0.25 Height = 0.2 btnLogin = guiCreateButton(X, Y, Width, Height, "Log In", true, wdwLogin) -- attach the event onClientGUIClick to btnLogin and set it to trigger the 'clientSubmitLogin' function. addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin, false) -- make the window invisible guiSetVisible(wdwLogin, false) -- create the function and define the 'button' and 'state' parameters. -- (these are passed automatically by onClientGUIClick) end function clientSubmitLogin(button,state) -- if our login button was clicked with the left mouse button, and the state of the mousebutton is up: if button == "left" and state == "up" then -- get the text entered in the 'username' field. local username = guiGetText(edtUser) -- get the text entered in the 'password' field. local password = guiGetText(edtPass) -- if the username and password both exist: if ( username and password ) then -- trigger the server event 'submitLogin' and pass the username and password to it. triggerServerEvent("submitLogin", localPlayer, username, password) -- move the input focus back on the game (allowing players to move arround, open the chatbox, etc) guiSetInputEnabled(false) -- hide the window and all the components. guiSetVisible(wdwLogin, false) -- hide the mouse cursor. showCursor(false) else -- otherwise, output a message to the player, do not trigger the server -- and do not hide the gui. outputChatBox("please enter a username and password.") end end end -- attach the event handler to the root element of the resource. -- this means it will only trigger when it's own resource is started. addEventHandler("onClientResourceStart", resourceRoot, function () -- create the log in window and it's components. createLoginWindow() -- output a brief welcome message to the player outputChatBox("Welcome to BlackDeath's Alpha Server, Please log in with the login information provided to you") -- if the GUI was successfully created, then show the GUI to the player. if (wdwLogin ~= nil) then guiSetVisible(wdwLogin, true) else -- if the GUI hasn't been properly been created, tell the player. outputChatBox("An unexpected error has occurred and the login GUI has not been created.") end -- enable the players cursor (so that they can select and click on the components) showCursor(true) -- set the input focus onto the GUI, allowing players (for example) to press 'T' without the chatbox opening. guiSetInputEnabled(true) end ) -- server side: -- create our loginHandler function, with username and password parameters (passed from the client GUI). function loginHandler(username,password) -- check that the username and password are correct. local acc = getAccount(username, password) -- the player has succesfully logged in, so spawn them. if (acc) then logIn ( source, acc, password ) spawnPlayer (source, 1959.55, -1714.46, 10) fadeCamera(source, true) setCameraTarget(source) outputChatBox("Enjoy your time!", source) else -- if the username or password are not correct, output a message to the player. outputChatBox("invalid username and password. Please re-connect and try again.", source) end end -- define our costom event, and allow it to be triggered from the client ('true'). addEvent("submitLogin",true) -- add an event handler so that when submitLogin is triggered, the function loginHandler is called. addEventHandler("submitLogin",root, loginHandler)
  3. https://wiki.multitheftauto.com/wiki/Debugging
  4. I'm pretty sure you have an error in your client side script, do you even know how when your script(s) has a error?
  5. You want to make it appear just to the player who used the command? if so: local restriction = {} addCommandHandler("roll", function(player, cmd) local playerName = getPlayerName ( player ):gsub ( "#%x%x%x%x%x%x", "" ) if restriction[player] then local sMessage = "You have to wait 30 seconds" outputChatBox(sMessage, player, 255, 0, 0) else restriction[player] = true setTimer(restrictionEnd, 30000, 1, player) local randomroll = math.random(1, 3000) local roller = math.random(1, 4) local weapon = math.random(1, 40) if ( roller == 1 ) then givePlayerMoney(player, randomroll) local sMessage = playerName .. '#FFFF00 roll and wins ' .. randomroll .. ' !' triggerClientEvent( player, "new", player, sMessage) elseif ( roller == 2 ) then local sMessage = playerName .. ' roll and is now changed the Weapon ' .. getWeaponNameFromID ( weapon ) .. '!' giveWeapon(player, weapon) triggerClientEvent( player, "new", player, sMessage) else local sMessage = "Good luck next time!" outputChatBox ( sMessage, player, 255, 0, 0) end end end ) function restrictionEnd(player) restriction[player] = nil end
  6. setElementVelocity set's a element velocity. Example from wiki: speedx, speedy, speedz = getElementVelocity ( getPlayerFromName ( "someguy" ) ) -- get the velocity of the player named "someguy" setElementVelocity ( getPlayerFromName ( "Ted" ), speedx, speedy, speedz ) -- copy the velocity to a player named "Ted" You can't just use one simple argument, it doesn't work like game speed.
  7. You've just copied and pasted it from the example I gave you, that'll never work. 1: You don't specify ( thePlayer, username, passsword ) anywhere. 2: You don't have any event handler.
  8. function loginHandler(client,username,password) -- check that the username and password are correct. local acc = getAccount(username, password) -- the player has succesfully logged in, so spawn them. if (acc) then spawnPlayer (client, 1959.55, -1714.46, 10) fadeCamera(client, true) -- It's 'fadeCamera', not 'faceCamera'. setCameraTarget(client) outputChatBox("Enjoy your time!", client) else -- if the username or password are not correct, output a message to the player. outputChatBox("invalid username and password. Please re-connect and try again.", client) end end addEvent('submitLogin',true) addEventHandler('submitLogin',root,loginHandler)
  9. Castillo

    Kick ID

    kickPlayer first argument is the player you want to kick, you're giving a number/string instead.
  10. Castillo

    GUI

    That's a 1100+ lines script code, do you expect us to read it all just because you don't know how to debug it? Learn to debug your scripts: https://wiki.multitheftauto.com/wiki/Debugging
  11. local restriction = {} addCommandHandler("roll", function(player, cmd) local playerName = getPlayerName ( player ):gsub ( "#%x%x%x%x%x%x", "" ) if restriction[player] then local sMessage = "You have to wait 30 seconds" outputChatBox(sMessage, player, 255, 0, 0) else restriction[player] = true setTimer(restrictionEnd, 30000, 1, player) local randomroll = math.random(1, 3000) local roller = math.random(1, 4) local weapon = math.random(1, 40) if ( roller == 1 ) then givePlayerMoney(player, randomroll) local sMessage = playerName .. '#FFFF00 roll and wins ' .. randomroll .. ' !' triggerClientEvent("new", root, sMessage) elseif ( roller == 2 ) then local sMessage = playerName .. ' roll and is now changed the Weapon ' .. getWeaponNameFromID ( weapon ) .. '!' giveWeapon(player, weapon) triggerClientEvent("new", root, sMessage) else local sMessage = "Good luck next time!" outputChatBox ( sMessage, player, 255, 0, 0) end end end ) function restrictionEnd(player) restriction[player] = nil end That'll remove the HEX colors. And yes, it'll appear to everyone.
  12. There's an example here: https://wiki.multitheftauto.com/wiki/LogIn Just read it as many times as you can.
  13. That's because the script is checking if the user is "user" and the password is "apple": if ( username == "user" and password == "apple" ) then To make it login to your account, use: getAccount logIn
  14. -- client side: addEventHandler("onClientResourceStart",resourceRoot, function() GUIEditor_Window = {} GUIEditor_TabPanel = {} GUIEditor_Tab = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Checkbox = {} GUIEditor_Label = {} GUIEditor_Edit = {} GUIEditor_Window[1] = guiCreateWindow(130,156,513,341,"GUI Login-Register By ElMota",false) GUIEditor_TabPanel[1] = guiCreateTabPanel(9,38,495,294,false,GUIEditor_Window[1]) GUIEditor_Tab[1] = guiCreateTab("Login",GUIEditor_TabPanel[1]) GUIEditor_Label[1] = guiCreateLabel(12,46,21,21,"Nick",false,GUIEditor_Tab[1]) guiLabelSetColor(GUIEditor_Label[1],200, 0, 0) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Edit[1] = guiCreateEdit(42,42,158,23,"",false,GUIEditor_Tab[1]) guiEditSetMaxLength(GUIEditor_Edit[1],22) GUIEditor_Label[2] = guiCreateLabel(8,113,63,19,"Contraseña",false,GUIEditor_Tab[1]) guiLabelSetColor(GUIEditor_Label[2],200 ,0 ,0) guiSetFont(GUIEditor_Label[2],"default-bold-small") GUIEditor_Edit[2] = guiCreateEdit(75,108,134,26,"",false,GUIEditor_Tab[1]) guiEditSetMasked(GUIEditor_Edit[2],true) guiEditSetMaxLength(GUIEditor_Edit[2],5) GUIEditor_Button[1] = guiCreateButton(17,182,190,54,"Loggearme",false,GUIEditor_Tab[1]) guiSetFont(GUIEditor_Button[1],"sa-header") GUIEditor_Memo[1] = guiCreateMemo(260,25,222,108,"Favor Loggearse :\n\nPrivilegios de estar loggeado :\n\n- se te guardaran todos tus datos en mi sistema mySQL",false,GUIEditor_Tab[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) GUIEditor_Label[3] = guiCreateLabel(213,228,268,34,"GUI Creada por ElMota CopyRight 2011-2012 (c)",false,GUIEditor_Tab[1]) guiLabelSetColor(GUIEditor_Label[3],200,0,0) guiSetFont(GUIEditor_Label[3],"default-bold-small") GUIEditor_Checkbox[1] = guiCreateCheckBox(132,146,354,28,"Acepto los Terminos y Condiciones de este Servidor",false,false,GUIEditor_Tab[1]) guiSetFont(GUIEditor_Checkbox[1],"default-bold-small") GUIEditor_Checkbox[2] = guiCreateCheckBox(28,80,194,22,"Mostrar Contraseña",false,false,GUIEditor_Tab[1]) guiSetFont(GUIEditor_Checkbox[2],"default-bold-small") GUIEditor_Tab[2] = guiCreateTab("Register",GUIEditor_TabPanel[1]) GUIEditor_Label[4] = guiCreateLabel(4,32,26,16,"Nick",false,GUIEditor_Tab[2]) guiLabelSetColor(GUIEditor_Label[4],200,0,0) guiSetFont(GUIEditor_Label[4],"default-bold-small") GUIEditor_Edit[3] = guiCreateEdit(35,23,176,30,"aaaaaaa",false,GUIEditor_Tab[2]) guiEditSetMaxLength(GUIEditor_Edit[3],23) GUIEditor_Label[5] = guiCreateLabel(2,80,65,22,"Contraseña",false,GUIEditor_Tab[2]) guiLabelSetColor(GUIEditor_Label[5],200,0,0) guiSetFont(GUIEditor_Label[5],"default-bold-small") GUIEditor_Edit[4] = guiCreateEdit(73,74,140,31,"",false,GUIEditor_Tab[2]) guiEditSetMasked(GUIEditor_Edit[4],true) guiEditSetMaxLength(GUIEditor_Edit[4],5) GUIEditor_Label[6] = guiCreateLabel(3,128,40,16,"e-mail",false,GUIEditor_Tab[2]) guiLabelSetColor(GUIEditor_Label[6],200,0,0) guiSetFont(GUIEditor_Label[6],"default-bold-small") GUIEditor_Edit[5] = guiCreateEdit(47,118,168,30,"",false,GUIEditor_Tab[2]) guiEditSetMaxLength(GUIEditor_Edit[5],20) GUIEditor_Button[2] = guiCreateButton(14,179,207,68,"Registrarme",false,GUIEditor_Tab[2]) guiSetFont(GUIEditor_Button[2],"sa-header") GUIEditor_Memo[2] = guiCreateMemo(243,17,240,128,"Recuerda antes De loggearte debes estar registrado aqui osino no podras jugar ^^ GUI Creada por ElMota (c)",false,GUIEditor_Tab[2]) guiMemoSetReadOnly(GUIEditor_Memo[2],true) GUIEditor_Checkbox[3] = guiCreateCheckBox(246,162,215,28,"Mostrar Contraseña",false,false,GUIEditor_Tab[2]) guiSetFont(GUIEditor_Checkbox[3],"default-bold-small") GUIEditor_Checkbox[4] = guiCreateCheckBox(223,217,263,21,"Acepto los terminos y Condiciones de este server",false,false,GUIEditor_Tab[2]) guiSetFont(GUIEditor_Checkbox[4],"default-small") guiSetVisible(GUIEditor_Window[1], false) addEventHandler("onClientGUIClick", GUIEditor_Button[1], clientSubmitLogin, false) showTheGUI() end ) function showTheGUI() outputChatBox("Bienvenido a mi Servidor de MTA porfavor Loggeate.") -- if the GUI was successfully created, then show the GUI to the player if (GUIEditor_Window[1] ~= nil) then guiSetVisible(GUIEditor_Window[1], true) else -- if the GUI hasnt been properly created, tell the player outputChatBox("An unexpected error has occurred and the log in GUI has not been created.") end -- enable the players cursor (so they can select and click on the components) showCursor(true) -- set the input focus onto the GUI, allowing players (for example) to press 'T' without the chatbox opening guiSetInputEnabled(true) end function clientSubmitLogin ( button, state ) if ( button == "left" and state == "up" ) then local username = guiGetText(GUIEditor_Edit[1]) local password = guiGetText(GUIEditor_Edit[2]) -- if the username and password both exist if ( username and password ) then triggerServerEvent("submitLogin", localPlayer, username, password) guiSetInputEnabled(false) guiSetVisible(GUIEditor_Window[1], false) showCursor(false) else outputChatBox("Porfavor pon tu Nick y tu Contraseña.") end end end -- server side: function loginHandler(username, password) if ( username == "user" and password == "apple" ) then spawnPlayer(source, 0, 0, -400) fadeCamera(source, true) setCameraTarget( source ) outputChatBox("Bienvenido a mi Server.", source) else outputChatBox("Invalido Nick o Contraseña Incorrecta Porfavor intente nuevamente.", source) end end addEvent("submitLogin",true) addEventHandler("submitLogin",root,loginHandler)
  15. And what is the problem? we can't help you if you don't give us information.
  16. It works as it should, it spawns me at the coordinates you've set.
  17. function playmusic ( commandName ) -- Client side commands doesn't has 'player' argument, you must use 'localPlayer'. local x, y, z = getElementPosition ( localPlayer ) --Get the players position local sound = playSound3D("music.mp3", x, y, z) -- You forgot about the sound position. attachElements ( sound, localPlayer, 0, 0, 5 ) --attach music. end addCommandHandler ( "play", playmusic )
  18. 0 = position X 0 = positionY 5 = positionZ Change them to your desired coordinates.
  19. Because there's no such function: attachToCar, but there's attachElements.
×
×
  • Create New...