Help with timer.
#4

Quote:
Originally Posted by Kitten
Посмотреть сообщение
pawn Код:
#define MAX_CASH 100000
forward Trolo( playerid ) ;

SetTimer("Trolo",10000,false);

public Trolo ( playerid ) {
     new randomcash = random(MAX_CASH);
     GivePlayerMoney(playerid,randomcash);
     return 1;
}
That piece of code is a bit off, you're calling a callback but without giving it the parameter it looks for? That means this timer will only work for a single person (id 0), because the value of playerid will default to 0 since you're not passing another value to it.

Instead of using SetTimer for this example, you would need to use SetTimerEx and pass an ID along to the callback, like it's expecting you to! For example:

pawn Код:
SetTimerEx("Trolo", 10000, false, "i", playerid);
Depending on what you wish to send of course this could be modified.

Please make sure you're posting proper examples in this section when responding to threads, otherwise people will be mis-lead by in-correct information!

As for the original poster, I recommend instead of waiting for help here, that you use the SA-MP Wiki which has absolutely tons of extremely detailed information on all of the functions you can make use of.

https://sampwiki.blast.hk/wiki/SetTimerEx

That's one you should be looking at right now
Reply


Messages In This Thread
Help with timer. - by Shockey HD - 23.07.2011, 05:24
Re: Help with timer. - by Kitten - 23.07.2011, 05:32
Re: Help with timer. - by Shockey HD - 23.07.2011, 05:38
Re: Help with timer. - by JaTochNietDan - 23.07.2011, 05:43
Re: Help with timer. - by Shockey HD - 23.07.2011, 05:44
Re: Help with timer. - by JaTochNietDan - 23.07.2011, 13:27

Forum Jump:


Users browsing this thread: 4 Guest(s)