Command with timer
#1

Hi! I tried to do a command with timer, who must be executed every 2-3 minutes. But, my script isn't good.
Код:
#include <a_samp>
#include <core>
new LSp;
forward Timerf();
forward Timer();

public OnGameModeInit()
{
LSp = CreateObject(5167, -2450.27, 1851.55, 0.15, 0.00, 0.00, 180.00);
SetTimer("Timerf", 5000, true);
SetTimer("Timer", 5000, true);
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/ff"))
{
MoveObject(LSp, -2400.27, 1851.55, 0.15, 5.0);
SetTimer("Timerf2", 5000, true);
return 1;
}
if(!strcmp(cmdtext, "/ff2"))
{
MoveObject(LSp, -2450.27, 1851.55, 0.15, 5.0);
SetTimer("Timer2", 5000, true);
return 1;
}
return 0;
}
Help me. ( Sorry for my English) PS: I know 5000 = 5 sec, i will set it later )
Reply
#2

What 'is not good' exactly?
Reply
#3

The command isn't execute.
Reply
#4

You gave forwarded but there's no callback.
pawn Код:
public Timerf()
{
    MoveObject(LSp, -2400.27, 1851.55, 0.15, 5.0);
    SetTimer("Timer", 5000, 0);

public Timer()
{
    MoveObject(LSp, -2450.27, 1851.55, 0.15, 5.0);
    SetTimer("Timerf", 5000, 0);
Delete the cmd too, and ongamemodeinit:
pawn Код:
SetTimer("Timer", 5000, 0);
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)