Help chat system
#1

How to let local chat did not come to global chat, local chat to the player nearest and global chat plasticity everything.

sorry for my bad english

Код:
if (text[0] == '!') // global chat
    {
    	new pname[24];
    	new string[128];
    	GetPlayerName(playerid,pname,sizeof(pname));
    	format(string,sizeof(string)," %s[%d]: {FFFFFF}%s.",pname,playerid,text[1]);
    	SendClientMessageToAll(COLOR_WHITE,string);
    }
   	if(PlayerInfo[playerid] == 1) //local chat
   	{
		new pname[24];
		new string[128];
		format(string, sizeof(string), "%s: %s", pname, text);
        GetPlayerName(playerid, pname, 24);
		ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
		SetPlayerChatBubble(playerid,text,COLOR_WHITE,20.0,5000);
		return 0;
		}
		return 1;
 	}
Reply
#2

Use this:

https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint
Reply
#3

How to use?
Reply
#4

Try this:

PHP код:
if (text[0] == '!'// global chat
    
{
    new 
pname[24];
    new 
string[128];
    
GetPlayerName(playerid,pname,sizeof(pname));
       
format(string,sizeof(string)," %s[%d]: {FFFFFF}%s.",pname,playerid,text[1]);
    
SendClientMessageToAll(COLOR_WHITE,string);
    }
       if(
PlayerInfo[playerid] == 1//local chat
       
{
    new 
string[250];
    
SetPlayerChatBubble(playerid,string,COLOR_WHITE,35,10000);
    new 
Float:x,Float:y,Float:z;
    
GetPlayerPos(playerid,x,y,z);
    new 
pName[24];
    
GetPlayerName(playerid,pName,sizeof(pName));
    new 
string2[250];
    
format(string2,sizeof(string2),"%s(%d):%s",pName,playerid,string);
    for(new 
i=0;i<=MAX_PLAYERS;i++)
    {
      if(
IsPlayerInRangeOfPoint(i,15.0,x,y,z)) return SendClientMessage(playerid,COLOR_WHITE,string2);
    }
    return 
0;
    }
    return 
1;
     } 
Reply
#5

http://imgur.com/a/7oImm
not work Ryder

Код:
[22:00:38]  Ahwil[1]: {FFFFFF}aa.

[22:00:38] <Ahwil> !aa <- double chat
Reply
#6

Quote:
Originally Posted by Langky
Посмотреть сообщение
How to let local chat did not come to global chat, local chat to the player nearest and global chat plasticity everything.

sorry for my bad english

Код:
if (text[0] == '!') // global chat
    {
    	new pname[24];
    	new string[128];
    	GetPlayerName(playerid,pname,sizeof(pname));
    	format(string,sizeof(string)," %s[%d]: {FFFFFF}%s.",pname,playerid,text[1]);
    	SendClientMessageToAll(COLOR_WHITE,string);
    }
   	if(PlayerInfo[playerid] == 1) //local chat
   	{
		new pname[24];
		new string[128];
		format(string, sizeof(string), "%s: %s", pname, text);
        GetPlayerName(playerid, pname, 24);
		ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
		SetPlayerChatBubble(playerid,text,COLOR_WHITE,20.0,5000);
		return 0;
		}
		return 1;
 	}
remove the return 1;

PHP код:
if (text[0] == '!'// global chat
{
    new 
pname[24];
    new 
string[128];
    
GetPlayerName(playerid,pname,sizeof(pname));
    
format(string,sizeof(string)," %s[%d]: {FFFFFF}%s.",pname,playerid,text[1]);
    
SendClientMessageToAll(COLOR_WHITE,string);
    return 
0
}
else
{
    new 
pname[24];
    new 
string[128];
    
format(stringsizeof(string), "%s: %s"pnametext);
    
GetPlayerName(playeridpname24);
    
ProxDetector(20.0playeridstring,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
    
SetPlayerChatBubble(playerid,text,COLOR_WHITE,20.0,5000);
    return 
0;

Reply
#7

HELP


Код:
C:\Users\Langky\Desktop\CGF\pawno\include\sscanf.inc(1) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Langky\Desktop\CGF\pawno\include\LocalChat.inc(11) : warning 219: local variable "string" shadows a variable at a preceding level
../include/gl_common.inc(79) : warning 219: local variable "string" shadows a variable at a preceding level
../include/gl_common.inc(100) : warning 219: local variable "string" shadows a variable at a preceding level
../include/gl_common.inc(123) : warning 219: local variable "string" shadows a variable at a preceding level
../include/gl_common.inc(138) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Langky\Desktop\CGF\gamemodes\Freeroam.pwn(242) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Langky\Desktop\CGF\gamemodes\Freeroam.pwn(384) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Langky\Desktop\CGF\gamemodes\Freeroam.pwn(448) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Langky\Desktop\CGF\gamemodes\Freeroam.pwn(454) : error 010: invalid function or declaration
C:\Users\Langky\Desktop\CGF\gamemodes\Freeroam.pwn(458) : error 021: symbol already defined: "GetPlayerName"
C:\Users\Langky\Desktop\CGF\gamemodes\Freeroam.pwn(461) : error 010: invalid function or declaration
C:\Users\Langky\Desktop\CGF\gamemodes\Freeroam.pwn(638) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Langky\Desktop\CGF\gamemodes\Freeroam.pwn(709) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Langky\Desktop\CGF\gamemodes\Freeroam.pwn(729) : warning 203: symbol is never used: "pname"
C:\Users\Langky\Desktop\CGF\gamemodes\Freeroam.pwn(729) : warning 203: symbol is never used: "string"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Код:
public OnPlayerText(playerid,text[])
{
	new name[MAX_PLAYER_NAME], string[128];
	GetPlayerName(playerid, name, sizeof(name));
	format(string, sizeof(string), "%s: %s", name, text);
	SendLocalMessage(playerid, COLOR_WHITE, 7,string);
	return 0;
}
	if (text[0] == '@')
    {
    new pname[24];
    new string[128];
    GetPlayerName(playerid,pname,sizeof(pname));
    format(string,sizeof(string)," %s(%d): {FFFFFF}%s.",pname,playerid,text[1]);
    SendClientMessageToAll(COLOR_WHITE,string);
    return 0;
}
Reply
#8

PHP код:
public OnPlayerText(playerid,text[])
{
    new 
name[MAX_PLAYER_NAME], string[128];
    
GetPlayerName(playeridnamesizeof(name));
    
format(stringsizeof(string), "[%i] %s"playeridtext);
    
SendLocalMessage(playeridCOLOR_WHITE7,string);
    return 
0;
}
    if (
text[0] == '@')
    {
    new 
string[128];
    
format(string,sizeof(string)," %s(%d): {FFFFFF}%s.",name,playerid,text[1]);
    
SendClientMessageToAll(COLOR_WHITE,string);
    return 
0;

Reply
#9

not work
Reply
#10

Код:
public OnPlayerText(playerid,text[])
{
	new pname[MAX_PLAYER_NAME], stringOs[128];
	GetPlayerName(playerid, pname, sizeof(pname));
	if (!strcmp(text,"@",true,1))
	{
		strdel(text,0,1);
		format(stringOs,sizeof(stringOs)," %s(%d): {FFFFFF}%s.",pname,playerid,text);
		SendClientMessageToAll(COLOR_WHITE,stringOs);
		return 0;
	}
	format(string, sizeof(string), "%s: %s", pname, text);
	SendLocalMessage(playerid, COLOR_WHITE, 7,stringOs);
	return 0;
}
Also, show us your SendLocalMessage function, please.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)