Jump to content

how use


Paplo

Recommended Posts

  
  
  
  
function time() 
  
startTick = getTickCount() 
  
if not endTick then 
endTick = startTick + 1000*60*30   -- 1000 = 1s*60 = 1m*30 = 30 min 
end 
  
  
if startTick >= endTick then 
  
 outputChatBox("30 mins") 
 endTick = startTick + 1000*60*30 -- reset it again for 30 min 
  
end 
  
setTimer(time,50,0) -- or addEventHandler("onClientRender",root,time) 

Link to comment
local lastTick = 0 
local toWait = 60000*60 
function buycar() 
    local playerMoney = getPlayerMoney(localPlayer) 
        if ( getTickCount ( ) - lastTick >= toWait ) then 
            if ( playerMoney >= tonumber(9500) ) then 
        triggerServerEvent("onBuycar",localPlayer) 
        lastTick = getTickCount ( ) 
                guiSetVisible( w, false ) 
        showCursor( false ) 
        outputChatBox ( "you bought the car", 0, 255, 0 ) 
            else 
        outputChatBox("you dont have 9500",255,0,0) 
  
    end 
        else 
        outputChatBox("you must wait some time",255,0,0) 
    end 
end 

if i will buy the car say you must wait some time

if i change the toWait = 5000 or little time then it work

Link to comment
and if is bigger ?? , you can but / you can't ?

Normaly it should work 5000 is only 5s it's a small time , it should work with bigger values to .

but i test it

if i change to little time it work

but if i change to big time its not work i don't know :?

Link to comment
local lastTick = 0 
local toWait = 60000*60 
function buycar() 
    local playerMoney = getPlayerMoney(localPlayer) 
        if ( getTickCount ( ) - lastTick >= toWait ) then 
            if ( playerMoney >= tonumber(9500) ) then 
        triggerServerEvent("onBuycar",localPlayer) 
        lastTick = getTickCount ( ) 
                guiSetVisible( w, false ) 
        showCursor( false ) 
        outputChatBox ( "you bought the car", 0, 255, 0 ) 
            else 
        outputChatBox("you dont have 9500",255,0,0) 
  
    end 
        else 
        outputChatBox("you must wait some time",255,0,0) 
    end 
end 

if i will buy the car say you must wait some time

if i change the toWait = 5000 or little time then it work

hmmm okey how i can do this function work first time and if try to use it again you will wait one hour ??

Link to comment
local toWait = false 
function buycar() 
    local playerMoney = getPlayerMoney(localPlayer) 
        if not  toWait then 
            if ( playerMoney >= tonumber(9500) ) then 
        triggerServerEvent("onBuycar",localPlayer) 
       toWait = true 
       setTimer(switch,1000*60*60,1) 
                guiSetVisible( w, false ) 
        showCursor( false ) 
        outputChatBox ( "you bought the car", 0, 255, 0 ) 
            else 
        outputChatBox("you dont have 9500",255,0,0) 
  
    end 
        else 
        outputChatBox("you must wait some time",255,0,0) 
    end 
end 
  
  
function switch() 
toWait = false 
end 

Link to comment
local toWait = false 
function buycar() 
    local playerMoney = getPlayerMoney(localPlayer) 
        if not  toWait then 
            if ( playerMoney >= tonumber(9500) ) then 
        triggerServerEvent("onBuycar",localPlayer) 
       toWait = true 
       setTimer(switch,1000*60*60,1) 
                guiSetVisible( w, false ) 
        showCursor( false ) 
        outputChatBox ( "you bought the car", 0, 255, 0 ) 
            else 
        outputChatBox("you dont have 9500",255,0,0) 
  
    end 
        else 
        outputChatBox("you must wait some time",255,0,0) 
    end 
end 
  
  
function switch() 
toWait = false 
end 

thank you it work ^^

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