[HELP] /oprison command
#1

Anyone have an idea on how to script an /oprison command?

Basically it offline prisons someone for breaking a rule. Forum complaints and stuff like that.
Reply
#2

Can you explain which system you use, i mean, y ini, dini, mysql.
Reply
#3

dini
Reply
#4

anyone?
Reply
#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


Forum Jump:


Users browsing this thread: 1 Guest(s)