• 04 Juin 2026, 16:37:16


Auteur Sujet: aide système anti afk  (Lu 1157 fois)

0 Membres et 1 Invité sur ce sujet

Hors ligne Komolos

  • *
  • Tueur en série
  • Messages: 190
    • Voir le profil
aide système anti afk
« 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;
}











(

Hors ligne MrFredo

  • *
  • Grand Banditisme
  • Scripteur PHP/PAWN
  • Messages: 953
    • Voir le profil
    • GTA-Hosting
Re : aide système anti afk
« Réponse #1 le: 01 Septembre 2010, 10:04:01 »
Ce code:

Code: (pawn) [Sélectionner]
           
 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 :

Code: (pawn) [Sélectionner]
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 ;)