03.05.2012, 23:41
Quote:
kra ,n entendi direito como funciona essa funзгo, mas se for como eu to pensando, acho q poderia ser assim
pawn Code:
|

pawn Code:
public OnPlayerUpdate(playerid)
{
if(GetNearestBot(playerid, 5.0))
{
SendClientMessage(playerid, -1, "[BOT] Oi, eu sou um robф"); //Mensagem do BOT
}
return 1;
}
stock GetNearestBot(playerid, Float:abstand)
{
new Float:pX, Float:pY, Float:pZ, Float:vX, Float:vZ, Float:vY;
GetPlayerPos(playerid, pX, pY, pZ);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerNPC(i))
{
GetPlayerPos(i, vX, vY, vZ);
if(floatabs(pX-vX) < abstand && floatabs(pY-vY) < abstand && floatabs(pZ-vZ) < abstand && i != playerid)
{
return i;
}
}
}
return -1;
}