Jump to content

ViRuZGamiing

Members
  • Posts

    1,050
  • Joined

  • Last visited

Everything posted by ViRuZGamiing

  1. Is the player in a team? Cause indeed there shouldn't be a error now but you'll still need to be in a team
  2. It appears that the localPlayer isn't in a team since getPlayerTeam returns false throw a if (getPlayerTeam(getLocalPlayer())) then around it
  3. You're first argument is localPlayer would let me think this is client side but client side bindKey's first argument is not a player element since client side's player argument always equals localPlayer. bool bindKey ( string key, string keyState, function handlerFunction, [ var arguments, ... ] )
  4. if (getPedOccupiedVehicleSeat(getLocalPlayer()) == 0) then instead of local occupants = getVehicleOccupants(theVehicle) if occupants[0]==getLocalPlayer() then
  5. ViRuZGamiing

    help

    You're shutting down the server every iteration (so 1 resource would stop and then the server would stop)
  6. ViRuZGamiing

    SOLVED

    This won't work since the event would only be attached to the last marker, the variable 'marker' gets overwritten every iteration.
  7. ViRuZGamiing

    SOLVED

    for k,v in ipairs( spots ) do marker = createMarker ( v[1],v[2],v[3], "Cylinder", 1, 255, 255, 255, 100 ) addEventHandler ("onClientMarkerHit", marker, MarkerHit ) end
  8. ViRuZGamiing

    help

    as I said remove the event handlers, function cancelEventFunc() cancelEvent() end function sleep(thePlayer) addEventHandler("onPlayerCommand", thePlayer, cancelEventFunc) addEventHandler("onClientKey", thePlayer, cancelEventFunc) local phealth = getElementHealth( thePlayer ) if ( phealth < 100 ) then if not isPedInVehicle( thePlayer ) then if getElementData( thePlayer, "sleep" ) ~= "activated" then setPedAnimation( thePlayer, "CRACK", "crckidle2", -1, true, false, true ) outputChatBox( "Sleeping Mode: On!", thePlayer, 255, 255, 0 ) setElementData( thePlayer, "sleep", "activated" ) toggleControl( thePlayer, "forward", false ) toggleControl( thePlayer, "jump", false ) toggleControl( thePlayer, "aim_weapon", false ) toggleControl( thePlayer, "fire", false ) else outputChatBox( "You can't sleep while sleeping O_o", thePlayer, 255, 0, 0 ) end else outputChatBox( "You can't sleep in a vehicle!", thePlayer, 255, 0, 0 ) end else outputChatBox( "You can't sleep while your health is full!", thePlayer, 255, 0, 0 ) end end addCommandHandler( "sleep", sleep ) function getup(thePlayer) removeEventHandler("onPlayerCommand", thePlayer, cancelEventFunc) removeEventHandler("onClientKey", thePlayer, cancelEventFunc) if getElementData( thePlayer, "sleep") == "activated" then setPedAnimation( thePlayer, nil, nil ) outputChatBox( "Sleeping Mode: Off!", thePlayer, 255, 0, 0 ) setElementData( thePlayer, "sleep", "deactivated" ) toggleControl( thePlayer, "forward", true ) toggleControl( thePlayer, "jump", true ) toggleControl( thePlayer, "aim_weapon", true ) toggleControl( thePlayer, "fire", true ) else outputChatBox( "You aren't sleeping!", thePlayer, 255, 0, 0 ) end end addCommandHandler( "getup", getup )
  9. ViRuZGamiing

    help

    give the function a name and remove the event handler by function name
  10. ViRuZGamiing

    help

    What's the error?
  11. ViRuZGamiing

    help

    not 100% if it cancels bindKey's but try this addEventHandler("onClientKey", thePlayer, function() cancelEvent() end EDIT: It will work
  12. ViRuZGamiing

    help

    function sleep(thePlayer) addEventHandler("onPlayerCommand", thePlayer, function() cancelEvent() end) local phealth = getElementHealth( thePlayer ) if ( phealth < 100 ) then if not isPedInVehicle( thePlayer ) then if getElementData( thePlayer, "sleep" ) ~= "activated" then setPedAnimation( thePlayer, "CRACK", "crckidle2", -1, true, false, true ) outputChatBox( "Sleeping Mode: On!", thePlayer, 255, 255, 0 ) setElementData( thePlayer, "sleep", "activated" ) toggleControl( thePlayer, "forward", false ) toggleControl( thePlayer, "jump", false ) toggleControl( thePlayer, "aim_weapon", false ) toggleControl( thePlayer, "fire", false ) else outputChatBox( "You can't sleep while sleeping O_o", thePlayer, 255, 0, 0 ) end else outputChatBox( "You can't sleep in a vehicle!", thePlayer, 255, 0, 0 ) end else outputChatBox( "You can't sleep while your health is full!", thePlayer, 255, 0, 0 ) end end addCommandHandler( "sleep", sleep ) Try this you gotta remove the event handler on leaving the faction tho
  13. ViRuZGamiing

    help

    use killTimer
  14. ViRuZGamiing

    help

    kills = 0 function killl(killer) kills = kills + 1 outputChatBox("kills="..kills, killer) -- 2nd argument (visibleTo) end addEventHandler("onClientPlayerWasted",getRootElement(), killl)
  15. ViRuZGamiing

    help

    He means function instead of faction
  16. ViRuZGamiing

    help

    onClientGUIClick - Source: The source of this event is the GUI element that was clicked. player is undefined. Both health and walo are false, so you're compairing numbers with false.
  17. I know but what I ment was if the bullet wasn't fired there wouldn't be no splash damage, so wouldn't it be better to cancel the shooting instead of cancelling the damage and still having the explosion.
  18. Couldn't you cancel the shoot event if getPedTarget equals a player?
  19. No, sir. https://wiki.multitheftauto.com/wiki/On ... ayerDamage And I still getting the output error Uhm, yes https://wiki.multitheftauto.com/wiki/GetPedWeapon Optional Arguments weaponSlot: an integer representing the weapon slot (set to the ped's current slot if not given).
  20. this .."" isn't needed only if you want to continue a string afterwards. getPedWeapon's 2nd argument is weapon SLOT and you provide the weapon ID, that's not the same.
  21. Not 100% sure but could it be the element isn't double sided yet?
  22. You're if is closed but after you close it you start an else state
  23. function jump() toggleControl (source, "jump", false ) setTimer(function(player) toggleControl (player, "jump", true) end, 5000,1, source) end addEventHandler("onPlayerDamage", getRootElement(), jump) If I'm right this is what you're trying to achieve
  24. instead of marker, write root
  25. setElementFrozen set it to true, then with a 3 seconden setTimer set it back to false
×
×
  • Create New...