26.04.2013, 14:23
Guys i made a command /warn but i dont know what is problem in the command when i run on the player like /warn 0 Test i going on only 2 warn after 2 warns its not adding 3rd warn so check the code and fix it please
Here is code
Here is code
pawn Код:
dcmd_warn(playerid,params[])
{
if(IsLogged[playerid] != 1) return SendClientMessage(playerid,-1,"You are not logged in");
if(PlayerInfo[playerid][AdminLevel] >= 1)
{
new Index;
new tmp[256]; tmp = strtok(params,Index);
new tmp2[256]; tmp2 = strtok(params,Index);
if(!strlen(params)) return
SendClientMessage(playerid, COLOR_WHITE, "Usage: /warn [PlayerID/PartOfName] [Reason]") &&
SendClientMessage(playerid, COLOR_ORANGE, "Function: Will warn the specified player");
new player1;
player1 = strval(tmp);
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && (PlayerInfo[player1][AdminLevel] !=1) )
{
if(strlen(tmp2))
{
PlayerInfo[player1][Warnings] = 1;
new Warned[MAX_PLAYER_NAME], Warner[MAX_PLAYER_NAME], string5[128],string3[128], string4[128];
GetPlayerName(player1, Warned, sizeof(Warned));
GetPlayerName(playerid, Warner, sizeof(Warner));
format(string3, sizeof(string3), "An admin has Warned you for For Reason: %s.", params[2]);
format(string4, sizeof(string4), "You have warned %s.", Warner);
SendClientMessage(player1, COLOR_SYSTEM, string3);
SendClientMessage(playerid, COLOR_SYSTEM, string4);
format(string5, sizeof(string5), "%s Has been Warned by An Admin for Reason: %s", Warned, params[2]);
SendClientMessageToAll(COLOR_RED, string5);
PlayerInfo[player1][Warnings] = PlayerInfo[player1][Warnings]+1;
}
if(PlayerInfo[player1][Warnings] == 3)
{
new string6[200],Warned[MAX_PLAYER_NAME];
format(string6, sizeof(string6), "%s Has been Kicked from the server for Reason: Alot of Warnings", Warned);
SendClientMessageToAll(COLOR_RED, string6);
PlayerInfo[player1][Warnings] = 0;
Kick(player1);
}
}
else return SendClientMessage(playerid, red, "ERROR: Player is not connected or is the highest level admin");
}
return 1;
}