22.12.2011, 04:00
I am using a text draw to show that players; leave/join/kick/time.. But they dont go in order? It kinda jumps around to where ever. I want the bottom message to be the newest. then the top to go away when a new bottom is added. Here is pictures;
In the first screen shot he got kicked but it showed it above the join. First screen shot
In the second he joins, but it replaces the kick with a join. Second screen shot
in the third he leaves, and it replaces his join message with a leave Third screen shot
here is the code:
In the first screen shot he got kicked but it showed it above the join. First screen shot
In the second he joins, but it replaces the kick with a join. Second screen shot
in the third he leaves, and it replaces his join message with a leave Third screen shot
here is the code:
pawn Код:
#define CONNECT_MESSAGES (5)
new Text:ConnectTextdraw[CONNECT_MESSAGES];
new CurrentIndex;
public OnFilterScriptInit()
{
for(new i=0; i < CONNECT_MESSAGES; i++)
{
ConnectTextdraw[i] = TextDrawCreate(496.000000, 253.000000 + (i * 10), "_");
TextDrawBackgroundColor(ConnectTextdraw[i], 255);
TextDrawFont(ConnectTextdraw[i], 1);
TextDrawLetterSize(ConnectTextdraw[i], 0.2, 1.2);
TextDrawColor(ConnectTextdraw[i], -1);
TextDrawSetOutline(ConnectTextdraw[i], 1);
TextDrawSetProportional(ConnectTextdraw[i], 1);
}
return 1;
}
public OnPlayerConnect(playerid)
{
new playerName[MAX_PLAYER_NAME], string[64];
GetPlayerName(playerid, playerName, sizeof(playerName));
format(string, sizeof(string), "~g~join:~w~%s(%i)", playerName, playerid);
TextDrawHideForAll(ConnectTextdraw[CurrentIndex]);
TextDrawSetString(ConnectTextdraw[CurrentIndex], string);
TextDrawShowForAll(ConnectTextdraw[CurrentIndex]);
for(new i=0; i < CONNECT_MESSAGES; i++)
{
TextDrawShowForPlayer(playerid, ConnectTextdraw[i]);
}
return (CurrentIndex + 1 != CONNECT_MESSAGES) ? (CurrentIndex ++) : (CurrentIndex = 0);
}
public OnPlayerDisconnect(playerid, reason)
{
new playerName[MAX_PLAYER_NAME], string[64];
GetPlayerName(playerid, playerName, sizeof(playerName));
format(string, sizeof(string), "~r~%s: ~w~%s(%i)", (reason == 0) ? ("TIME") : ((reason == 1) ? ("QUIT") : ("KICK")),playerName, playerid);
TextDrawHideForAll(ConnectTextdraw[CurrentIndex]);
TextDrawSetString(ConnectTextdraw[CurrentIndex], string);
TextDrawShowForAll(ConnectTextdraw[CurrentIndex]);
return (CurrentIndex + 1 != CONNECT_MESSAGES) ? (CurrentIndex ++) : (CurrentIndex = 0);
}
public OnGameModeExit()
{
for(new i=0; i < CONNECT_MESSAGES; i++)
{
TextDrawDestroy(ConnectTextdraw[i]);
}
return 1;
}