11.08.2014, 11:57
PHP код:
if(strcmp(cmd, "/warn", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "Използвай: /warn [Playerid/PartOfName] [reason]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (PlayerInfo[playerid][pAdmin] >= 1)
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[256];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_WHITE, "Използвай: /warn [Playerid/PartOfName] [reason]");
return 1;
}
PlayerInfo[giveplayerid][pWarns] += 0;
if(PlayerInfo[giveplayerid][pWarns] == 5)
{
format(string, sizeof(string), "%s кикна %s, защото той събра 5 предупреждения. Причина: %s", PlayerName(playerid), giveplayer, (result));
SendClientMessageToAll(COLOR_RED, string);
Kick(playerid);
return 1;
}
if(PlayerInfo[giveplayerid][pWarns] += 1)
format(string, sizeof(string), "%s was warned by %s [%d/5]. [Reason: %s]", giveplayer, PlayerName(playerid), PlayerInfo[giveplayerid][pWarns], (result));
SendClientMessageToAll(COLOR_RED, string);
format(string, sizeof(string), "%s ти сложи предупреждение. Причина: %s", PlayerName(playerid), (result));
SendClientMessage(giveplayerid, COLOR_RED, string);
return 1;
}
}
}
else
{
format(string, sizeof(string), " Посоченото ID не е в сървъра.");
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
return 1;
}