Galactix Posted June 23, 2018 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 If I helped you, make sure you click the reaction button on the right to support me! It will grant me more visibility and will help me to help others!If you have any kind of request or subject you would like to discuss about with me, don't hesitate to send me a private message about it!
Moderators Patrick Posted June 23, 2018 Moderators 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 community profile | map converters | map images | pDownloader | pAttach | model encrypter
Galactix Posted June 23, 2018 Author Posted June 23, 2018 Thanks. If I helped you, make sure you click the reaction button on the right to support me! It will grant me more visibility and will help me to help others!If you have any kind of request or subject you would like to discuss about with me, don't hesitate to send me a private message about it!
Moderators Patrick Posted June 23, 2018 Moderators Posted June 23, 2018 4 minutes ago, Galactix said: Thanks. You are welcome. 1 community profile | map converters | map images | pDownloader | pAttach | model encrypter
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