Need help with Offline Prison
#1

Hello,

I tried to make an Offline Prison command, but it doesn't set the player when he logs in to jail, his time etc.

this is the code:


pawn Код:
command(oprison, playerid, params[])
{
    new Name[128], string[128], string2[128], time, Reason[128];
    if(sscanf(params, "zdz", Name, time, Reason))
    {
        if(Player[playerid][AdminLevel] >= 6)
        {
            SendClientMessage(playerid, WHITE, "SYNTAX: /oprison [name] [time] [reason]");
            SendClientMessage(playerid, GREY, "NOTE: This command is CaSe SeNsItIvE.");
        }
    }
    else
    {
        if(Player[playerid][AdminLevel] >= 6)
        {
            if(strlen(Name) >= 3 && strlen(Name) < MAX_PLAYER_NAME+1)
            {
                format(string2, sizeof(string2), "Accounts/%s.ini", Name);
                if(fexist(string2))
                {
                    if(dini_Int(string, "AdminLevel") < Player[playerid][AdminLevel])
                    {
                        dini_IntSet(string, "PrisonDuration", time);
                        dini_IntSet(string, "PrisonID", 1);
                        format(string, sizeof(string), "Prison: %s has been prisoned by %s, reason: %s (%d minutes).", Name, GetName(playerid), Reason, time);
                        SendClientMessageToAll(RED, string);
                        format(string, sizeof(string), "%s has offine prisoned %s", GetName(playerid), Name);
                        SendToAdmins(ADMINORANGE, string, 1);
                    }
                    else
                    {
                        SendClientMessage(playerid, WHITE, "You can't prison a higher level admins' account.");
                    }
                }
                else
                {
                    SendClientMessage(playerid, WHITE, "Account not found.");
                }
            }
        }
    }
}
Reply
#2

You didnt tell the command to jail the player it just like sends a message to the admins
Reply
#3

pawn Код:
dini_IntSet(string, "PrisonDuration", time);
                        dini_IntSet(string, "PrisonID", 1);
??
Reply
#4

Quote:
Originally Posted by Stefand
Посмотреть сообщение
pawn Код:
dini_IntSet(string, "PrisonDuration", time);
                        dini_IntSet(string, "PrisonID", 1);
??
oh ok i see it now
Reply
#5

pawn Код:
format(string2, sizeof(string2), "Accounts/%s.ini", Name);
dini_IntSet(string, "PrisonDuration", time);
dini_IntSet(string, "PrisonID", 1);
string and string2 ? Should be same
Reply
#6

Fixed it now so far that it works only there is a mistake with the time

pawn Код:
command(oprison, playerid, params[])
{
    new Name[128], string[128], time, Reason[128];
    if(sscanf(params, "zdz", Name, time, Reason))
    {
        if(Player[playerid][AdminLevel] >= 6)
        {
            SendClientMessage(playerid, WHITE, "SYNTAX: /oprison [name] [time] [reason]");
            SendClientMessage(playerid, GREY, "NOTE: This command is CaSe SeNsItIvE.");
        }
    }
    else
    {
        if(Player[playerid][AdminLevel] >= 6)
        {
            if(strlen(Name) >= 3 && strlen(Name) < MAX_PLAYER_NAME+1)
            {
                format(string, sizeof(string), "Accounts/%s.ini", Name);
                if(fexist(string))
                {
                    if(dini_Int(string, "AdminLevel") < Player[playerid][AdminLevel])
                    {
                        dini_IntSet(string, "PrisonDuration", time);
                        dini_IntSet(string, "PrisonID", 1);
                        format(string, sizeof(string), "Prison: %s has been prisoned by %s, reason: %s (%d minutes).", Name, GetName(playerid), Reason, time);
                        SendClientMessageToAll(RED, string);
                        format(string, sizeof(string), "%s has offine prisoned %s", GetName(playerid), Name);
                        SendToAdmins(ADMINORANGE, string, 1);
                    }
                    else
                    {
                        SendClientMessage(playerid, WHITE, "You can't prison a higher level admins' account.");
                    }
                }
                else
                {
                    SendClientMessage(playerid, WHITE, "Account not found.");
                }
            }
        }
    }
}
When i prison someone it gives him 0 seconds, can someone look into it now?
Reply
#7

Had the same problem, changed time to output. Might be diffrent at you as you

Код:
new output[257];
Код:
			output = strrest(cmdtext,idx);
		       	if(!strlen(output))
				{
					SendClientMessage(playerid, WHITE, "/oprison [name] [time] [reason]");
					return 1;
				}
Код:
dini_IntSet(string, "PrisonDuration", output);
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)