Jail Game text.
#1

Hi guys.

So i was wondering... How could i make a player that is in jail see the time that he has to be there.

I copied my /count comand..
I already changer the variables.
It looks like this:

Bottom of my GM
Код:
public JailTime(){
if (JailText > 0){
GameTextForAll( JailTimeText[JailText-1], 1000, 3);
JailText--;
SetTimer("JailTimeText", 1000, 0);
}
return 1;}
Top of my GM
Код:
//Jail
forward Jail(playerid, killerid);
forward JailTime();
new JailText = 5;
new JailTimeText[5][5] ={
"1",
"2",
"3",
"4",
"5",
};
So for example if i want player to sit in jail for 3 mins.. do i have to add it like this? :

Код:
new JailTimeText[5][5] ={
"1",
"2",
"3",
"4",
"5",
...,
...,
...,
...,
...,
"300"
};
That would take up 300 lines or is there a easier way of doing it?
Reply
#2

Sorry for the double post, but really can't anyone help me? Please.
Reply
#3

pawn Код:
new JailText[MAX_PLAYERS];

public JailTime()
{
    new string[128];   
    for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
    {  
        if(JailText[playerid] > 0)
        {
            JailText[playerid]--;      
            format(string, sizeof(string), "Jail time: %d seconds left !", JailText[playerid]);
            GameTextForPlayer(playerid, string, 1000, 4);
        }
    }  
    return 1;
}
EDIT: There where the player should be jailed you should write how much ' JailText[playerid] ' is.

Example:

pawn Код:
JailText[playerid] = 300;
Reply
#4

Thanks i modified it a bit and it works now.
Reply
#5

Again sorry for double post..

Sooo how could i make it repeat that 1 second?

Код:
public JailTime()
{
    new string[128];
    for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
    {
        if (JailText[playerid] > 0)
        {
            JailText[playerid] = 300;
            JailText[playerid]--;
            format(string, sizeof(string), "Jail: %d", JailText[playerid]);
            GameTextForPlayer(playerid, string, 1000, 4);
        }
    }
    return 1;
}
Reply
#6

You should put that

pawn Код:
JailText[playerid] = 300;
somewhere else because what it does now is repeating from ' 300 ' to ' 299 ' and then again the same.

Put it where the player gets jailed.

If you have a ' /jail [id] ' command then you should put it there.
Reply
#7

Basicaly it just shows 299 for me and imideatley disapears.. any ideas?
Reply
#8

Where is your timer for ' public JailTime() ' ?

pawn Код:
SetTimer("JailTime", 1000, 1);
Make sure that it has a ' 1 ' set at the end, which means it repeats it and not only one time.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)