pawn Код:
CMD:jailaccount(playerid, params[])
{
new string[128], name[MAX_PLAYER_NAME], minutes;
if(sscanf(params, "s[MAX_PLAYER_NAME]d", name, minutes)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /jailaccount [playername] [time (minutes)]");
if(AccountExists(name)) //Check if the account exists by checking if the file exists, reading from it and strlen(string read) being larger than 1.
{
LoadAccount(name); //Loads the account information, I.e PlayerInformation[playerid][JailTime]
//but instead of playerid, it should load into PlayerInformation[MAX_PLAYERS][JailTime]
//as the extra slot being used for offline players.
PlayerInformation[MAX_PLAYERS][JailTime] = minutes; //Or however jailtime is stored/used on your server.
SaveAccount(name); //This writes back into the file, after changing the parameters needed.
new year, month,day;
getdate(year, month, day);
format(string, sizeof(string), "Player %s was offline jailed by %s (%d-%d-%d)", name, GetPlayerNameEx(playerid),month,day,year); //GetPlayerNameEx(playerid) is a function made to return the name, instead of storing it into a string.
Log("logs/jailaccount.log", string); //Logging the command been used, to prevent abuse by administrators.
format(string, 128, "You have prisoned %s for %i minutes.", name, minutes);
SendClientMessage(playerid, -1, string); //confirmation so that the administrator is sure the command worked as he wanted it to.
return 1;
}
else //If the account does not exist.
{
SendClientMessage(playerid, -1, "That player does not exist.");
return 1;
}
}
Please note that this is just an idea towards what you're aimed at.