Jump to content

[LUA]Time Won't Function


Recommended Posts

function warpGarage(player) 
setPedArmor(player, 100) 
setElementPosition(player, 1526.19,-1459.14,10.5) 
setElementHealth(player, 100) 
outputChatBox("* You have been set to the Garage Crew", player,0,255,255,false) 
end 
setTimer(warpGarage, 2000) 
addEventHandler("onMarkerHit",marker,warpGarage) 

It doesn't seem to work the timer

Link to comment
Guest Guest4401
timer setTimer ( function theFunction, int timeInterval, int timesToExecute, [ var arguments... ] ) 

Because you forgot the 3rd argument (timesToExecute) here:

setTimer(warpGarage, 2000) 

Link to comment
So what must i edit because i really cant see it

Mate Its Easy Listen To Karthik, You Either Have No Clue About Scripting Your You Didnt Read His Post

Here

function warpGarage(player) 
setPedArmor(player, 100) 
setElementPosition(player, 1526.19,-1459.14,10.5) 
setElementHealth(player, 100) 
outputChatBox("* You have been set to the Garage Crew", player,0,255,255,false) 
end 
setTimer(warpGarage,2000, 1) -- You Need 3 Args. Arg 1 - Function, Arg 2 - Time, Arg 3 - How Many Times To Execute The Timer 
addEventHandler("onMarkerHit",marker,warpGarage) 

Link to comment

Jasper, when the resource starts.. Do you simply want to run that function with a 2-sec timer?

It won't work because player is not defined. You must define it somehow. But we don't know what you're trying to achieve.

Should the function run for all players when the resource starts (timer starts) ? It can't run for just 1 player unless this is specifically defined with getPlayerFromName() which is bad scripting

You can make it run for all players @ start if u use a FOR loop, looping though getElementsByType('player').

If you want to make this and don't know how, reply again and I'll (or someone else) help.

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