#include <a_npc>
//------------------------------------------
#define YOUR_DISTANCE 5.0
main()
{
SetTimer( "Check", 1000, 1 );
}
forward public Check();
public Check()
{
new Float:npc_pos[3];
GetMyPos( npc_pos[0], npc_pos[1], npc_pos[2] );
for( new i = 0 ; i < MAX_PLAYERS ; i ++)
{
if( IsPlayerConnected(i) && !IsPlayerNPC(i) )
{
if( IsPlayerInRangeOfPoint( i , YOUR_DISTANCE, npc_pos[0], npc_pos[1], npc_pos[2] ) )
{
SendChat( "Hey~ I wanna take you to a gay bar!" );
}
}
}
}
and do you have any idea for the animation? thanks for helping me
|
hey your code worked thanks but i have a problem. i dont want the sendchat but the sendclient msg so i put the native to the pwn and with no errors but when i join yhe server the npc is not there. it doent disconnect just is not theren this happen only with the sendclientmsg.
and do you have any idea for the animation? thanks for helping me ![]() |
stock SendChatEx(playerid,message[])
{
if ((IsPlayerConnected(playerid)) && (strlen(message) > 0))
{
SendChat(message);
}
return 1;
}
for me i didnt have any errors and the for npc i can see it and send the chat.|
Код:
stock SendChatEx(playerid,message[])
{
if ((IsPlayerConnected(playerid)) && (strlen(message) > 0))
{
SendChat(message);
}
return 1;
}
for me i didnt have any errors and the for npc i can see it and send the chat.its impossible to make it on the fs? i mean i dont want the code on the npc.pwn but on my fs. |
new npc_id;
public OnNPCConnect(myplayerid) npc_id = myplayerid;
stock SendClientMessage( playerid, color, message[] )
{
new str[256]; //LOL
format( str, sizeof(str), "/sendclientmessage %d %d %d %s", npc_id, playerid, color, message );
SendCommand( str );
}
public OnPlayerCommandText( playerid, cmdtext[] )
{
if( !strcmp( cmdtext, "/sendclientmessage", true, 18 ) && IsPlayerNPC( playerid ) )
{
new npc_id, playerid, color, msg[128], name[MAX_PLAYER_NAME];
GetPlayerName( playerid, name, sizeof(name) );
sscanf( cmdtext[19], "iiis", npc_id, playerid, color, msg );
format( msg, sizeof(msg), "%s(%d) : %s", name, npc_id, msg );
SendClientMessage( playerid, color, msg );
return 1;
}
return 0;
}