SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 26/05/2009, 08:12 PM   #1
JoeDaDude
Gangsta
 
Join Date: Apr 2008
Posts: 673
Reputation: 6
Default Timer Error

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

JoeDaDude is offline  
Old 26/05/2009, 08:14 PM   #2
Weirdosport
High-roller
 
Join Date: Jul 2008
Posts: 1,293
Reputation: 0
Default Re: Timer Error

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.
Weirdosport is offline  
Old 26/05/2009, 08:14 PM   #3
Correlli
Godfather
 
Correlli's Avatar
 
Join Date: May 2009
Location: Slovenia
Posts: 6,340
Reputation: 365
Default Re: Timer Error

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
Correlli is offline  
Old 26/05/2009, 08:16 PM   #4
JoeDaDude
Gangsta
 
Join Date: Apr 2008
Posts: 673
Reputation: 6
Default Re: Timer Error

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 (c) 1997-2006, ITB CompuPhase


1 Error.
JoeDaDude is offline  
Old 26/05/2009, 08:18 PM   #5
Weirdosport
High-roller
 
Join Date: Jul 2008
Posts: 1,293
Reputation: 0
Default Re: Timer Error

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

And change your timer to SetTimerEx
Weirdosport is offline  
Old 27/05/2009, 01:01 PM   #6
JoeDaDude
Gangsta
 
Join Date: Apr 2008
Posts: 673
Reputation: 6
Default Re: Timer Error

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);
}
JoeDaDude is offline  
Old 27/05/2009, 01:03 PM   #7
Think
Gangsta
 
Think's Avatar
 
Join Date: Nov 2007
Posts: 810
Reputation: 39
Default Re: Timer Error

onplayerconnect, settimerex("score", 10000,true, "i", playerid);
__________________
"If we cant stand strong alone, there is no fucking way we can stand strong united" - Kevin T Thoms
Think is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Countdown timer giving error :s ~Dangun! Help Archive 6 12/05/2010 02:05 PM
My small drug system gets timer error :/ bajskorv123 Help Archive 5 07/02/2010 10:52 AM
[HELP] Kill timer Error. CuervO Help Archive 3 20/01/2010 10:10 PM
Timer Error [SOB]Chris Help Archive 6 19/07/2009 07:46 PM
Error on timer [SOB]Chris Help Archive 1 19/07/2009 12:07 AM


All times are GMT. The time now is 10:53 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.