SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 06/06/2012, 06:42 PM   #1
Stefand
Gangsta
 
Stefand's Avatar
 
Join Date: Sep 2011
Location: The Netherlands
Posts: 772
Reputation: 30
Default Need help with Offline Prison

Hey,

I made a Offline prison command,
But when i enter time e.g. 5 mins, and the player logs in it gives him 0.

can someone look at it?

pawn Code:
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.");
                }
            }
        }
    }
}
__________________


Scripter & Mapper
_______________________
Stefand is offline   Reply With Quote
Old 06/06/2012, 08:24 PM   #2
Stefand
Gangsta
 
Stefand's Avatar
 
Join Date: Sep 2011
Location: The Netherlands
Posts: 772
Reputation: 30
Default Re: Need help with Offline Prison

Someone?
__________________


Scripter & Mapper
_______________________
Stefand is offline   Reply With Quote
Old 07/06/2012, 10:00 AM   #3
Stefand
Gangsta
 
Stefand's Avatar
 
Join Date: Sep 2011
Location: The Netherlands
Posts: 772
Reputation: 30
Default Re: Need help with Offline Prison

Really nobody that can help?
__________________


Scripter & Mapper
_______________________
Stefand is offline   Reply With Quote
Old 07/06/2012, 10:32 AM   #4
MadeMan
High-roller
 
MadeMan's Avatar
 
Join Date: Jun 2007
Posts: 3,488
Reputation: 256
Default Re: Need help with Offline Prison

How do you know it gives 0 on login? Show the code.
MadeMan is offline   Reply With Quote
Old 07/06/2012, 11:00 AM   #5
Stefand
Gangsta
 
Stefand's Avatar
 
Join Date: Sep 2011
Location: The Netherlands
Posts: 772
Reputation: 30
Default Re: Need help with Offline Prison

Look up, I tested this with a friend, he logged in again, and it said Released from prison(and it says that when your time is over) so it sets the time to 0 seconds...
__________________


Scripter & Mapper
_______________________
Stefand is offline   Reply With Quote
Old 07/06/2012, 11:04 AM   #6
MadeMan
High-roller
 
MadeMan's Avatar
 
Join Date: Jun 2007
Posts: 3,488
Reputation: 256
Default Re: Need help with Offline Prison

Show the code that loads the time from file and releases the player from jail.
MadeMan is offline   Reply With Quote
Old 07/06/2012, 11:10 AM   #7
Stefand
Gangsta
 
Stefand's Avatar
 
Join Date: Sep 2011
Location: The Netherlands
Posts: 772
Reputation: 30
Default Re: Need help with Offline Prison

pawn Code:
if(Player[i][PrisonID] >= 1)
            {
                if(Player[i][PrisonDuration] >= 1)
                {
                    new string[128];
                    Player[i][PrisonDuration]--;
                    format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~ ~R~%d seconds (%d minutes)", Player[i][PrisonDuration], SecondsToMinutes(Player[i][PrisonDuration]));
                    GameTextForPlayer(i, string, 1000, 3);
                }
                else
                {
                    if(Player[i][PrisonID] == 1)
                    {
                        Player[i][PrisonDuration] = 0;
                        Player[i][PrisonID] = 0;
                        SetPlayerPos(i, SpawnX, SpawnY, SpawnZ);
                        SetPlayerVirtualWorld(i, SpawnWorld);
                        SetPlayerInterior(i, SpawnInt);
                        SendClientMessage(i, WHITE, "You have been released from Admin Prison.");
                        TogglePlayerControllable(i, true);
                    }
                    else
                    {
                        Player[i][PrisonDuration] = 0;
                        Player[i][PrisonID] = 0;
                        SetPlayerPos(i, 1480.5245, -1777.0061, 3281.7954);
                        SetPlayerVirtualWorld(i, SpawnWorld);
                        SetPlayerInterior(i, Groups[1][HQInteriorID]);
                        SendClientMessage(i, WHITE, "You have been released from Jail.");
                        TogglePlayerControllable(i, true);
                    }
                }
            }
        }
    }
    return 1;
}
__________________


Scripter & Mapper
_______________________
Stefand is offline   Reply With Quote
Old 07/06/2012, 11:13 AM   #8
MadeMan
High-roller
 
MadeMan's Avatar
 
Join Date: Jun 2007
Posts: 3,488
Reputation: 256
Default Re: Need help with Offline Prison

Quote:
Originally Posted by MadeMan View Post
Show the code that loads the time from file
This one too.
MadeMan is offline   Reply With Quote
Old 07/06/2012, 11:15 AM   #9
Stefand
Gangsta
 
Stefand's Avatar
 
Join Date: Sep 2011
Location: The Netherlands
Posts: 772
Reputation: 30
Default Re: Need help with Offline Prison

pawn Code:
Player[i][PrisonDuration]

It loads the Time when he logs in.
__________________


Scripter & Mapper
_______________________
Stefand is offline   Reply With Quote
Old 07/06/2012, 11:22 AM   #10
MadeMan
High-roller
 
MadeMan's Avatar
 
Join Date: Jun 2007
Posts: 3,488
Reputation: 256
Default Re: Need help with Offline Prison

Quote:
Originally Posted by Stefand View Post
pawn Code:
Player[i][PrisonDuration]

It loads the Time when he logs in.
If you want somebody to help you, you have to show the code.
MadeMan is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with Offline Prison Stefand Scripting Help 6 06/06/2012 08:15 PM
Help with Offline Prison Stefand Server Support 1 05/06/2012 10:56 PM
offline prison ban system Thomas_A Help Archive 5 27/11/2010 12:43 AM


All times are GMT. The time now is 07:50 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.