Jump to content

I wanna add time for frozen player when he use a cmd.


Recommended Posts

Hello community, I wanna add time for frozen player when he use a cmd.

Here's code

--sets the armor when someone attacked him 
function buyShield(thePlayer) 
    local money = getPlayerMoney ( thePlayer ) 
    if money >= 5000 then 
        exports.texts:output("You have bought armor for $5000",thePlayer, 0, 255, 0) 
        setPedArmor ( thePlayer, 100 ) 
        takePlayerMoney ( thePlayer, 5000 ) 
setTimer ( function() setElementFrozen (thePlayer, false) end, 1000, 1 ) 
    else 
        exports.texts:output("You don't have enough money.",thePlayer, 255, 0, 0) 
    end 
end 
addCommandHandler ( "buyarmor", buyShield ) 
  
  

He will stay frozen idk why, I wanna frozen time

Link to comment

This will freeze the player in 3 seconds and then make him unfreeze again

  
--sets the armor when someone attacked him 
function buyShield(thePlayer) 
    local money = getPlayerMoney ( thePlayer ) 
    if money >= 5000 then 
        exports.texts:output("You have bought armor for $5000",thePlayer, 0, 255, 0) 
        setPedArmor ( thePlayer, 100 ) 
        takePlayerMoney ( thePlayer, 5000 ) 
        setElementFrozen(thePlayer, true) 
        setTimer ( function() setElementFrozen (thePlayer, false) end, 3000, 1 ) 
    else 
        exports.texts:output("You don't have enough money.",thePlayer, 255, 0, 0) 
    end 
end 
addCommandHandler ( "buyarmor", buyShield ) 
  

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...