Timer Error :(
#1

Hello, Every One i Hate Problems Timer
This Error Problems
Quote:

C:\Documents and Settings\000\Desktop\samp03z_svr_R1_win32\pawno\in clude\sscanf2.inc(305) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Documents and Settings\000\Desktop\samp03z_svr_R1_win32\pawno\in clude\sscanf2.inc(305) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Documents and Settings\000\Desktop\samp03z_svr_R1_win32\pawno\in clude\sscanf2.inc(365) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Documents and Settings\000\Desktop\samp03z_svr_R1_win32\pawno\in clude\sscanf2.inc(365) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Documents and Settings\000\My Documents\ffff\gamemodes\barron.pwn(683) : error 055: start of function body without function header
C:\Documents and Settings\000\My Documents\ffff\gamemodes\barron.pwn(686) : error 021: symbol already defined: "format"
C:\Documents and Settings\000\My Documents\ffff\gamemodes\barron.pwn(689) : error 010: invalid function or declaration
C:\Documents and Settings\000\My Documents\ffff\gamemodes\barron.pwn(693) : error 010: invalid function or declaration
C:\Documents and Settings\000\My Documents\ffff\gamemodes\barron.pwn(695) : warning 203: symbol is never used: "string"

This All Timer
PHP код:
forward JailTimer(playerid);
public 
JailTimer(playerid);
{
    
PlayerSeconds[playerid] --;//The timer get called every 1 second. so we will decrease his variable - 1 every second.
    
new string[24];
    
format(string,sizeof(string),"00:0%d",PlayerSeconds[playerid]);
    
TextDrawSetString(JailTimer3[playerid],string);
    
GivePlayerMoney(playerid,-200);//So you will take $200 from him everytime.
    
if(PlayerSeconds[playerid] <= 0)//If the jail time ends.
    
{
        
KillTimer(PlayerTimer[playerid]);//Here we will stop the timer from getting called.
    
}
    return 
true;

and this on top
Quote:

new PlayerSeconds[MAX_PLAYERS] = 10;
new PlayerTimer[MAX_PLAYERS]; //This is used to store the timer id. SetTimerEx(..);

and this in Command Arresting
Quote:

PlayerSeconds[playerid] = 10;//Just to make sure its 10 seconds.
PlayerTimer[playerid] = SetTimerEx("JailTimer",1000,true,"i",playerid);

Please Help +Rep
Thanks For All,
Reply
#2

First of all,

Remove public JailTimer(playerid); - ";" at the end
and show us your full command of arresting player.
Reply
#3

i delete it now and i get this error
Quote:

C:\Documents and Settings\000\My Documents\ffff\gamemodes\barron.pwn(4) : error 017: undefined symbol "PlayerSeconds"
C:\Documents and Settings\000\My Documents\ffff\gamemodes\barron.pwn(6) : error 017: undefined symbol "format"
C:\Documents and Settings\000\My Documents\ffff\gamemodes\barron.pwn(6) : warning 215: expression has no effect
C:\Documents and Settings\000\My Documents\ffff\gamemodes\barron.pwn(6) : warning 215: expression has no effect
C:\Documents and Settings\000\My Documents\ffff\gamemodes\barron.pwn(6) : warning 215: expression has no effect
C:\Documents and Settings\000\My Documents\ffff\gamemodes\barron.pwn(6) : error 017: undefined symbol "PlayerSeconds"
C:\Documents and Settings\000\My Documents\ffff\gamemodes\barron.pwn(6) : error 029: invalid expression, assumed zero
C:\Documents and Settings\000\My Documents\ffff\gamemodes\barron.pwn(6) : fatal error 107: too many error messages on one line

and this command arrest
PHP код:
CMD:arrest(playeridparams[])
{
        new 
targetid;
        if(
sscanf(params"u"targetid))
        {
        
SendClientMessage(playerid,COLOR_ERROR,"USAGE: /Arrest (Player Name/PlayerID)");
        return 
1;
        }
        new 
Float:xFloat:yFloat:z;
        
GetPlayerPos(targetidxyz);
        if(!
IsPlayerInRangeOfPoint(targetid5.0xyz)) return SendClientMessage(playeridCOLOR_RED"You aren't near that player.");
        if(
GetPlayerWantedLevel(targetid) < 4) return SendClientMessage(playeridCOLOR_RED"That player is not wanted!");
        
SetPlayerInterior(targetid3);
        new 
RandomG random(sizeof(RandomSpawnCLIVINS));
        
SetPlayerPos(targetidRandomSpawnJail[RandomG][0], RandomSpawnJail[RandomG][1], RandomSpawnJail[RandomG][2]);
        
SetPlayerFacingAngle(targetidRandomSpawnJail[RandomG][3]);
        
GivePlayerMoney(playerid1000+random(9000));
        
SetPlayerScore(playeridGetPlayerScore(playerid) + 1);
        
SetPlayerScore(targetidGetPlayerScore(targetid) - 1);
        
SetPlayerHealth(targetid10000000000.0);
        
SetPlayerWantedLevel(targetid0);
        
ResetPlayerWeapons(targetid);
        
TextDrawShowForPlayer(playeridJailTimer0);
        
TextDrawShowForPlayer(playeridJailTimer1);
        
TextDrawShowForPlayer(playeridJailTimer2);
        
TextDrawShowForPlayer(playeridJailTimer3);
        
TextDrawShowForPlayer(playeridJailTimer4);
        
PlayerSeconds[playerid] = 10;//Just to make sure its 10 seconds.
        
PlayerTimer[playerid] = SetTimerEx("JailTimer",1000,true,"i",playerid);
        return 
1;

Reply
#4

Код:
CMD:arrest(playerid, params[])
{
        new targetid;
        if(sscanf(params, "u", targetid))
        {
        SendClientMessage(playerid,COLOR_ERROR,"USAGE: /Arrest (Player Name/PlayerID)");
        return 1;
        }
        new Float:x, Float:y, Float:z;
        GetPlayerPos(targetid, x, y, z);
        if(!IsPlayerInRangeOfPoint(playerid, 5.0, x, y, z)) return SendClientMessage(playerid, COLOR_RED, "You aren't near that player.");
        if(GetPlayerWantedLevel(targetid) < 4) return SendClientMessage(playerid, COLOR_RED, "That player is not wanted!");
        SetPlayerInterior(targetid, 3);
        new RandomG = random(sizeof(RandomSpawnCLIVINS));
        SetPlayerPos(targetid, RandomSpawnJail[RandomG][0], RandomSpawnJail[RandomG][1], RandomSpawnJail[RandomG][2]);
        SetPlayerFacingAngle(targetid, RandomSpawnJail[RandomG][3]);
        GivePlayerMoney(playerid, 1000+random(9000));
        SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
        SetPlayerScore(targetid, GetPlayerScore(targetid) - 1);
        SetPlayerHealth(targetid, 10000000000.0);
        SetPlayerWantedLevel(targetid, 0);
        ResetPlayerWeapons(targetid);

        //You need to show him the textdraws! (targetid)
        TextDrawShowForPlayer(targetid, JailTimer0);
        TextDrawShowForPlayer(targetid, JailTimer1);
        TextDrawShowForPlayer(targetid, JailTimer2);
        TextDrawShowForPlayer(targetid, JailTimer3);
        TextDrawShowForPlayer(targetid, JailTimer4);

        //You need to set:targetid for seconds and Timer! Otherwise you go to prison :)
        PlayerSeconds[targetid] = 10;//Just to make sure its 10 seconds.
        PlayerTimer[targetid] = SetTimerEx("JailTimer",1000,true,"i",targetid);
        return 1;
}
and show us the lines: 4, 6
Reply
#5

Quote:

C:\Documents and Settings\000\My Documents\ffff\gamemodes\barron.pwn(4) : error 017: undefined symbol "PlayerSeconds"
C:\Documents and Settings\000\My Documents\ffff\gamemodes\barron.pwn(6) : error 017: undefined symbol "format"
C:\Documents and Settings\000\My Documents\ffff\gamemodes\barron.pwn(6) : warning 215: expression has no effect
C:\Documents and Settings\000\My Documents\ffff\gamemodes\barron.pwn(6) : warning 215: expression has no effect
C:\Documents and Settings\000\My Documents\ffff\gamemodes\barron.pwn(6) : warning 215: expression has no effect
C:\Documents and Settings\000\My Documents\ffff\gamemodes\barron.pwn(6) : error 017: undefined symbol "PlayerSeconds"
C:\Documents and Settings\000\My Documents\ffff\gamemodes\barron.pwn(6) : error 029: invalid expression, assumed zero
C:\Documents and Settings\000\My Documents\ffff\gamemodes\barron.pwn(6) : fatal error 107: too many error messages on one line

this line 4
Quote:

PlayerSeconds[playerid] --;//The timer get called every 1 second. so we will decrease his variable - 1 every second.

this line 6
Quote:

format(string,sizeof(string),"00:0%d",PlayerSecond s[playerid]);

Reply
#6

You dont have defined PlayerSeconds varriable.
On TOP: new PlayerSeconds[MAX_PLAYERS];

And "format" as undefined? do yo have #include <a_samp> at top?
Reply
#7

i have it
Quote:

new PlayerSeconds[MAX_PLAYERS] = 10;
new PlayerTimer[MAX_PLAYERS]; //This is used to store the timer id. SetTimerEx(..);

i use it
Quote:

#include <a_samp>
#include <zcmd>
#include <sscanf2>
#include <Streamer>
#include <foreach>

Reply
#8

Interesting.. make sure you have latest includes and files (0.3z R4)
Reply
#9

i have last inc
Reply
#10

Post full code of it, not just some codes. Maybe we got it working
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)