Jump to content

Drug Effect


Recommended Posts

Hello

I want to ask, is in this script something wrong? Because it doesn't work properly...

The idea is that, when player gets "Steroid" then when he attack player the player got hited and lose 50% more hp then without steroid, but the problem is that the steroid in one time take hp from me.. other time break all item-system.. or even don't work.. here that script.. some text is in latvian language, because it for latvians :) sorry about bad english :)

-- DRUG 9 EFFECT 
drug9effect = false 
drug9timer = nil 
function doDrug9Effect() 
    if not (drug9effect) then 
        drug9effect = true 
        addEventHandler("onClientVehicleEnterDelayed", getLocalPlayer(), cancelEvent) 
        drug2timer = setTimer(resetDrug9Effect, 120000, 1) 
    end 
end 
  
function playerDamage ( attacker, weapon, bodypart, loss ) 
if getElementData(attacker,"onDrug9Effect") == true then 
setElementHealth ( source, getElementHealth(source) -50 ) 
end 
end 
  
function resetDrug9Effect() 
    drug9effect = false 
    removeEventHandler("onClientVehicleEnterDelayed", getLocalPlayer(), cancelEvent) 
end 

I think the problem is on 12 bar.. but.. i dont know how to change it.. because server dont understand if i change to makeElementHealth..

Link to comment

It is whole script.. this is only who doesnt work.. because when i cut this then drugs work properly

    if isTimer(drug9Timer) then 
        killTimer(drug9Timer) 
        drug9Timer = nil 
         
        resetDrug9Effect() 
    end 

This is in the same script reset timer i guess..

this is on server side

if (itemID==208) then 
            takeItemFromSlot(source, itemSlot) 
            exports.global:applyAnimation(source, "FOOD", "EAT_Burger", 4000, false, true, true) 
            exports.global:sendLocalMeAction(source, "Varonīgi apēd steroīdu tabletes.", source, 255, 0, 0) 
            exports.global:sendLocalDoAction(source, "Redzams ka muskuļi uzblīst.", source, 255, 0, 0) 
            setElementHealth(source,getElementHealth(source)-20) 

and this is on client side

if (itemID==208) then 
            doDrug9Effect() 

Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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