SA-MP Forums Archive
Players count + IsPlayerIsRangeOfPointh - 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)
+--- Thread: Players count + IsPlayerIsRangeOfPointh (/showthread.php?tid=620611)



Players count + IsPlayerIsRangeOfPointh - Th3N0oB - 01.11.2016

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.


Re: [HELP] Players count + IsPlayerIsRangeOfPointh - DTV - 01.11.2016

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?


Respuesta: Re: [HELP] Players count + IsPlayerIsRangeOfPointh - Th3N0oB - 01.11.2016

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.


Re: [HELP] Players count + IsPlayerIsRangeOfPointh - SickAttack - 01.11.2016

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


Re: [HELP] Players count + IsPlayerIsRangeOfPointh - Shaheen - 01.11.2016

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.


Respuesta: Re: [HELP] Players count + IsPlayerIsRangeOfPointh - Th3N0oB - 02.11.2016

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