SA-MP Forums Archive
[HELP] /oprison command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [HELP] /oprison command (/showthread.php?tid=395385)



[HELP] /oprison command - StopFondlinMe - 26.11.2012

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.


Re: [HELP] /oprison command - Camorra - 26.11.2012

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


Re: [HELP] /oprison command - StopFondlinMe - 26.11.2012

dini


Re: [HELP] /oprison command - StopFondlinMe - 27.11.2012

anyone?


Re: [HELP] /oprison command - maramizo - 27.11.2012

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.