[HELP] Problem with my AFK system.
#1

Hi i created an AFK system, but i don't get why it affects just ID 0, or first person that connects...
Here's my timer stuff:

Код:
SetTimer("ZaidejuKord", 30000, true);

forward ZaidejuKord();
public ZaidejuKord()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
	{
        new zaidejofailas[100], vardas[MAX_PLAYER_NAME];
		new Float:x, Float:y, Float:z;
		GetPlayerName(i, vardas, sizeof(vardas));
		format(zaidejofailas, sizeof(zaidejofailas), "FR/Saskaitos/%s.ini",vardas);
	 	if(afkn[i] == 0)
	 	{
	 	    GetPlayerPos(i, x, y, z);
   			dini_FloatSet(zaidejofailas, "afkX", x);
			dini_FloatSet(zaidejofailas, "afkY", y);
			dini_FloatSet(zaidejofailas, "afkZ", z);
	 		//SetTimer("AFKT",60000,false);
	 		afkn[i] = 1;
			return 1;
	 	}
		else if(afkn[i] == 1)
		{
		    GetPlayerPos(i, x, y, z);
		    if(dini_Float(zaidejofailas, "afkX") == x && dini_Float(zaidejofailas, "afkY") == y && dini_Float(zaidejofailas, "afkZ") == z)
			{
            	ShowPlayerDialog(i,3,DIALOG_STYLE_MSGBOX,"{A3E4FF}Ar norite testi?","{FFAF00}Ar norite testi zaidima?","Taip","Ne");
            	Attach3DTextLabelToPlayer(AFK[i], i, 0.0, 0.0, 0.3);
            	afkn[i] = 2;
				return 1;
			}
			else
			{
		    	afkn[i] = 0;
		    	return 1;
			}
		}
		else if(afkn[i] == 2)
		{
		}
	}
}
afkn 0 means checks the person coordinates
afkn 1 checks coordinates, and sees if they're same
afkn 2 player has Dialog so don't touch him

Do you know whats the problem?
Reply
#2

pawn Код:
forward ZaidejuKord();
public ZaidejuKord()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        new zaidejofailas[100], vardas[MAX_PLAYER_NAME];
        new Float:x, Float:y, Float:z;
        GetPlayerName(i, vardas, sizeof(vardas));
        format(zaidejofailas, sizeof(zaidejofailas), "FR/Saskaitos/%s.ini",vardas);
        if(afkn[i] == 0)
        {
            GetPlayerPos(i, x, y, z);
            dini_FloatSet(zaidejofailas, "afkX", x);
            dini_FloatSet(zaidejofailas, "afkY", y);
            dini_FloatSet(zaidejofailas, "afkZ", z);
            //SetTimer("AFKT",60000,false);
            afkn[i] = 1;
        }
        else if(afkn[i] == 1)
        {
            GetPlayerPos(i, x, y, z);
            if(dini_Float(zaidejofailas, "afkX") == x && dini_Float(zaidejofailas, "afkY") == y && dini_Float(zaidejofailas, "afkZ") == z)
            {
                ShowPlayerDialog(i,3,DIALOG_STYLE_MSGBOX,"{A3E4FF}Ar norite testi?","{FFAF00}Ar norite testi zaidima?","Taip","Ne");
                Attach3DTextLabelToPlayer(AFK[i], i, 0.0, 0.0, 0.3);
                afkn[i] = 2;
            }
            else
            {
                afkn[i] = 0;
            }
        }
        else if(afkn[i] == 2)
        {
        }
    }
}
Do not use return's in a loop. This will stop the loop.
Reply
#3

Remove these

pawn Код:
return 1;
Reply
#4

Thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)