[HELP] Problem with my AFK system. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Problem with my AFK system. (
/showthread.php?tid=253960)
[HELP] Problem with my AFK system. -
Type-R - 08.05.2011
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?
Re: [HELP] Problem with my AFK system. -
Jeffry - 08.05.2011
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.
Re: [HELP] Problem with my AFK system. -
MadeMan - 08.05.2011
Remove these
Re: [HELP] Problem with my AFK system. -
Type-R - 08.05.2011
Thank you