Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. That's because you don't even read about the function, you expect us to give you everything fixed, that is not a way to learn.
  2. De nada, cualquier cosa volves a postear y te ayudamos.
  3. setElementFrozen -- Para que no se pueda mover. setVehicleDamageProof -- Para que sea Indestructible. setVehicleLocked -- Para blockearlo. Con esas funciones podes obtener eso, pero vas a tener que aprender lo basico de Lua.
  4. You're still posting random codes, seriously, you gotta start thinking on what you're doing. If you don't think, then I'm afraid you won't learn anything.
  5. Why you put that "kph" @ getPedOccupiedVehicle ? maybe you wanted to use it @ getElementSpeed?
  6. That doesn't make any sense. First you gotta copy the function source code which is: function getElementSpeed(element,unit) if (unit == nil) then unit = 0 end if (isElement(element)) then local x,y,z = getElementVelocity(element) if (unit=="mph" or unit==1 or unit =='1') then return (x^2 + y^2 + z^2) ^ 0.5 * 100 else return (x^2 + y^2 + z^2) ^ 0.5 * 1.61 * 100 end else outputDebugString("Not an element. Can't get speed") return false end end Then you gotta implement it on your script.
  7. I think you could use the function: https://wiki.multitheftauto.com/wiki/GetElementSpeed
  8. GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Progress = {} GUIEditor_Image = {} GUICar = guiCreateWindow(0.6553,0.6224,0.3477,0.3802,"GUI Sistema de Autos",true) guiWindowSetMovable(GUICar,false) guiWindowSetSizable(GUICar,false) GUIEditor_Label[1] = guiCreateLabel(18,161,130,39,"Velocidad",false,GUICar) GUIEditor_Progress[1] = guiCreateProgressBar(19,194,328,50,false,GUICar) GUIEditor_Label[2] = guiCreateLabel(158,251,52,14,"0 Kms/H",false,GUICar) guiSetFont(GUIEditor_Label[2],"default-bold-small") GUIEditor_Button[1] = guiCreateButton(9,35,106,40,"Bloquear",false,GUICar) GUIEditor_Label[3] = guiCreateLabel(12,82,102,32,"Vencina/Petroleo",false,GUICar) GUIEditor_Progress[2] = guiCreateProgressBar(14,102,333,54,false,GUICar) showCursor ( false ) guiSetVisible ( GUICar, false ) addEventHandler ( "onClientVehicleEnter", getRootElement(), function ( thePlayer, seat ) if ( thePlayer == localPlayer ) then guiSetVisible ( GUICar, true ) end end ) bindKey ( "M", "down", function ( ) if isPedInVehicle ( localPlayer ) then showCursor ( not isCursorShowing ( ) ) end end ) Try with that.
  9. 1: Remove "player" from the function name. 2: Replace "player" with "source" @ setPlayerTeam.
  10. local godModeState = false addCommandHandler ( "godmode", function ( ) godModeState = ( not godModeState ) outputChatBox ( "God Mode is now ".. ( godModeState and "Enabled" or "Disabled" ) ..".", 0, 255, 0 ) end ) function togdamage ( attacker, weapon, bodypart ) if ( godModeState ) then cancelEvent ( ) end end addEventHandler ( "onClientPlayerDamage", localPlayer, togdamage )
  11. Tema movido a: "Ayuda relacionada al cliente/servidor".
  12. That's not what he want's, he want's a command to enable/disable God Mode.
  13. You must cancel that event, is not only way. You can use a command handler client side of course.
  14. Your player element is "source" not "thePlayer" @ server side.
  15. You must cancel the event: onClientPlayerDamage with the function: cancelEvent.
  16. Yes, using math.floor Copy my code again.
  17. You're trying to set the damage proof to the player, not to his/her vehicle. function cargodmode ( thePlayer ) local name = getPlayerName ( thePlayer ) if ( name == "Harry_Shea" ) then local theVehicle = getPedOccupiedVehicle ( thePlayer ) -- You forgot about this. if ( theVehicle ) then setVehicleDamageProof ( theVehicle, true ) outputChatBox ( "Car GodMode On", thePlayer ) end end end addCommandHandler ( "cargodon", cargodmode ) function cargodmode1 ( thePlayer ) local name = getPlayerName ( thePlayer ) if ( name == "Harry_Shea" ) then local theVehicle = getPedOccupiedVehicle ( thePlayer ) -- You forgot about this. if ( theVehicle ) then setVehicleDamageProof ( theVehicle, false ) outputChatBox ( "Car GodMode Off", thePlayer ) end end end addCommandHandler ( "cargodoff", cargodmode1 )
  18. function bombe10_Button ( state ) if ( state == "left" ) then if ( source == GUIEditor_Button[12] ) then if ( isTimer ( coldDownTimer ) ) then outputChatBox ( "You can use it again on ".. math.floor ( getTimerDetails ( coldDownTimer ) / 1000 ) .." seconds." ) else coldDownTimer = setTimer ( function ( ) end, 60000, 1 ) triggerServerEvent ( "Feuerwerk", localPlayer ) end end end end addEventHandler ( "onClientGUIClick", getRootElement(), bombe10_Button )
  19. Found the problem, you we're passing another argument "0" in setTimer, so at the other functions it wasn't sending the first argument as a player element, but a number. Copy server side again.
  20. Copy the server side code again, I fixed some bugs.
  21. Use the event: onVehicleEnter and the functions: getPlayerAccount getAccountName isObjectInACLGroup
×
×
  • Create New...