GTAOnline.net
San Andreas Multiplayer (sa:mp) => Scripting SA-MP [Pawn center] => Discussion démarrée par: Komolos le 10 Novembre 2010, 15:12:47
-
Bonjour,
J'ai un problème avec mon système d'afk, j'aimerai que s'y un membre du staff et AFK, sa le kick pas.
public AFK(playerid)
{
new nomjoueur[MAX_PLAYER_NAME];
new Float:x,Float:y,Float:z,string[128];
for(new i=0;i<MAX_PLAYERS;i++)
{
GetPlayerName(i, nomjoueur, sizeof(nomjoueur));
if(IsPlayerConnected(i))
{
if(PlayerInfo[playerid][pAdmin] == 0)
{
GetPlayerPos(i,x,y,z);
if(AFKPos[i][1] == 0)
{
AFKPos[i][0] = x;
AFKPos[i][1] = y;
AFKPos[i][2] = z;
}
else if(x == AFKPos[i][0] && y == AFKPos[i][1] && z == AFKPos[i][2])
{
AFKMin[i]++;
if(AFKMin[i] >= AFKMaxMin)
{
format(string,sizeof(string),"[INFO] %s a été kické. Raison: AFK pendant plus de %d minutes",nomjoueur,AFKMaxMin);
SendClientMessageToAll(COLOR_LIGHTRED,string);
Kick(i);
}
}
AFKPos[i][0] = x;
AFKPos[i][1] = y;
AFKPos[i][2] = z;
}
}
}
}
Voilà, merci d'avance ^^
-
suffit de remplacer if(!IsPlayerAdmin(i)) par if(PlayerInfo[playerid][pAdmin] == 0)
IsPlayerAdmin, check les admins rcon ;)
Pourquoi j'ai mis 0 ? Car si le joueur n'est pas admin on va prendre la peine de prendre sa position et de la comparer. Si il l'est on stop le script et on évite les calculs inutile :)
-
Merci mais ça marche pas :s
-
Edit ton script pour voir ce que tu as fait :)
-
Voilà ce que j'ai fait ^^
-
Tu as des érreurs
-
ça kick quand même les admins ? ^^
-
Oui ça kick quand même les admins, j'avait pensé à faire ça :
if (PlayerInfo[playerid][pAdmin] >= 1) non ?
-
non ^^ Parce que justement là çava kické qe les joueurs qui sont admins ^^