31.03.2014, 05:31
(
Последний раз редактировалось LocMax; 31.03.2014 в 06:21.
)
Because you use return 0; everywhere.
btw I made a bit optimized version, not tested tho.
pawn Код:
if(pInfo[playerid][Adminlevel] >= 1)
{
if(strcmp(text,"!warn",true,5))
{
new ID,reason[50];
if(sscanf(text,"us[50]",ID,reason)) return SendClientMessage(playerid,COLOR_ERROR,"USAGE: !warn (Player Name/ID) (Reason)");
if(ID == INVALID_PLAYER_ID) return format(string,sizeof(string),"ID %d is not connected to the server.",ID), SendClientMessage(playerid, -1, string);
if(WarnTimes[ID] >= 2)
{
format(string,sizeof(string),"%s(%d) has been auto kicked from the server because he has reached maximum warnings [3/3 Warnings].",GetName(ID),ID);
SendClientMessageToAll(COLOR_PINK,string);
format(string, sizeof(string), "~W~You Have Been ~R~Kicked ~W~From The Server");
GameTextForPlayer(ID ,string, 99999999999999999999999, 3);
KickTime[ID] = 3;
}
else
{
WarnTimes[ID]+=1;
if(WarnTimes[ID]==1)
{
format(string,sizeof(string),"%s(%d) has warned %s(%d) reason: %s. [1/3 Warnings].",GetName(playerid),playerid,GetName(ID),ID,reason);
SendClientMessageToAll(COLOR_PINK,string);
}
else if(WarnTimes[ID]==2)
{
format(string,sizeof(string),"%s(%d) has warned %s(%d) reason: %s. [2/3 Warnings].",GetName(playerid),playerid,GetName(ID),ID,reason);
SendClientMessageToAll(COLOR_PINK,string);
}
}
}
return 0;
}
pawn Код:
if(pInfo[playerid][Adminlevel] >= 1)
{
if(strcmp(text,"!warn",true,5))
{
new ID, reason[50];
if(sscanf(text,"us[50]",ID,reason)) return SendClientMessage(playerid,COLOR_ERROR,"USAGE: !warn (Player Name/ID) (Reason)");
if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_ERROR, "Target ID is not valid.");
new string[124], WarnTimes[ID]++;
if(WarnTimes[ID] >= 3)
{
format(string,sizeof(string),"%s(%d) has been automatically kicked. Reason: 3/3 warnings.",GetName(ID),ID);
SendClientMessageToAll(COLOR_PINK,string);
GameTextForPlayer(ID, "~W~You have been ~R~kicked ~W~from the server", 99999999, 3);
KickTime[ID] = 3;
}
else if(WarnTimes[ID] < 3)
{
format(string,sizeof(string),"%s(%d) has warned %s(%d) reason: %s. [%d/3 Warnings].",GetName(playerid),playerid,GetName(ID),ID,reason, WarnTimes[ID]);
SendClientMessageToAll(COLOR_PINK,string);
}
}
return 0;
}