Players count + IsPlayerIsRangeOfPointh
#1

Hello Goodnight.

I have a problem regarding the players count a minigame, and the use of IsPlayerIsRangeOfPointh.

COUNTING PLAYERS:
The problem I have with this code, is that I have it configured to count the players who are in a particular minigame. But the bug appears when a player is disconnected, being inside a minigame, and is there where the bug occurs, and when I entered the same minigame, and get out, get -1.
And uh I tried to put the remainder Player in OnPlayerDisconnect but not solved.

Code:


Код HTML:
if(EsSniper[playerid] == 1)
    {
    EsSniper[playerid] = 0;
    Members[TEAM_SJ]--;
    format(Entrada1, sizeof(Entrada1), "{00FF00}SJ: %s saliу. [Jugadores: %d]", PlayerName2(playerid),Members[TEAM_SJ]);
    MensajeJuego(COLOR_GREEN, Entrada1);
    }
    if(EsJester[playerid] == 1)
    {
    EsJester[playerid] = 0;
    Members[TEAM_SJ]--;
    format(Entrada2, sizeof(Entrada2), "{00FF00}SJ: %s saliу. [Jugadores: %d]", PlayerName2(playerid),Members[TEAM_SJ]);
    MensajeJuego(COLOR_GREEN, Entrada2);
    }
    if(EstaEnDesmadre[playerid] == 1)
    {
    EstaEnDesmadre[playerid] = 0;
    Members[TEAM_DM]--;
    format(Entrada1, sizeof(Entrada1), "{00FF00}DM: %s saliу. [Jugadores: %d]", PlayerName2(playerid),Members[TEAM_DM]);
    MensajeJuego(COLOR_GREEN, Entrada1);
    }
    if(EsAtacante[playerid] == 1)
    {
    EsAtacante[playerid] = 0;
    Members[TEAM_OP7]--;
    format(Entrada2, sizeof(Entrada2), "{00FF00}OP7: %s saliу. [Jugadores: %d]", PlayerName2(playerid),Members[TEAM_OP7]);
    MensajeJuego(COLOR_GREEN, Entrada2);
    }
    if(EsDefensor[playerid] == 1)
    {
    EsDefensor[playerid] = 0;
    Members[TEAM_OP7]--;
    format(Entrada1, sizeof(Entrada2), "{00FF00}OP7: %s saliу. [Jugadores: %d]", PlayerName2(playerid),Members[TEAM_OP7]);
    MensajeJuego(COLOR_GREEN, Entrada2);
    }
    if(EsAleman[playerid] == 1)
    {
    EsAleman[playerid] = 0;
    Members[TEAM_COD]--;
    format(Entrada2, sizeof(Entrada2), "{00FF00}COD: %s saliу. [Jugadores: %d]", PlayerName2(playerid),Members[TEAM_COD]);
    MensajeJuego(COLOR_GREEN, Entrada2);
    }
    if(EsUrss[playerid] == 1)
    {
    EsUrss[playerid] = 0;
    Members[TEAM_COD]--;
    format(Entrada2, sizeof(Entrada2), "{00FF00}COD: %s saliу. [Jugadores: %d]", PlayerName2(playerid),Members[TEAM_COD]);
    MensajeJuego(COLOR_GREEN, Entrada2);
    }
    if(EsCapitalista[playerid] == 1)
    {
    EsCapitalista[playerid] = 0;
    Members[TEAM_BT]--;
    format(Entrada2, sizeof(Entrada2), "{00FF00}BT: %s saliу. [Jugadores: %d]", PlayerName2(playerid),Members[TEAM_BT]);
    MensajeJuego(COLOR_GREEN, Entrada2);
    }
    if(EsComunista[playerid] == 1)
    {
    EsComunista[playerid] = 0;
    Members[TEAM_BT]--;
    format(Entrada1, sizeof(Entrada1), "{00FF00}BT: %s saliу. [Jugadores: %d]", PlayerName2(playerid),Members[TEAM_BT]);
    MensajeJuego(COLOR_GREEN, Entrada1);
    }
    if(EsPolicia[playerid] == 1)
    {
    EsPolicia[playerid] = 0;
    Members[TEAM_CS]--;
    format(Entrada2, sizeof(Entrada2), "{00FF00}CS: %s saliу. [Jugadores: %d]", PlayerName2(playerid),Members[TEAM_CS]);
    MensajeJuego(COLOR_GREEN, Entrada2);
    }
    if(EsTerrorista[playerid] == 1)
    {
    EsTerrorista[playerid] = 0;
    Members[TEAM_CS]--;
    format(Entrada1, sizeof(Entrada1), "{00FF00}CS: %s saliу. [Jugadores: %d]", PlayerName2(playerid),Members[TEAM_CS]);
    MensajeJuego(COLOR_GREEN, Entrada1);
    }
    if(EstaEnSniper[playerid] == 1)
    {
    EstaEnSniper[playerid] = 0;
    Members[TEAM_SS]--;
    format(Entrada2, sizeof(Entrada2), "{00FF00}SS: %s saliу. [Jugadores: %d]", PlayerName2(playerid),Members[TEAM_SS]);
    MensajeJuego(COLOR_GREEN, Entrada2);
    }
    if(EstaEnRecortada[playerid] == 1)
    {
    EstaEnRecortada[playerid] = 0;
    Members[TEAM_JRW]--;
    format(Entrada1, sizeof(Entrada1), "{00FF00}JRW: %s saliу. [Jugadores: %d]", PlayerName2(playerid),Members[TEAM_JRW]);
    MensajeJuego(COLOR_GREEN, Entrada1);
    }
    if(EstaEnD1[playerid] == 1)
    {
    EstaEnD1[playerid] = 0;
    Members[TEAM_D1]--;
    format(Entrada2, sizeof(Entrada2), "{00FF00}DM1: %s saliу. [Jugadores: %d]", PlayerName2(playerid),Members[TEAM_D1]);
    MensajeJuego(COLOR_GREEN, Entrada2);
    }
IsPlayerIsRangeOfPointh
The problem with this variable is that when a player want that near a vehicle an textdraw appears, and when you leave, disappear TextDraw, but not working properly, here the code:
Код HTML:
public EstaCerca(playerid)
{
    new Float:vehx, Float:vehy, Float:vehz;
    new vehicleid = GetPlayerVehicleID(playerid);
    GetVehiclePos(vehicleid, vehx, vehy, vehz);
    if(IsPlayerInRangeOfPoint(playerid, 7.0, vehx, vehy, vehz))
    {
        new StringV[100];
        format(StringV, sizeof(StringV), "Variable");
        TextDrawSetString(TXD, StringV);
     }
    return 1;

OnPlayerSpawn(playerid)
{
if(EstaCerca(playerid))
    {
    TextDrawShowForPlayer(playerid, TXD);
    } else { TextDrawHideForPlayer(playerid, TXD);
    return 1; }
return 1;
}
}
If anyone knows how to fix it, before hand I am very grateful
PD: Sorry for my English.
Reply
#2

To fix the first error, just make sure to check if the player count variable to only decrease if there's more than one player in the minigame.

The second one, there needs to be more information. What exactly happens when it doesn't work properly?
Reply
#3

Quote:
Originally Posted by DTV
Посмотреть сообщение
To fix the first error, just make sure to check if the player count variable to only decrease if there's more than one player in the minigame.

The second one, there needs to be more information. What exactly happens when it doesn't work properly?
Now for the first problem, what do you mean remainder if 1 in the minigame ?.

In the second problem, the problem is that the function is not working properly, what I do is a textdraw is only shows if the player is close to a car, and hide when you leave the vehicle.
Reply
#4

Post this in the Spanish section, as you seem to be using a translator. You'll understand what people tell you there better.
Reply
#5

for the second problem i prefer u to use :textdrawshowforplayers under the extracerca function. cuz it checks if the player is near to the vehicle.
Reply
#6

Quote:
Originally Posted by Shaheen
Посмотреть сообщение
for the second problem i prefer u to use :textdrawshowforplayers under the extracerca function. cuz it checks if the player is near to the vehicle.
Yeah, so is the function that says "EstaCerca" that checks whether or not the player is near the vehicle, but does not work, because the textdraw when I entered the server, it appears, and I'm not near a vehicle
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)