SA-MP Forums Archive
Timer Error - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Timer Error (/showthread.php?tid=79238)



Timer Error - JoeDaDude - 26.05.2009

I have compiling errors with my timer,
It checks to see if the cop has made arrest in the past minute,
If he has it sets his score +1, But im getting weird errors,
My code is as follows:
pawn Code:
public Score()
{
    SetPlayerScore(i,1);
}
Error is as follows:
Code:
C:\Documents and Settings\Joe\Desktop\Server\filterscripts\TimerTest.pwn(28) : error 017: undefined symbol "playerid"
Anyone help me? Ty




Re: Timer Error - Weirdosport - 26.05.2009

The timer doesn't have a clue what playerid you're talking about. If you're trying to do it for all players use a ...
for(new i=0; i<MAX_PLAYERS;i++)
...loop.

If you want it for a single player, use SetTimerEx.


Re: Timer Error - Correlli - 26.05.2009

You don't have 'i' defined.
pawn Code:
public Score()
{
SetPlayerScore(i,1);
}
If you want to set score for everyone then you should do like this:
pawn Code:
public Score()
{
for(new i = 0; i < MAX_PLAYERS, i++)
{
SetPlayerScore(i,1);
}
}
Or for one player:
pawn Code:
public Score(playerid)
{
SetPlayerScore(playerid,1);
}
Edit: Weirdosport was faster


Re: Timer Error - JoeDaDude - 26.05.2009

pawn Code:
public Score(playerid)
Code:
C:\Documents and Settings\Joe\Desktop\Server\filterscripts\TimerTest.pwn(26) : error 025: function heading differs from prototype
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.



Re: Timer Error - Weirdosport - 26.05.2009

Change your forward Score() to forward Score(playerid)

And change your timer to SetTimerEx


Re: Timer Error - JoeDaDude - 27.05.2009

ok i removed the code to check if the cop has made the arrest to see if it affected it in anyway,
It has and now compiles successfully, But im not sure wether its my account or the timer but it gave me one point, Then nothing else happens, Anyone?
pawn Code:
#include <a_samp>

#define FILTERSCRIPT
#if defined FILTERSCRIPT

forward Score(playerid);

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
   
  print("Starting timer...");
    SetTimer("Score",10000,true);
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#endif

public Score(playerid)
{
    SetPlayerScore(playerid,1);
}



Re: Timer Error - Think - 27.05.2009

onplayerconnect, settimerex("score", 10000,true, "i", playerid);