[HELP] /oprison command
#5

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.
Reply


Messages In This Thread
[HELP] /oprison command - by StopFondlinMe - 26.11.2012, 01:55
Re: [HELP] /oprison command - by Camorra - 26.11.2012, 04:27
Re: [HELP] /oprison command - by StopFondlinMe - 26.11.2012, 21:44
Re: [HELP] /oprison command - by StopFondlinMe - 27.11.2012, 01:52
Re: [HELP] /oprison command - by maramizo - 27.11.2012, 02:08

Forum Jump:


Users browsing this thread: 1 Guest(s)