IsPlayerInRangeOfPoint -
Tugamars - 27.12.2013
Bem , estou com um problema aqui num code , talvez seja mais um problema de falta de atenзгo como os outros de ontem :S
pawn Код:
CMD:comprararmas(playerid, params[])
{
if(PlayerInfo[playerid][pEquipa] == 1)
{
if(!IsPlayerInRangeOfPoint(playerid, 7798.0586,-2612.3733,12.6534, 3.0)||!IsPlayerInRangeOfPoint(playerid,-4180.0063,-6770.7710,11.9720, 3.0)||!IsPlayerInRangeOfPoint(playerid,8076.1299,-7591.2690,15.3666, 3.0)||!IsPlayerInRangeOfPoint(playerid,9511.4180,-8821.0498,28.4341, 3.0))
{
SendClientMessage(playerid, COLOR_RED, "Vocк nгo estб no local de compra !!");
}
else
{
ShowModelSelectionMenu(playerid, listaarmasct, "Comprar arma :", 0x4A5A6BBB, 0x88888899 , 0xFFFF00AA);
}
}
if(PlayerInfo[playerid][pEquipa] == 2)
{
if(!IsPlayerInRangeOfPoint(playerid, 7703.8672,-2595.6262,24.1061, 3.0)||!IsPlayerInRangeOfPoint(playerid,-4424.7817,-6765.0215,16.1435, 3.0)||!IsPlayerInRangeOfPoint(playerid,8170.6826,-7518.8247,15.3666, 3.0)||!IsPlayerInRangeOfPoint(playerid,9459.8906,-8753.8584,30.2687, 3.0))
{
SendClientMessage(playerid, COLOR_RED, "Vocк nгo estб no local de compra !!");
}
else
{
ShowModelSelectionMenu(playerid, listaarmast, "Comprar arma :", 0xCE0005FF, 0x88888899 , 0xFFFF00AA);
}
}
return 1;
}
O problema й que ele indica sempre a mensagem de que o jogador nгo estб no local de compra .
Re: IsPlayerInRangeOfPoint -
Dolby - 27.12.2013
Utilize o operador AND ( && ) no lugar de OR ( || ), visto que й impossнvel ele estar em todos os locais ao mesmo tempo(no seu caso).
Vocк tem que checar se ele
nгo estб em nenhum dos locais, e nгo
se ele estб em todos os locais.
Re: IsPlayerInRangeOfPoint -
Tugamars - 27.12.2013
Continua sem dar .
@Operadores
Eu inicialmente pensei que seria : || porque a lуgica era "Caso ele nгo esteja num raio de X , ou , nгo esteja num raio de X, ou ...".
Re: IsPlayerInRangeOfPoint -
Dolby - 27.12.2013
A lуgica na verdade й comparar se ele nгo estб em
nenhum dos lugares, fique tranquilo, todos aqui jб cometemos este mesmo erro quando se trata de posiзхes.
pawn Код:
CMD:comprararmas(playerid)
{
if(PlayerInfo[playerid][pEquipa] == 1)
{
if(!IsPlayerInRangeOfPoint(playerid, 7798.0586,-2612.3733,12.6534, 3.0) && !IsPlayerInRangeOfPoint(playerid,-4180.0063,-6770.7710,11.9720, 3.0) && !IsPlayerInRangeOfPoint(playerid,8076.1299,-7591.2690,15.3666, 3.0) && !IsPlayerInRangeOfPoint(playerid,9511.4180,-8821.0498,28.4341, 3.0))
{
SendClientMessage(playerid, COLOR_RED, "Vocк nгo estб no local de compra !!");
return 1;
}
else
{
ShowModelSelectionMenu(playerid, listaarmasct, "Comprar arma :", 0x4A5A6BBB, 0x88888899 , 0xFFFF00AA);
return 1;
}
}
if(PlayerInfo[playerid][pEquipa] == 2)
{
if(!IsPlayerInRangeOfPoint(playerid, 7703.8672,-2595.6262,24.1061, 3.0) && !IsPlayerInRangeOfPoint(playerid,-4424.7817,-6765.0215,16.1435, 3.0) && !IsPlayerInRangeOfPoint(playerid,8170.6826,-7518.8247,15.3666, 3.0) && !IsPlayerInRangeOfPoint(playerid,9459.8906,-8753.8584,30.2687, 3.0))
{
SendClientMessage(playerid, COLOR_RED, "Vocк nгo estб no local de compra !!");
return 1;
}
else
{
ShowModelSelectionMenu(playerid, listaarmast, "Comprar arma :", 0xCE0005FF, 0x88888899 , 0xFFFF00AA);
}
}
return 1;
}
Re: IsPlayerInRangeOfPoint -
Tugamars - 27.12.2013
Continua a dar erro
Inclusive alterei as coordenadas .
Re: IsPlayerInRangeOfPoint -
Dolby - 27.12.2013
Ah sim, vocк inverteu os parвmetros da funзгo
IsPlayerInRangeOfPoint. Vocк colocou o range como ъltimo parвmetro, sendo que ele vem como o primeiro.
pawn Код:
CMD:comprararmas(playerid)
{
if(PlayerInfo[playerid][pEquipa] == 1)
{
if(!IsPlayerInRangeOfPoint(playerid, 3.0, 7798.0586,-2612.3733,12.6534) && !IsPlayerInRangeOfPoint(playerid, 3.0, -4180.0063,-6770.7710,11.9720) && !IsPlayerInRangeOfPoint(playerid, 3.0, 8076.1299,-7591.2690,15.3666) && !IsPlayerInRangeOfPoint(playerid, 3.0, 9511.4180,-8821.0498,28.4341))
{
SendClientMessage(playerid, COLOR_RED, "Vocк nгo estб no local de compra !!");
return 1;
}
else
{
ShowModelSelectionMenu(playerid, listaarmasct, "Comprar arma :", 0x4A5A6BBB, 0x88888899 , 0xFFFF00AA);
return 1;
}
}
if(PlayerInfo[playerid][pEquipa] == 2)
{
if(!IsPlayerInRangeOfPoint(playerid, 3.0, 7703.8672,-2595.6262,24.1061) && !IsPlayerInRangeOfPoint(playerid, 3.0, -4424.7817,-6765.0215,16.1435) && !IsPlayerInRangeOfPoint(playerid, 3.0, 8170.6826,-7518.8247,15.3666) && !IsPlayerInRangeOfPoint(playerid, 3.0, 9459.8906,-8753.8584,30.2687))
{
SendClientMessage(playerid, COLOR_RED, "Vocк nгo estб no local de compra !!");
return 1;
}
else
{
ShowModelSelectionMenu(playerid, listaarmast, "Comprar arma :", 0xCE0005FF, 0x88888899 , 0xFFFF00AA);
}
}
return 1;
}
Re: IsPlayerInRangeOfPoint -
Tugamars - 27.12.2013
Era mesmo isso