SA-MP Forums Archive
[Ajuda]Verificar Бrea - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda]Verificar Бrea (/showthread.php?tid=328992)



[Ajuda]Verificar Бrea - jpmdik - 26.03.2012

Gostaria de saber se tem alguma public ou algo do Tipo,Para Verificar se um carro estб nesta certa бrea,
Sem que alguйm esteja Prуximo ou Dentro do veнculo.Obg


Re: [Ajuda]Verificar Бrea - YaaN - 26.03.2012

https://sampwiki.blast.hk/wiki/Areacheck

Da uma olhada.


Re: [Ajuda]Verificar Бrea - jpmdik - 26.03.2012

й tipo assim mas,eu quero que ele verifique todos os carros q estiverem nesse ponto e pegar as ID'S deles


Re: [Ajuda]Verificar Бrea - YaaN - 26.03.2012

Esses dois tуpicos serгo uteis para vocк, achoq.

https://sampwiki.blast.hk/wiki/Areacheck
https://sampwiki.blast.hk/wiki/IsPlayerInVehicle


Re: [Ajuda]Verificar Бrea - Ricop522 - 26.03.2012

Caro j..
pawn Код:
stock IsVehicleInRangeOfPoint(vehicleid, Float:range, Float:x, Float:y, Float:z)
{
    static
        Float:pX, Float:pY, Float:pZ;

    GetVehiclePos(vehicleid, pX, pY, pZ);
    return x - range / 2 < pX > x + range / 2 && y - range / 2 < pY > y + range / 2 && z - range / 2 < pZ > z + range / 2;
}
for(new i = 0; i <= MAX_VEHICLES; ++i){
    if(IsVehicleInRangeOfPoint(i, x , y, z)) {
        format(string, 128, "%i", i);
        SendClientMessage(playerid, -1, string);
    }
}
Espero ter ajudado


Re: [Ajuda]Verificar Бrea - [NV]Dr._.THE - 26.03.2012

Quote:
Originally Posted by Ricop522
Посмотреть сообщение
Caro j..
pawn Код:
stock IsVehicleInRangeOfPoint(vehicleid, Float:range, Float:x, Float:y, Float:z)
{
    static
        Float:pX, Float:pY, Float:pZ;

    GetVehiclePos(vehicleid, pX, pY, pZ);
    return x - range / 2 < pX > x + range / 2 && y - range / 2 < pY > y + range / 2 && z - range / 2 < pZ > z + range / 2;
}
for(new i = 0; i <= MAX_VEHICLES; ++i){
    if(IsVehicleInRangeOfPoint(i, x , y, z)) {
        format(string, 128, "%i", i);
        SendClientMessage(playerid, -1, string);
    }
}
Espero ter ajudado
Primeiro adicione streamer

pawn Код:
#include <    streamer    >
depois no topo do gm
pawn Код:
#define dPublic%0(%1) \
    forward%0(%1); public%0(%1)


#define Loop(%0,%1) \
    for(new %0 = 0; %0 != %1; %0++)


new
    Area
;
depois em OnGameModeInt:
pawn Код:
public OnGameModeInt()
{
    Area = CreateDynamicRectangle(Float:minx, Float:miny, Float:maxx, Float:maxy);
    Loop(dTHE, MAX_PLAYERS)
    {
             SetTimerEx("Laila", 1000, true, "d", dTHE);
    }
    return 1;
}
Por fim fora de qualquer CallBack
pawn Код:
dpublic Laila(playerid)
{
    if(IsPlayerInDynamicArea(playerid, Area))
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            /*Funcoes*/  //Aqui suas funcoes
        }
    }
}
Espero ter ajudado І