Issues with NPC OnClientMessage
#1

Hello

I'm testing an npc to listen to a clientmessage like here;

Код:
public OnClientMessage(color, text[])
{

	if(strfind(text,"1") != -1)
  {
new Float:xm, Float:ym,Float:zm;
    GetMyPos( xm, ym, zm);
  	for(new i = 0; i < MAX_PLAYERS; i++)
	  if(IsPlayerInRangeOfPoint(i, 1.5, xm,ym,zm))
	  {
  	SendCommand("/hitfront");
  	SendChat("command one!");
		}
 		return 1;
 	}
	
	if(strfind(text,"2") != -1)
  {
new Float:xm, Float:ym,Float:zm;
  	 	GetMyPos( xm, ym, zm);
  	for(new i = 0; i < MAX_PLAYERS; i++)
	  if(IsPlayerInRangeOfPoint(i, 8.0, xm,ym,zm))
	  {
	  SendCommand("/dierifles");
	  SendChat("command 2");
	  }
  	return 1;
  }
  
	return 1;
}
Now something i did here is realy wrong because the npc would only listen to the first clientmessage (command1). It never listens to command2. I thought the failure was about the returns under each clientmessage but if i only use brackets between them the problem stays the same.

Any ideas how i can fix that ? please post

Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)