Portal SAMP
[Ajuda] Identificar se o jogador está na água - Versão de Impressão

+- Portal SAMP (https://portalsamp.com)
+-- Fórum: SA-MP (https://portalsamp.com/forumdisplay.php?fid=5)
+--- Fórum: Área de suporte (https://portalsamp.com/forumdisplay.php?fid=6)
+--- Tópico: [Ajuda] Identificar se o jogador está na água (/showthread.php?tid=3766)



Identificar se o jogador está na água - Usuário Aleatório - 10/07/2023

Existe alguma função do SA-MP que consiga identificar se o jogador está na água?Procurei porém não acho.Se não houver uma função nativa,existe algum recurso (tipo include...etc) q tenha essa função?Se sim,qual??


RE: Identificar se o jogador está na água - White_Blue - 10/07/2023

(10/07/2023 06:43)Usuário Aleatório Escreveu: Existe alguma função do SA-MP que consiga identificar se o jogador está na água?Procurei porém não acho.Se não houver uma função nativa,existe algum recurso (tipo include...etc) q tenha essa função?Se sim,qual??

Neste tópico há a solução: https://portalsamp.com/showthread.php?tid=1223

Código postado pelo xbruno1000x:
Código PHP:
IsPlayerInWater(playerid)
{
    new Float:Z;// não mude para static
    GetPlayerPos(playerid,Z,Z,Z);
    if(0.7) switch(GetPlayerAnimationIndex(playerid)) { case 1543,1538,1539: return 1; }
    if(GetPlayerDistanceFromPoint(playerid,-965,2438,42) <= 700 && 45)return 1;
    new Float:water_places[][] =
    {

        {
            25.0,    2313.0,    -1417.0,    23.0},
        {
            15.0,    1280.0,    -773.0,        1082.0},
        {
            15.0,    1279.0,    -804.0,        86.0},
        {
            20.0,    1094.0,    -674.0,        111.0},
        {
            26.0,    194.0,    -1232.0,    76.0},
        {
            25.0,    2583.0,    2385.0,        15.0},
        {
            25.0,    225.0,    -1187.0,    73.0},
        {
            50.0,    1973.0,    -1198.0,    17.0},
        {
            140.0,    1923.01592.0,     10.0}
    };
    for(new t=0sizeof water_placest++)
    if(GetPlayerDistanceFromPoint(playerid,water_places[t][1],water_places[t][2],water_places[t][3]) <= water_places[t][0]) return 1;
    return 0;