SA-MP Forums Archive
SetTimer Error :S - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SetTimer Error :S (/showthread.php?tid=464515)



SetTimer Error :S - GrOobY - 17.09.2013

Код:
public heal(playerid) // line 614
{
    new Float:health;
    GetPlayerHealth(playerid,health);
    if (health < 1.0)
    {
        SetPlayerHealth(playerid, 2.0);
        SetTimer("heal", 4000, false); // Set a timer of 1000 miliseconds (1 second)
    }
    return 1;
}
Error
Код:
D:\Don't touCh\Sampi\roleplay windows\filterscripts\spitali.pwn(614) : error 025: function heading differs from prototype
Please Help me :S


Re: SetTimer Error :S - Konstantinos - 17.09.2013

You set 2 timers; one with SetTimer and the other one with SetTimerEx.

You cannot have it like that:

pawn Код:
forward heal();
public heal()
And
pawn Код:
forward heal(playerid);
public heal(playerid)
at the same time.

Rename one of them to something else.

By the way, just to inform you that using

pawn Код:
forward heal(playerid);
public heal(playerid)
will need to be:
pawn Код:
SetTimerEx("heal", interval_here, false_OR_true_here, "i", playerid);
// in order to pass the playerid to that public.