Galactix Posted June 23, 2018 Share Posted June 23, 2018 Hello, I made a script that makes a command (/useheroin) which uses the heroin drug and give 200 max hp to the player aswell as Healing him for 60 seconds. However I'm having the issue where if two players use the command in less than 60 seconds, one of them won't get their health set back to 100. --HEROIN DRUG EFFECT ON function heroinDrugOn(player) theDrugPlayer = player setPedStat ( player, 24, 1000) setTimer(heroinDrugOff, 60000,1) setElementHealth(player, 200) triggerClientEvent ( theDrugPlayer, "heroinOnMessage", root) end addCommandHandler("useheroin", heroinDrugOn) --HEROIN DRUG EFFECT GOING OFF function heroinDrugOff(client) local playerHealth = getElementHealth(theDrugPlayer) if (playerHealth > 100) then setPedStat (theDrugPlayer, 24, 590) setElementHealth(theDrugPlayer, 100) else setPedStat (theDrugPlayer, 24, 590) setElementHealth(theDrugPlayer, playerHealth) end triggerClientEvent ( theDrugPlayer, "heroinOffMessage", root) end Link to comment
Moderators Patrick Posted June 23, 2018 Moderators Share Posted June 23, 2018 (edited) --HEROIN DRUG EFFECT ON function heroinDrugOn(player) setPedStat ( player, 24, 1000) setElementHealth(player, 200) setTimer(heroinDrugOff, 60000, 1, player) triggerClientEvent ( player, "heroinOnMessage", root) end addCommandHandler("useheroin", heroinDrugOn) --HEROIN DRUG EFFECT GOING OFF function heroinDrugOff(player) local playerHealth = getElementHealth(player) if (playerHealth > 100) then setElementHealth(player, 100) end setPedStat (player, 24, 590) triggerClientEvent ( player, "heroinOffMessage", root) end Edited June 23, 2018 by Patrick2562 1 Link to comment
Moderators Patrick Posted June 23, 2018 Moderators Share Posted June 23, 2018 4 minutes ago, Galactix said: Thanks. You are welcome. 1 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now