Message comes up 50 times insted of once
#1

Hello this is my script:

pawn Код:
public C0(playerid)
{
    for(new i; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            WGENDT = SetTimer("WGEND0",2000,0);
pawn Код:
for(new i; i<MAX_PLAYERS; i++)
{
  if(IsPlayerConnected(i)) WG40[i] = 1, P30[i] = 1;
  KILLIT = SetTimerEx("C0",41000,0,"i",i);
}
pawn Код:
forward WGEND0(playerid);
public WGEND0(playerid)
{
    for(new i; i<MAX_PLAYERS; i++)
    {
    if(POS1[playerid] == 0)
    {
    if(POS2[playerid] == 0)
    {
    if(POS3[playerid] == 0)
    {
    if(POS4[playerid] == 0)
    {
    if(POS5[playerid] == 0)
    {
    if(POS6[playerid] == 0)
    {
    if(POS7[playerid] == 0)
    {
    if(POS8[playerid] == 0)
    {
    if(POS9[playerid] == 0)
    {
    if(POS10[playerid] == 0)
    {
    if(POS11[playerid] == 0)
    {
    if(POS12[playerid] == 0)
    {
    if(POS13[playerid] == 0)
    {
    if(POS14[playerid] == 0)
    {
    if(POS15[playerid] == 0)
    {
    if(POS16[playerid] == 0)
    {
    if(POS17[playerid] == 0)
    {
    if(POS18[playerid] == 0)
    {
    if(POS19[playerid] == 0)
    {
    if(POS20[playerid] == 0)
    {
    if(POS21[playerid] == 0)
    {
    if(POS22[playerid] == 0)
    {
    if(POS23[playerid] == 0)
    {
    if(POS24[playerid] == 0)
    {
    if(POS25[playerid] == 0)
    {
    if(POS26[playerid] == 0)
    {
    if(POS27[playerid] == 0)
    {
    if(POS28[playerid] == 0)
    {
    if(POS29[playerid] == 0)
    {
    if(POS30[playerid] == 0)
    {
        KillTimer(KILLIT);
//      KillTimer(WGENDT1);
        KillTimer(WGENDT);
//      KillTimer(WGENDT2);
//      KillTimer(WGENDT3);
        SendClientMessageToAll(COLOR_YELLOW, "WG: Nie rospoczelo sie poniewaz nikt nie dolaczyl");
        P30[playerid] = 0;
        P29[playerid] = 0;
        P28[playerid] = 0;
        P27[playerid] = 0;
        P26[playerid] = 0;
        P25[playerid] = 0;
        P24[playerid] = 0;
        P23[playerid] = 0;
        P22[playerid] = 0;
        P21[playerid] = 0;
        P20[playerid] = 0;
        P19[playerid] = 0;
        P18[playerid] = 0;
        P17[playerid] = 0;
        P16[playerid] = 0;
        P15[playerid] = 0;
        P14[playerid] = 0;
        P13[playerid] = 0;
        P12[playerid] = 0;
        P11[playerid] = 0;
        P10[playerid] = 0;
        P9[playerid] = 0;
        P8[playerid] = 0;
        P7[playerid] = 0;
        P6[playerid] = 0;
        P5[playerid] = 0;
        P4[playerid] = 0;
        P3[playerid] = 0;
        P2[playerid] = 0;
        P1[playerid] = 0;
        P0[playerid] = 0;
        ONWG[playerid] = 0;
        WG40[playerid] = 0;
        P30[playerid] = 0;
        P29[playerid] = 0;
        P28[playerid] = 0;
        P27[playerid] = 0;
        P26[playerid] = 0;
        P25[playerid] = 0;
        P24[playerid] = 0;
        P23[playerid] = 0;
        P22[playerid] = 0;
        P21[playerid] = 0;
        P20[playerid] = 0;
        P19[playerid] = 0;
        P18[playerid] = 0;
        P17[playerid] = 0;
        P16[playerid] = 0;
        P15[playerid] = 0;
        P14[playerid] = 0;
        P13[playerid] = 0;
        P12[playerid] = 0;
        P11[playerid] = 0;
        P10[playerid] = 0;
        P9[playerid] = 0;
        P8[playerid] = 0;
        P7[playerid] = 0;
        P6[playerid] = 0;
        P5[playerid] = 0;
        P4[playerid] = 0;
        P3[playerid] = 0;
        P2[playerid] = 0;
        P1[playerid] = 0;
        P0[playerid] = 0;
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
}
And this is the result:



But the message should only come up once
Reply
#2

May i ask what this does?

Код:
forward WGEND0(playerid);
public WGEND0(playerid)
{
	for(new i; i<MAX_PLAYERS; i++)
	{
	if(POS1[playerid] == 0)
	{
	if(POS2[playerid] == 0)
	{
	if(POS3[playerid] == 0)
	{
	if(POS4[playerid] == 0)
	{
	if(POS5[playerid] == 0)
	{
	if(POS6[playerid] == 0)
	{
	if(POS7[playerid] == 0)
	{
	if(POS8[playerid] == 0)
	{
	if(POS9[playerid] == 0)
	{
	if(POS10[playerid] == 0)
	{
	if(POS11[playerid] == 0)
	{
	if(POS12[playerid] == 0)
	{
	if(POS13[playerid] == 0)
	{
	if(POS14[playerid] == 0)
	{
	if(POS15[playerid] == 0)
	{
	if(POS16[playerid] == 0)
	{
	if(POS17[playerid] == 0)
	{
	if(POS18[playerid] == 0)
	{
	if(POS19[playerid] == 0)
	{
	if(POS20[playerid] == 0)
	{
	if(POS21[playerid] == 0)
	{
	if(POS22[playerid] == 0)
	{
	if(POS23[playerid] == 0)
	{
	if(POS24[playerid] == 0)
	{
	if(POS25[playerid] == 0)
	{
	if(POS26[playerid] == 0)
	{
	if(POS27[playerid] == 0)
	{
	if(POS28[playerid] == 0)
	{
	if(POS29[playerid] == 0)
	{
	if(POS30[playerid] == 0)
	{
		KillTimer(KILLIT);
//		KillTimer(WGENDT1);
		KillTimer(WGENDT);
//		KillTimer(WGENDT2);
//		KillTimer(WGENDT3);
		SendClientMessageToAll(COLOR_YELLOW, "WG: Nie rospoczelo sie poniewaz nikt nie dolaczyl");
		P30[playerid] = 0;
		P29[playerid] = 0;
		P28[playerid] = 0;
		P27[playerid] = 0;
		P26[playerid] = 0;
		P25[playerid] = 0;
		P24[playerid] = 0;
		P23[playerid] = 0;
		P22[playerid] = 0;
		P21[playerid] = 0;
		P20[playerid] = 0;
		P19[playerid] = 0;
		P18[playerid] = 0;
		P17[playerid] = 0;
		P16[playerid] = 0;
		P15[playerid] = 0;
		P14[playerid] = 0;
		P13[playerid] = 0;
		P12[playerid] = 0;
		P11[playerid] = 0;
		P10[playerid] = 0;
		P9[playerid] = 0;
		P8[playerid] = 0;
		P7[playerid] = 0;
		P6[playerid] = 0;
		P5[playerid] = 0;
		P4[playerid] = 0;
		P3[playerid] = 0;
		P2[playerid] = 0;
		P1[playerid] = 0;
		P0[playerid] = 0;
		ONWG[playerid] = 0;
		WG40[playerid] = 0;
		P30[playerid] = 0;
		P29[playerid] = 0;
		P28[playerid] = 0;
		P27[playerid] = 0;
		P26[playerid] = 0;
		P25[playerid] = 0;
		P24[playerid] = 0;
		P23[playerid] = 0;
		P22[playerid] = 0;
		P21[playerid] = 0;
		P20[playerid] = 0;
		P19[playerid] = 0;
		P18[playerid] = 0;
		P17[playerid] = 0;
		P16[playerid] = 0;
		P15[playerid] = 0;
		P14[playerid] = 0;
		P13[playerid] = 0;
		P12[playerid] = 0;
		P11[playerid] = 0;
		P10[playerid] = 0;
		P9[playerid] = 0;
		P8[playerid] = 0;
		P7[playerid] = 0;
		P6[playerid] = 0;
		P5[playerid] = 0;
		P4[playerid] = 0;
		P3[playerid] = 0;
		P2[playerid] = 0;
		P1[playerid] = 0;
		P0[playerid] = 0;
	}
	}
	}
	}
	}
	}
	}
	}
	}
	}
	}
	}
	}
	}
	}
	}
	}
	}
	}
	}
	}
	}
	}
	}
	}
	}
	}
	}
	}
	}
	}
}
Reply
#3

in gang war if no one joined because non of the position have changed to 1 (POS....) it will close gang war and say that there were not enough players to start it.
Reply
#4

change
pawn Код:
SendClientMessageToAll(COLOR_YELLOW, "WG: Nie rospoczelo sie poniewaz nikt nie dolaczyl");
to
pawn Код:
SendClientMessage(i, COLOR_YELLOW, "WG: Nie rospoczelo sie poniewaz nikt nie dolaczyl");
Reply
#5

same result
Reply
#6

Why are you using a loop in the last timer? There is no need for it, and that's why it is sending 50 messages. Simply delete the loop in the last timer "WENGDO".
Reply
#7

remove the for(new i; i<MAX_PLAYERS; i++) at public WGEND0(playerid)
Reply
#8

Quote:
Originally Posted by Dark_Kostas
remove the for(new i; i<MAX_PLAYERS; i++) at public WGEND0(playerid)
Yeah. I'm sure my post wasn't anything related to this one anyways.
Reply
#9

same result again. but i wonder why do all the messages come up 50 times at once they even if lots come up they should do it like the timer says 1 message every 2sec not all at once
Reply
#10

It should be fixed if you deleted the loop.

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)