Jump to content

TheBossCl

Members
  • Posts

    12
  • Joined

  • Last visited

TheBossCl's Achievements

Square

Square (6/54)

0

Reputation

  1. lo pudiste solucionar? me pasa lo mismo con la función IsPlayerInFaction
  2. onPedDamage dealing damage to the ped triggers a function where if the ped is below 10 health, the ped's health returns to 100 and armor is added to 100. but my code doesn't work that's why i ask read above
  3. is the "onPedDamage" event working? ?

  4. thanks, i already solved the problem using addEventHandler("onClientGUIClick", theButton, function(), false)
  5. yeah is work, thanks
  6. Problem with a login panel, what happens is that when you click anywhere in the window it is as if you were clicking on any of the buttons, the client code is as follows: local screenW, screenH = guiGetScreenSize() function regPanel() winRegister = guiCreateWindow((screenW - 293) / 2, (screenH - 399) / 2, 293, 399, "Registro", false) guiWindowSetSizable(winRegister, false) guiSetVisible(winRegister, false) lblUser = guiCreateLabel(27, 48, 74, 22, "Usuario:", false, winRegister) guiLabelSetHorizontalAlign(lblUser, "right", false) guiLabelSetVerticalAlign(lblUser, "center") lblPass = guiCreateLabel(27, 86, 74, 22, "Contraseña:", false, winRegister) guiLabelSetHorizontalAlign(lblPass, "right", false) guiLabelSetVerticalAlign(lblPass, "center") userBox = guiCreateEdit(107, 48, 147, 24, "", false, winRegister) pass1Box = guiCreateEdit(107, 86, 147, 24, "", false, winRegister) guiEditSetMasked(pass1Box, true) pass2Box = guiCreateEdit(107, 125, 147, 24, "", false, winRegister) guiEditSetMasked(pass2Box, true) btnRegister = guiCreateButton(60, 213, 173, 57, "Registrarse", false, winRegister) rbtRegresar = guiCreateButton(60, 292, 173, 57, "Regresar", false, winRegister) lblPass2 = guiCreateLabel(27, 125, 74, 22, "Contraseña:", false, winRegister) guiLabelSetHorizontalAlign(lblPass2, "right", false) guiLabelSetVerticalAlign(lblPass2, "center") addEventHandler("onClientGUIClick", rbtRegresar, function() guiSetVisible(winRegister, false) guiSetVisible(winLogin, true) end) addEventHandler("onClientGUIClick", btnRegister, function() usuario = guiGetText(userBox) c = guiGetText(pass1Box) c1 = guiGetText(pass2Box) if(c==c1)then triggerServerEvent("rg", getLocalPlayer(),usuario,c) else end end) end addEvent("cerrar", true) addEventHandler("cerrar", getLocalPlayer(), function() guiSetVisible(winRegister, false) showCursor(false) end) addEvent("cerrar2", true) addEventHandler("cerrar2", getLocalPlayer(), function() guiSetVisible(winLogin, false) showCursor(false) end) function logPanel() regPanel() showCursor(true) winLogin = guiCreateWindow((screenW - 510) / 2, (screenH - 524) / 2, 510, 524, "Login", false) guiWindowSetSizable(winLogin, false) lblUser = guiCreateLabel(48, 76, 133, 33, "User:", false, winLogin) guiLabelSetHorizontalAlign(lblUser, "right", false) guiLabelSetVerticalAlign(lblUser, "center") lblPass = guiCreateLabel(48, 135, 133, 33, "Password:", false, winLogin) guiLabelSetHorizontalAlign(lblPass, "right", false) guiLabelSetVerticalAlign(lblPass, "center") UserBox = guiCreateEdit(191, 76, 174, 33, "", false, winLogin) passBox = guiCreateEdit(191, 135, 174, 33, "", false, winLogin) guiEditSetMasked(passBox, true) btnLogin = guiCreateButton(48, 391, 175, 61, "Login", false, winLogin) btnRegister = guiCreateButton(288, 391, 175, 61, "Register", false, winLogin) addEventHandler("onClientGUIClick", btnRegister, function() guiSetVisible(winLogin, false) guiSetVisible(winRegister, true) end) addEventHandler("onClientGUIClick", btnLogin, function() user = guiGetText(UserBox) clave = guiGetText(passBox) triggerServerEvent("lg", getLocalPlayer(),user,clave) end) end addEvent("abrirLogin", true) addEventHandler("abrirLogin", getLocalPlayer(), logPanel) and the server code is this: function rg(user, pass) if(addAccount(user,pass))then outputChatBox("se registro con exito") triggerClientEvent(source,"cerrar",source) logIn(source,getAccount(user,pass), pass) else outputChatBox("esta cuenta ya existe") end end function lg(usuario, clave) cuenta = getAccount(usuario,clave) if(cuenta)then logIn(source,getAccount(usuario,clave), clave) triggerClientEvent(source,"cerrar2",source) else outputChatBox("la cuenta no existe o usuario y contraseña incorrectos") end end addEvent("rg",true) addEventHandler("rg", getRootElement(), rg) addEvent("lg",true) addEventHandler("lg", getRootElement(), lg) addEventHandler("onPlayerJoin",getRootElement(), function() triggerClientEvent(source,"abrirLogin",source) end) addEventHandler("onPlayerLogout",getRootElement(), function() triggerClientEvent(source,"abrirLogin",source) end)
  7. How did you manage to fix the problem? The same thing happens to me with a login panel, every time I click any part of the window it is as if I clicked any of the buttons that I have :/.
  8. Thank you very much everyone, you helped me
  9. Marker = createMarker ( 2063.57104, -1831.39954, 13.54688-1, "cylinder", 4, 255, 0, 0, 127.5) Blip = createBlip ( 2063.57104, -1831.39954, 13.54688-1, 27, 2, 255, 0, 0, 255, 0, 250) Marker2 = createMarker ( 2056.77319, -1909.43298, 13.54688-1, "cylinder", 4, 255, 0, 0, 127.5) Blip2 = createBlip ( 2056.77319, -1909.43298, 13.54688-1, 27, 2, 255, 0, 0, 255, 0, 250) function onMarker(player) local veh = getPedOccupiedVehicle ( player ) local vida = getElementHealth ( veh ) precio = (1000 - vida)/2 if isElement(player) and getElementType(player) == "player" then local vehType = getVehicleType(veh) if vehType == "Automobile" or "Monster Truck" or "Quad" or "Bike" then if precio >= 1 then outputChatBox("el costo de la reparacion es: $"..precio..", si quieres repararlo escribe /reparar, sino /cancelar", player) setElementFrozen(veh, true) setVehicleEngineState ( veh, false) addCommandHandler("reparar", repararVeh) addCommandHandler("cancelar", cancelVeh) else outputChatBox("tu vehiculo no tiene daños, se ve de lujo :)", player, 0, 255, 0) end else outputChatBox("tu vehiculo no se puede reparar aqui :(") end end end function repararVeh(player) if (getPlayerMoney(player) >= precio)then takePlayerMoney(player, precio) outputChatBox("reparado con exito", player) local veh = getPedOccupiedVehicle ( player ) fixVehicle(veh) setVehicleEngineState ( veh, true) setElementFrozen(veh, false) else outputChatBox("no tienes suficiente dinero, tu dinero es: $"..getPlayerMoney(player)) end end function cancelVeh(player) local veh = getPedOccupiedVehicle ( player ) setVehicleEngineState ( veh, true) removeCommandHandler("reparar") removeCommandHandler("cancelar") end addEventHandler("onMarkerHit", Marker, onMarker) addEventHandler("onMarkerHit", Marker2, onMarker) What happens is that when entering the marker with a helicopter or another vehicle, it still reads from line 15 and in the console it tells me the following: [19:46:48] WARNING: fixVehicle2\server.lua:9: Bad argument @ 'getPedOccupiedVehicle' [Expected ped at argument 1, got vehicle] [19:46:54] WARNING: fixVehicle2\server.lua:10: Bad argument @ 'getElementHealth' [Expected element at argument 1, got boolean] [19:46:54] ERROR: fixVehicle2\server.lua:11: attempt to perform arithmetic on local 'vida' (a boolean value)
×
×
  • Create New...