Timer Error
#1

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

Reply
#2

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.
Reply
#3

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
Reply
#4

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.
Reply
#5

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

And change your timer to SetTimerEx
Reply
#6

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);
}
Reply
#7

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


Forum Jump:


Users browsing this thread: 1 Guest(s)