JasperRieken Posted June 21, 2012 Share Posted June 21, 2012 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 Posted June 21, 2012 Share Posted June 21, 2012 timer setTimer ( function theFunction, int timeInterval, int timesToExecute, [ var arguments... ] ) Because you forgot the 3rd argument (timesToExecute) here: setTimer(warpGarage, 2000) Link to comment
JasperRieken Posted June 21, 2012 Author Share Posted June 21, 2012 So what must i edit because i really cant see it Link to comment
micheal1230 Posted June 21, 2012 Share Posted June 21, 2012 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
Anderl Posted June 21, 2012 Share Posted June 21, 2012 This code will give you error cuz "player" argument is nil. Link to comment
JasperRieken Posted June 21, 2012 Author Share Posted June 21, 2012 And how would i fix this function? Link to comment
Anderl Posted June 21, 2012 Share Posted June 21, 2012 Add timer only after the player hit the marker or... Why do you even need a timer for that? Link to comment
JasperRieken Posted June 21, 2012 Author Share Posted June 21, 2012 Because there is another function wich has to be activated first Link to comment
JasperRieken Posted June 22, 2012 Author Share Posted June 22, 2012 Due, this function moves you away it doesn't allow the other function to activate that's why i need the timer to work Link to comment
BinSlayer1 Posted June 22, 2012 Share Posted June 22, 2012 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
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