Author Topic: timer error :-\  (Read 1834 times)

Mido_Pop

  • Full Member
  • ***
  • Posts: 168
  • Karma: +6/-20
  • The_Pops ( War )
    • View Profile
timer error :-\
« on: November 05, 2012, 01:57:09 pm »
i need it with timer .

what is the error ?

function onPlayerCommand( plr, cmd, text )
{
   if ( cmd == "fixit" )
   {
             NewTimer( "fix", 1, 1);
   }
      
   return 1;
}

function fix()
{
        plr.Vehicle.Fix();
}
« Last Edit: November 05, 2012, 01:58:49 pm by mido_pop »



Shadow.

  • Tester
  • Full Member
  • ****
  • Posts: 144
  • Karma: +16/-35
    • View Profile
Re: timer error :-\
« Reply #1 on: November 05, 2012, 03:34:08 pm »
How obvious is the wiki supposed to be !?

Read this page thousands of times till you understand, it's plain obvious...

http://liberty-unleashed.co.uk/LUWiki/Squirrel/Functions/Timers/NewTimer

1 second = 1000 miliseconds

Thijn

  • Tester
  • Sr. Member
  • ****
  • Posts: 531
  • Karma: +27/-16
    • View Profile
Re: timer error :-\
« Reply #2 on: November 05, 2012, 05:31:57 pm »
Still doesn't explain why it's not working :P
You need to add a vehicle parameter, or the function fix() does not know what vehicle it needs to fix..
Something like:
Quote
function onPlayerCommand( plr, cmd, text )
{
   if ( cmd == "fixit" )
   {
             NewTimer( "fix", 1000, 1, plr.Vehicle);
   }
     
   return 1;
}

function fix( veh )
{
        veh.Fix();
}

Mido_Pop

  • Full Member
  • ***
  • Posts: 168
  • Karma: +6/-20
  • The_Pops ( War )
    • View Profile
Re: timer error :-\
« Reply #3 on: November 05, 2012, 07:59:08 pm »
thanks ( Thijn & Shadow )         :P :P



SugarD

  • Argonath RPG Dev/Manager
  • Tester
  • Sr. Member
  • ****
  • Posts: 820
  • Karma: +37/-75
  • STOP IN THE NAME OF THE COLESLAW!
    • View Profile
    • Clan Xperience
Re: timer error :-\
« Reply #4 on: November 08, 2012, 02:59:07 pm »
The "spamming" comment has been removed. This is a warning to others to drop that disgusting attitude. These forums exist for a reason, and helping people is one of them. If you don't like it, don't post here.

Mido_Pop

  • Full Member
  • ***
  • Posts: 168
  • Karma: +6/-20
  • The_Pops ( War )
    • View Profile
Re: timer error :-\
« Reply #5 on: November 11, 2012, 08:21:04 pm »
 how can i make stop timer ???

   like this :

      StopTimer( "..", 1000, 1, ....);



Rocky

  • Full Member
  • ***
  • Posts: 105
  • Karma: +5/-3
    • View Profile
Re: timer error :-\
« Reply #6 on: November 12, 2012, 04:29:00 am »
how can i make stop timer ???

   like this :

      StopTimer( "..", 1000, 1, ....);

VehTimer <- NewTimer( "..", 1000, 1, ....);
VehTimer.Delete(); //Delete the timer.
VehTimer.Pause(); //Pause the timer.
VehTimer.Start(); //Resume the timer.
Look for lu server testers, Requirements are:
English good enough to communicate.
Good knowledge about gaming.

PM me those who are interested.

 

© Liberty Unleashed Team.