17.08.2015, 03:26
Hello, with my project partner we have been working on an alive counter, i've been working on it since 02:19 and it's already 05:23
We are doing the Race DM mode of our Multi Mode
and we have been the players alive counter go down and up when a player dies, spawns, is spectating, gets in a vehicle etc...
There was many bugs, and made it to fix all of them (yay)
The problem comes when the player disconnects, i want to make the counter go down when a player on the Race DM mode disconnects, the problem is that it doesn't, it stays at the same place!
There is no errors nor warnings when i compile and everything seems to be fine, so i came here asking for help ^^
Here is my code:
We are doing the Race DM mode of our Multi Mode
and we have been the players alive counter go down and up when a player dies, spawns, is spectating, gets in a vehicle etc...
There was many bugs, and made it to fix all of them (yay)
The problem comes when the player disconnects, i want to make the counter go down when a player on the Race DM mode disconnects, the problem is that it doesn't, it stays at the same place!
There is no errors nor warnings when i compile and everything seems to be fine, so i came here asking for help ^^
Here is my code:
PHP код:
public OnPlayerDisconnect(playerid, reason)
{
// Login Register system, and leaving messages here!
// From here is the alive counter!
new alive[3];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (pInfo[playerid][DM] && pInfo[i][DM] == 1)
{
SetPlayerHealth(playerid, 0);
AlivePlayers-=1;
if (AlivePlayers < 10)
{
format(alive, sizeof(alive), "0%i", AlivePlayers);
}
else if (AlivePlayers > 9)
{
format(alive, sizeof(alive), "%i", AlivePlayers);
}
TextDrawSetString(numberal, alive);
TextDrawShowForPlayer(i, albox1);
TextDrawShowForPlayer(i, albox2);
TextDrawShowForPlayer(i, Alive);
TextDrawShowForPlayer(i, numberal);
}
}
return 1;
}