thanks boelie, I'll be in touch.
Mauzen, your idea is ingenious! I have tried it, but it doesn't seem to be working.. unless I'm doing something wrong
I used your IsPointVisibleFromPoint code ... plus this one, found on forum:
pawn Код:
stock Float:PointToPoint(Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2)
{
x1 -= x2;
y1 -= y2;
z1 -= z2;
return floatsqroot((x1 * x1) + (y1 * y1) + (z1 * z1));
}
downloaded MapAndreas plugin, and installed... tested it, everything is working fine.
next I connected an idle npc.
pawn Код:
ConnectNPC("TestBot", "npcidle");
I scripted a quick command for test...
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256];
new idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/test", true) == 0)
{
new Float:x1, Float:x2, Float:y1, Float:y2, Float:z1, Float:z2, Float:distance;
GetPlayerPos(0, x1, y1, z1); // TestBot, who joined with id 0 naturally
GetPlayerPos(playerid, x2, y2, z2);
if(IsPointVisibleFromPoint(x1, y1, z1, x2, y2, z2, distance))
{
SendClientMessage(playerid, 0xFFFFFFFF, "Bot can see you from here.");
return 1;
}
else return SendClientMessage(playerid, 0xFFFFFFFF, "Bot can't see you from here.");
}
return 0;
}
I've tried this command right infront of npc's face, behind walls, on the roof, and even there where sun doesn't shine... everytime it returns the "Bot can't see you" message. can you tell what's wrong?