Jump to content

Help


Recommended Posts

so , i have checked it and here what i did

function healer(playerSource) 
if  isTimer (wlaa ) then 
cancelEvent(healer) 
else 
  
   money=getPlayerMoney ( playerSource ) 
if  money<3000 then  
         outputChatBox ("Server : You Don't have enough money",playerSource ,255,0,0) 
return 
else 
   takePlayerMoney ( playerSource , 3000 ) 
   setElementHealth ( playerSource , getElementHealth ( playerSource )+100 ) 
outputChatBox ("You Got 100 HP" , playerSource, 21 , 241 , 32 , true ) 
     
setTimer(healer,300,3) 
end 
end 
end 
addCommandHandler ( "hp", healer ) 
addEvent ("onPlayerDamage",playerSource, 
function (playerSource) setTimer (healer) 
end) 
  

and its not working and i have no idea what i did

Link to comment
  
function healer(playerSource) 
  
   money=getPlayerMoney ( playerSource ) 
if  money<3000 then  
         outputChatBox ("Server : You Don't have enough money",playerSource ,255,0,0) 
return 
else 
   takePlayerMoney ( playerSource , 3000 ) 
   setElementHealth ( playerSource , getElementHealth ( playerSource )+100 ) 
outputChatBox ("You Got 100 HP" , playerSource, 21 , 241 , 32 , true ) 
     
  
  
end 
end 
addCommandHandler ( "hp", healer ) 
  

if anyone can help me to make this scrip don't work after 3 sec when player get damage that would be great

Link to comment
  
function healer(playerSource)  
   money = getPlayerMoney ( playerSource ) 
if  money >= 3000 then 
   takePlayerMoney ( playerSource , 3000 ) 
   setElementHealth ( playerSource , 100 ) 
   outputChatBox ("You Got 100 HP" , playerSource, 21 , 241 , 32 , true ) 
else 
   outputChatBox ("Server : You Don't have enough money",playerSource ,255,0,0)       
end 
end 
addCommandHandler ( "hp", healer ) 
  

Link to comment
  
function healer(playerSource)  
   money = getPlayerMoney ( playerSource ) 
if  money >= 3000 then 
   takePlayerMoney ( playerSource , 3000 ) 
   setElementHealth ( playerSource , 100 ) 
   outputChatBox ("You Got 100 HP" , playerSource, 21 , 241 , 32 , true ) 
else 
   outputChatBox ("Server : You Don't have enough money",playerSource ,255,0,0)       
end 
end 
addCommandHandler ( "hp", healer ) 
  

are u trying to help me or what cuz I don't see any defiance between my script and this script

Link to comment
function healer( playerSource )  
    money = getPlayerMoney ( playerSource ) 
    health = getElementHealth ( playerSource ) 
          if  money >= 3000 and health < 100 then 
                 takePlayerMoney ( playerSource , 3000 ) 
                 setElementHealth ( playerSource , 100 ) 
                 outputChatBox ("You got 100 health" , playerSource, 21 , 241 , 32 , true ) 
          elseif money >= 3000 and health >= 100 then 
                 outputChatBox("Your health already: "..health,playerSource) 
          elseif money < 3000 then 
                 outputChatBox("Your don't have enough money",playerSource) 
        end 
end 
addCommandHandler ( "hp", healer ) 

Link to comment

ye, i have tried to use this and its not working

function healer(playerSource) 
if  isTimer (wlaa ) then 
cancelEvent(healer) 
else 
  
   money=getPlayerMoney ( playerSource ) 
if  money<3000 then 
         outputChatBox ("Server : You Don't have enough money",playerSource ,255,0,0) 
return 
else 
   takePlayerMoney ( playerSource , 3000 ) 
   setElementHealth ( playerSource , getElementHealth ( playerSource )+100 ) 
outputChatBox ("You Got 100 HP" , playerSource, 21 , 241 , 32 , true ) 
    
setTimer(healer,300,3) 
end 
end 
end 
addCommandHandler ( "hp", healer ) 
addEvent ("onPlayerDamage",playerSource, 
function (playerSource) setTimer (healer) 
end) 

Link to comment
local playerDamages = {} 
  
function healer( playerSource )  
    local lastPlayerDamage = playerDamages[playerSource] or 0 
  
    if lastPlayerDamage == 0 or lastPlayerDamage + 3000 <= getTickCount() then 
        local money = getPlayerMoney ( playerSource ) 
        local health = getElementHealth ( playerSource ) 
        if  money >= 3000 and health < 100 then 
            takePlayerMoney ( playerSource , 3000 ) 
            setElementHealth ( playerSource , 100 ) 
            outputChatBox ("You got 100 health" , playerSource, 21 , 241 , 32 , true ) 
        elseif money >= 3000 and health >= 100 then 
            outputChatBox("Your health already: "..health,playerSource) 
        elseif money < 3000 then 
            outputChatBox("Your don't have enough money",playerSource) 
        end 
    else 
        outputChatBox("This function is on cooldown.",playerSource) 
    end 
end 
addCommandHandler ( "hp", healer ) 
  
  
function playerDamage ( attacker, weapon, bodypart ) 
    playerDamages[source] = getTickCount() 
end 
addEventHandler ( "onPlayerDamage", root, playerDamage ) 

Something like that should work

Edited by Guest
Link to comment

You need to define 'wlaa' timer. And why are you adding an event onPlayerDamage while it already exists?

Try this:

function healer(playerSource) 
    if  isTimer (wlaa) then 
    return 
    outputChatBox("Server: Please wait 3 seconds before you re-fill your HP again", playerSource, 255, 0, 0) 
    else 
   local money = getPlayerMoney ( playerSource ) 
   if (money < 3000) then 
         outputChatBox ("Server: You don't have enough money",playerSource, 255, 0, 0) 
    return 
    else 
   takePlayerMoney ( playerSource , 3000 ) 
   setElementHealth ( playerSource , getElementHealth ( playerSource )+100 ) 
    outputChatBox ("You got 100 HP" , playerSource, 21 , 241 , 32 , true ) 
    timer() 
        end 
    end 
end 
addCommandHandler ( "hp", healer ) 
  
  
function timer()  
    wlaa = setTimer(healer, 3000, 1) 
end 
addEventHandler("onPlayerDamage", root, timer) 

The script is server sided btw.

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