Jump to content

MTA.Castiel

Members
  • Posts

    30
  • Joined

  • Last visited

Everything posted by MTA.Castiel

  1. @Burak5312 Hey there! Burak, your code has done the job with very slight modification on the first line at 'damage_causing == 49'. I was still taking damage from the ramming vehicles with the godmode players so I just removed the 'damage_causing == 49' and some of what i did previously. So now we have this. Working as intended ? Many many thanks! ? function godmodePlayers(attacker, weapon, bodypart) if (weapon == 53 or weapon == 54) then return end if attacker and getElementType(attacker) == "vehicle" then local player = getVehicleOccupant(attacker) local isGodForSource = getElementData(source, "godmode.active") local isGodForAttacker = getElementData(player, "godmode.active") if(isGodForSource or isGodForAttacker) then if(player ~= source) then cancelEvent() end end end if attacker and getElementType(attacker) == "player" then local isGodForSource = getElementData(source, "godmode.active") local isGodForAttacker = getElementData(attacker, "godmode.active") if(isGodForSource or isGodForAttacker) then if(attacker ~= source) then cancelEvent() end end end end addEventHandler("onClientPlayerDamage", getLocalPlayer(), godmodePlayers)
  2. Hello, eoL|Shady! thanks for getting back to me on this topic ? Well, the code you have prepared has not worked as i intended and perhaps -TheManTheMythTheLegend is right as to 'better explain' what i'm trying achieve. I'm sorry but if i may, basically if the player that has the element data "godmode.active" set, that player cannot be harmed by anyone AND also cannot cause harm to anyone else. Right now, if i punch a player that has "godmode.active" set, they take no damage, yes that works, but if that godmode.active player punches me or rams me with a vehicle, i lose Health ? Thats the issue i'm trying to solve.
  3. I'm facing an issue with godmode protected players being able to use vehicles to damage non-protected players by ramming them. I've tried a few things, unfortunately it has not worked. function godmodePlayers(attacker, weapon, bodypart) if (weapon == 54 or weapon == 53) then --Have godmode.active players take damage from falling or drowning return end if getElementData(attacker, "godmode.active") or getElementData(localPlayer, "godmode.active") then cancelEvent() end if getElementType(attacker) == "vehicle" and getElementData(attacker, "godmode.active") then cancelEvent() end end addEventHandler("onClientPlayerDamage", getLocalPlayer(), godmodePlayers)
  4. Ohh i see ? a killTimer, haven't seen that one coming. Well this works, thanks a lot The_GTA ?
  5. So below is a working vehicle repair code i've managed to put together and repairs the damaged vehicle every minute as intended but i just cant seem to reset the timer when the player is wasted. If anyone has an idea, would be much appreciated ? local repairDelayTime = 60000 local repairTimer = false function repairVehicle() local vehicle = getPedOccupiedVehicle(localPlayer) if isPedDead(localPlayer) and isPedInVehicle(localPlayer) then return end if isTimer(repairTimer) then local timeleft = math.ceil(getTimerDetails(repairTimer)/1000) if timeleft then local 2ndString = " second to repair." if timeleft > 1 then 2ndString = " seconds to repair." end if isPedInVehicle(localPlayer) then outputChatBox("Time left: "..tostring(timeleft)..2ndString, 255, 255, 255, true) end return false end end local vehicle = getPedOccupiedVehicle(localPlayer) if vehicle then server.fixVehicle(vehicle) outputChatBox("Vehicle fixed.", 255, 255, 255, true) repairTimer = setTimer( function() repairTimer = false end, repairDelayTime, 1) end end addCommandHandler('fix', repairVehicle) --added this in attempt to reset the timer but doesnt really work function resetTimer() repairTimer = false end addEventHandler("onClientPlayerWasted", root, resetTimer)
×
×
  • Create New...