Quote:
Originally Posted by billiout
Код:
stock SendChatEx(playerid,message[])
{
if ((IsPlayerConnected(playerid)) && (strlen(message) > 0))
{
SendChat(message);
}
return 1;
}
you think this will work? i mean i dont any other to test if it is working. i want to show it on for the player not in all players 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.
|
SendChat() is same as SendPlayerMessageToAll, so it might not work.
the workaround is to sending commands like /sendchat [npcid] [toplayerid] [color] [message]
pawn Код:
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 );
}
and in your filterscript:
pawn Код:
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;
}
though i didn't try it it would work.
EDIT: for sure you can implement it on
filterscript.
with IsPlayerNPC(playerid) and name comparing, some distance functions you can make that script.