[AJUDA] Erro no /do
#1

Bom criei uma gz, e entao coloquei ela nas seguintes cordenadas

pawn Код:
GZpedreira = GangZoneCreate(429.4915, 914.6093, 742.1331, 736.9899);
No final do GM coloquei a Stock:

pawn Код:
stock IsPlayerInPedreira(playerid)
{
    new float:x,Float:y,Float:z;
   GetPlayerPos(layerid, x, y, z);
   if(x >= 429.4915 && y >= 914.6093 && x <= 742.1331 && y <= 736.9899 ) return true;
   else return false;
}
No entanto quando eu estou na pedreira e uso o /do diz que eu nao estou em nenhum territorio alguem pode me ajudar?
Reply
#2

Usa o IsPlayerInRangeOfPoint
Reply
#3

e como eu usaria ele aqui?
Reply
#4

Consertei sua funзгo :


pawn Код:
stock IsPlayerInPedreira(playerid)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    if(x >= 429.4915 && y >= 914.6093 && x <= 742.1331 && y <= 736.9899) return true;
    else return false;
}

Se o problema persistir, cheque se o cуdigo de verificar se o indivнduo estб em um territуrio e retornar a mensagem caso nгo estiver, estб correto.



Espero ter ajudado .
Reply
#5

pawn Код:
if(!strcmp("/do",cmdtext))
{
    if(!IsPlayerInRangeOfPoint(playerid, x, y, z))
    {
        SendClientMessage(playerid,0xFFFFFFFF,"Vocк nгo estб em uma gangzone");
    }
    return 1;
}
Reply
#6

rjjj Corrigi o codigo e ainda continua dando o problema

olha a linha da msg:

pawn Код:
if(!IsPlayerInPedreira(playerid)) return SendClientMessage(playerid, -1, "Vocк nгo estб em nenhum territуrio!")
e a If IsPlayerInPedreira
pawn Код:
if(IsPlayerInPedreira(playerid))
                {
                       GetPlayerName(playerid, NomeBLK, MAX_PLAYER_NAME);
                       format(CelulasBLK, sizeof(CelulasBLK), "%s e os Terrorista declararгo Guerra na Pedreira.",NomeBLK);
                       SendClientMessageToAll(CorTerrorista, CelulasBLK);
                       SendClientMessage(playerid, -1, "Vocк dominou a WarZone Pedreira.");
                       GangZoneStopFlashForAll(GZPedreira);
                       GangZoneShowForAll(GZPedreira, CorTerrorista);
                       Dominando[playerid] = 0;
                       ProvocoPedreira[playerid] = 0;
                       GuerranaPedreira = 0;
                       donoPedreira = 2;
                       KillTimer(TempoGuerraPedreira);
                       return true;
                }
                else
                {
                       SendClientMessage(playerid, CorTerrorista, "Vocк nгo estб na Pedreira.");
                       Dominando[playerid] = 0;
                       GangZoneStopFlashForAll(GZPedreira);
                       GangZoneShowForAll(GZPedreira, 0xFFFFFF96);
                       ProvocoPedreira[playerid] = 0;
                       GuerranaPedreira= 0;
                       donoPedreira = 0;
                       KillTimer(TempoGuerraPedreira);
                       return true;
                }
Reply
#7

pawn Код:
stock IsPlayerInPedreira(playerid)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    if(x >= 429.4915 && y >= 736.9899 && x <= 742.1331 && y <= 914.6093) return true;
    else return false;
}
Reply
#8

Obrigado Vini nao sabia deste detalhe ai!

+ Rep!
Reply
#9

Quote:
Originally Posted by Viniborn
Посмотреть сообщение
pawn Код:
stock IsPlayerInPedreira(playerid)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    if(x >= 429.4915 && y >= 736.9899 && x <= 742.1331 && y <= 914.6093) return true;
    else return false;
}
Quote:
Originally Posted by blacktrindade
Посмотреть сообщение
Obrigado Vini nao sabia deste detalhe ai!

+ Rep!

Interessante, a funзгo tradicional de verificar se um jogador estб em uma GZ teve que ser modificada pelo fato do territуrio em questгo estar em Las Venturas (onde a coordenada Y й positiva) .



Por ter comprovado sua eficiкncia em Los Santos e San Fierro, nгo imaginei que isso pudesse acontecer, tanto que nem percebi a falta de lуgica que hб em uma variбvel ser ao mesmo tempo maior ou igual a 914.6093 e menor ou igual a 736.9899 .



Agora jб й sabido que, para uma funзгo desse tipo, й melhor pensar nos intervalos entre as coordenadas.



Espero ter ajudado .
Reply
#10

Quote:
Originally Posted by delete
Посмотреть сообщение
pawn Код:
if(!strcmp("/do",cmdtext))
{
    if(!IsPlayerInRangeOfPoint(playerid, x, y, z))
    {
        SendClientMessage(playerid,0xFFFFFFFF,"Vocк nгo estб em uma gangzone");
    }
    return 1;
}
Acho essa funзгo nгo muito boa para GangZones, melhor da maneira citada pelo Vini e pelo rjjj, ou entгo usando:

pawn Код:
stock IsPlayerInArea(playerid, Float:minx, Float:miny, Float:maxx, Float:maxy)
{
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid, x, y, z);
    if((x >= minx) && (y >= miny) && (x <= maxx) && (x <= maxy)) return true;
    return false;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)