GTAOnline.net
San Andreas Multiplayer (sa:mp) => Scripting SA-MP [Pawn center] => Discussion démarrée par: Komolos le 31 Août 2010, 21:26:39
-
Bonjour,
Voilà j'ai un système afk mais je sais pas pourquoi il ne marche pas j'ai bien regardé les code, donc s"y vous pouvez m'aidé c"y dessous sont les code :(il y a des autre code biensur mais ses les plus important celà)
#define AFKTime 5 //Le Nombre de minute que les joueurs peuvent rester AFK
public AFKKicker() // ADD Drek, EDIT Version
{
for(new i = 0; i <= MAX_PLAYERS; i++)
{
if(PPos[i][1] == 0)
{
GetPlayerPos(i,PPos[i][0],PPos[i][1],PPos[i][2]);
return 1;
}
new Float:x,Float:y,Float:z;
GetPlayerPos(i,x,y,z);
if(x == PPos[i][0] && y == PPos[i][1] && z == PPos[i][2])
{
AFKMins[i]++;
if(AFKMins[i] >= AFKTime)
{
if(show == 1)
{
new string[128];
format(string, sizeof(string), "You were Away From Keyboard(AFK) for too long(%d minutes)",AFKTime);
SendClientMessage(i,0xAA3333AA,string);
}
else
{
SendClientMessage(i, COLOR_LIGHTRED,"Vous avez été trop longtemps AFK, vous avez été kické.");
}
Kick(i);
if(pub == 1)
{
new string[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(i, name, sizeof(name));
format(string, sizeof(string),"[Auto-Kick]: %s a été kické par l'anti-afk (Raison: AFK)", name);
SendClientMessageToAll(COLOR_LIGHTRED,string);
}
}
}
}
return 1;
}
(
-
Ce code:
if(PPos[i][1] == 0)
{
GetPlayerPos(i,PPos[i][0],PPos[i][1],PPos[i][2]);
return 1;
}
Arretera ta boucle dé qu'un joueur na pas encore eu de position enregistrer donc deja cette partie j'ferait autrement si j'etait toi, j'ferait plutot :
if(PPos[i][1] != 0)
{
//Ton code de verification d'AFK
}
else
{
GetPlayerPos(i,PPos[i][0],PPos[i][1],PPos[i][2]);
}
Pour la suite j'ai pas encore regarder mais esseyer deja sa et verifie que tu lance bien le timer sur la fonction AFKKicker ;)