26.03.2014, 02:49
pawn Код:
CMD:oprison(playerid, params[])
{
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on Admin Duty.");
new playerb[MAX_PLAYER_NAME + 1], time, reason[120];
if(sscanf(params, "s[" #MAX_PLAYER_NAME "]is[120]", playerb, time, reason)) SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /oprison [playername] [time] [reason]");
else if(RPIDFN(playerb) != INVALID_PLAYER_ID) SendClientMessage(playerid, COLOR_GREY, "Player is connected to the server, use /prison instead.");
else{
new file[35];
format(file, sizeof(file), "users/%s.ini", playerb);
if(!dini_Exists(file)) SendClientMessage(playerid, COLOR_GREY, "Player name not found.");
else if(PlayerInfo[playerid][pAdmin] < dini_Int(file, "Admin")) SendClientMessage(playerid, COLOR_GREY, "Player has a higher admin level than you.");
else{
new string[128];
format(string, sizeof(string), "AdmCmd: %s has been offline-prisoned by %s, reason: %s", playerb, RPN(playerid), reason);
SendClientMessageToAll(COLOR_LIGHTRED, string);
// Prisoning
dini_IntSet(file, "pPrison", 1);
// Prisonreason
dini_Set(file, "pPrisonReason", reason);
dini_Set(file, "pPrisonBy", RPNU(playerid));
dini_IntSet(file, "pPrisonTime", time);
}
}
return 1;
}