Jail Game text. - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Jail Game text. (
/showthread.php?tid=228170)
Jail Game text. -
Shetch - 19.02.2011
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?
Re: Jail Game text. -
Shetch - 19.02.2011
Sorry for the double post, but really can't anyone help me? Please.
Re: Jail Game text. -
Serbish - 19.02.2011
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;
Re: Jail Game text. -
Shetch - 19.02.2011
Thanks i modified it a bit and it works now.
Re: Jail Game text. -
Shetch - 19.02.2011
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;
}
Re: Jail Game text. -
Serbish - 19.02.2011
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.
Re: Jail Game text. -
Shetch - 19.02.2011
Basicaly it just shows 299 for me and imideatley disapears.. any ideas?
Re: Jail Game text. -
Serbish - 19.02.2011
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.