Jump to content

How can i make this script only for localplayer?


Sami_~>

Recommended Posts

this is a script when the player select the checkbox it fix the vehicle every time.

but when the player has selected the check box it fixing the vehicle for all players not for a alone player.

 

function AutoFix()
 if ( guiCheckBoxGetSelected(GUIEditor.checkbox[1])) then
     vehicles = getElementsByType ( "vehicle" )
     for vehicleKey,vehicleValue in ipairs(vehicles) do
       fixVehicle ( vehicleValue )
       setTimer ( function()
       setElementHealth ( vehicleValue, 1000.0 )
       end, 10000, 1 )
     end
 end
end
setTimer( AutoFix, 100, 0 )

 

Link to comment
function AutoFix()
 if ( guiCheckBoxGetSelected(GUIEditor.checkbox[1])) then
     --vehicles = getElementsByType ( "vehicle" )
    -- for vehicleKey,vehicleValue in ipairs(vehicles) do
       vehicleValue = getPedOccupiedVehicle(localPlayer)
       if vehicleValue then else return end
       fixVehicle ( vehicleValue )
       setTimer ( function()
       setElementHealth ( vehicleValue, 1000.0 )
       end, 10000, 1 )
     --end
 end
end
setTimer( AutoFix, 100, 0 )

 

  • Thanks 1
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...