25.11.2012, 10:02
I wanna to make my cmd /mute with reason and then when i mute Player to get message "Nick was muted by [KOD]MrTinder for 20 minutes,Reason:Test".Thanks
pawn Код:
if(strcmp(cmd, "/mute", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /mute [Playerid/PartOfName] [time] [reason]");
return 1;
}
new playa;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
new time = strval(tmp);
if (PlayerInfo[playerid][pAdmin] >= 1)
{
if(IsPlayerConnected(playa))
{
if(PlayerInfo[playa][pAdmin] > PlayerInfo[playerid][pAdmin])
{
SendClientMessage(playerid, COLOR_GREY, "You can't mute higher admin level!");
return 1;
}
if(playa != INVALID_PLAYER_ID)
{
PlayerInfo[playa][ptMuted] = time*60;
PlayerInfo[playa][pMuted] = 1;
format(string, sizeof(string), "ADMIN: %s was muted by %s for %d minutes",PlayerName(playa), PlayerName(playerid), time);
SendClientMessageToAll(COLOR_LIGHTRED,string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You didn't have admin access!");
}
}
return 1;
}