Timers mixed up again
#1

hey all. When two people are in the same timer they see eachother's timer. I'm not sure what's wrong.
First I see my timer, then I see his timer. Then I see my timer again then his again etc etc..

pawn Код:
new jacktimer[MAX_PLAYERS];
pawn Код:
jacktimer[playerid] = SetTimerEx("jcounting",1000,true,"i",playerid);
pawn Код:
public jcounting(playerid)
{
    Bit16_Set(jcount,playerid,Bit16_Get(jcount,playerid) -1);
    if(Bit16_Get(jcount,playerid) <1)
    {
    TextDrawHideForPlayer(playerid,Textdraw7);
    TextDrawHideForPlayer(playerid,Textdraw8);
    KillTimer(jacktimer[playerid]);
    }
    format(String, sizeof(String), "%i", Bit16_Get(jcount,playerid));
    TextDrawSetString(Textdraw8,String);
    return 1;
}
Please help.
Reply
#2

do you have forward jcounting(playerid);
above public jcounting(playerid) by any chance?

EDIT: you should be killing the jcounting, not jtimer

P.S. What are the errors you are getting?
Reply
#3

Yes, as Threshold said, please post the errors, it helps rather efficiently to getting your solution as fast as possible.
Reply
#4

Yes I have and there are no errors.
Reply
#5

hm... suspect #1:
Код:
Textdraw7;
Textdraw8;
iam missing the [MAX_PLAYERS] - one global textdraw in different timers?
Reply
#6

Quote:
Originally Posted by Babul
Посмотреть сообщение
hm... suspect #1:
Код:
Textdraw7;
Textdraw8;
iam missing the [MAX_PLAYERS] - one global textdraw in different timers?
What do you mean? Still not solved btw
Reply
#7

can someone help me before I've got to sleep?
Reply
#8

fuck, i just stood up lol
ok, i meant your Textdraw7 as one global textdraw. its initialized like:
Код:
new Textdraw7;
new Textdraw8;
and you got 1 timer per player running, each one started when a player connects, i assume?. by providing us the fact that the textdraw shows "your" (playerid 0's) information, then quickly updates with playerid 1's information, was pointing me to a shared variable/textdraw, updates in different timers (using [playerid]).
in short, i meant:
Код:
new Textdraw7[MAX_PLAYERS];
new Textdraw8[MAX_PLAYERS];
...and now its your turn again ^^
Reply
#9

Now I have some problems at creating the textdraw.

pawn Код:
C:\Users\Lars\Desktop\Sa-mp\gamemodes\suncobrob.pwn(146) : error 033: array must be indexed (variable "Textdraw7")
C:\Users\Lars\Desktop\Sa-mp\gamemodes\suncobrob.pwn(147) : error 035: argument type mismatch (argument 1)
C:\Users\Lars\Desktop\Sa-mp\gamemodes\suncobrob.pwn(148) : error 035: argument type mismatch (argument 1)
C:\Users\Lars\Desktop\Sa-mp\gamemodes\suncobrob.pwn(149) : error 035: argument type mismatch (argument 1)
C:\Users\Lars\Desktop\Sa-mp\gamemodes\suncobrob.pwn(150) : error 035: argument type mismatch (argument 1)
C:\Users\Lars\Desktop\Sa-mp\gamemodes\suncobrob.pwn(151) : error 035: argument type mismatch (argument 1)
C:\Users\Lars\Desktop\Sa-mp\gamemodes\suncobrob.pwn(152) : error 035: argument type mismatch (argument 1)
C:\Users\Lars\Desktop\Sa-mp\gamemodes\suncobrob.pwn(153) : error 035: argument type mismatch (argument 1)
C:\Users\Lars\Desktop\Sa-mp\gamemodes\suncobrob.pwn(155) : error 033: array must be indexed (variable "Textdraw8")
C:\Users\Lars\Desktop\Sa-mp\gamemodes\suncobrob.pwn(156) : error 035: argument type mismatch (argument 1)
C:\Users\Lars\Desktop\Sa-mp\gamemodes\suncobrob.pwn(157) : error 035: argument type mismatch (argument 1)
C:\Users\Lars\Desktop\Sa-mp\gamemodes\suncobrob.pwn(158) : error 035: argument type mismatch (argument 1)
C:\Users\Lars\Desktop\Sa-mp\gamemodes\suncobrob.pwn(159) : error 035: argument type mismatch (argument 1)
C:\Users\Lars\Desktop\Sa-mp\gamemodes\suncobrob.pwn(160) : error 035: argument type mismatch (argument 1)
C:\Users\Lars\Desktop\Sa-mp\gamemodes\suncobrob.pwn(161) : error 035: argument type mismatch (argument 1)
C:\Users\Lars\Desktop\Sa-mp\gamemodes\suncobrob.pwn(162) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase
pawn Код:
Textdraw7 = TextDrawCreate(3.000000, 274.000000, "Job Cooldown");
    TextDrawBackgroundColor(Textdraw7, 255);
    TextDrawFont(Textdraw7, 1);
    TextDrawLetterSize(Textdraw7, 0.500000, 1.000000);
    TextDrawColor(Textdraw7, -1);
    TextDrawSetOutline(Textdraw7, 0);
    TextDrawSetProportional(Textdraw7, 1);
    TextDrawSetShadow(Textdraw7, 1);

    Textdraw8 = TextDrawCreate(54.000000, 293.000000, "_");
    TextDrawBackgroundColor(Textdraw8, 255);
    TextDrawFont(Textdraw8, 1);
    TextDrawLetterSize(Textdraw8, 0.500000, 1.000000);
    TextDrawColor(Textdraw8, 16777215);
    TextDrawSetOutline(Textdraw8, 0);
    TextDrawSetProportional(Textdraw8, 1);
    TextDrawSetShadow(Textdraw8, 1);
Reply
#10

Код:
new MaxPlayers=GetMaxPlayers();
for(new id=0;id<MaxPlayers;id++)
{
	Textdraw7[id] = TextDrawCreate(3.000000, 274.000000, "Job Cooldown");
	TextDrawBackgroundColor(Textdraw7[id], 255);
	TextDrawFont(Textdraw7[id], 1);
	TextDrawLetterSize(Textdraw7[id], 0.500000, 1.000000);
	TextDrawColor(Textdraw7[id], -1);
	TextDrawSetOutline(Textdraw7[id], 0);
	TextDrawSetProportional(Textdraw7[id], 1);
	TextDrawSetShadow(Textdraw7[id], 1);

	Textdraw8[id] = TextDrawCreate(54.000000, 293.000000, "_");
	TextDrawBackgroundColor(Textdraw8[id], 255);
	TextDrawFont(Textdraw8[id], 1);
	TextDrawLetterSize(Textdraw8[id], 0.500000, 1.000000);
	TextDrawColor(Textdraw8[id], 16777215);
	TextDrawSetOutline(Textdraw8[id], 0);
	TextDrawSetProportional(Textdraw8[id], 1);
	TextDrawSetShadow(Textdraw8[id], 1);
}
due to the textdraw limit of 2048, its a good idea to use the GetMaxPlayers() - i guess you dont want to waste almost 1000 textdraws
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)