Jump to content

[Help]car health


Recommended Posts

addEventHandler("onVehicleEnter",root,function(player,seat,jacked) 
    if(player)and(seat==0)then 
        acc = getAccountName(getPlayerAccount(player)) 
        if(isObjectInACLGroup("user."..acc,aclGetGroup("Admin")))then 
            setVehicleDamageProof(source,true) 
        end 
    end 
end) 

the script work perfect,but how to make it start by command and stop(make VehicleDamageProof False).

Link to comment
function damageProof( player, command ) 
     if (isPedInVehicle(player)) then 
        acc = getAccountName(getPlayerAccount(player)) 
        if(isObjectInACLGroup("user."..acc,aclGetGroup("Admin")))then 
              setVehicleDamageProof( getPlayerOccupiedVehicle(player), not isVehicleDamageProof(getPlayerOccupiedVehicle(player)) 
        end 
     end 
end 
addCommandHandler("damageproof", damageProof) 

didn't test it!

Link to comment
  • Other Languages Moderators
function damageProof( player, command ) 
     if (isPedInVehicle(player)) then 
        acc = getAccountName(getPlayerAccount(player)) 
        if(isObjectInACLGroup("user."..acc,aclGetGroup("Admin")))then 
              setVehicleDamageProof( getPlayerOccupiedVehicle(player), not isVehicleDamageProof(getPlayerOccupiedVehicle(player)) 
        end 
     end 
end 
addCommandHandler("damageproof", damageProof) 

didn't test it!

You missed bracket at line 5.

This better code.

function damageProof(player) 
     local vehicle = getPedOccupiedVehicle(player) 
     if vehicle then 
          local acc = getAccountName(getPlayerAccount(player)) 
          if isObjectInACLGroup("user."..acc, aclGetGroup("Admin")) then 
               setVehicleDamageProof(vehicle, not isVehicleDamageProof(vehicle)) 
               local ss = isVehicleDamageProof(vehicle) and "ON" or "OFF" 
               outputChatBox("damageProof is now "..ss.." !", player, 255, 255, 255) 
          end 
     end 
end 
addCommandHandler("damageproof", damageProof) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...