Problem with teamchat
#1

Hi all,i maked this code for the team chat:

Код:
    if(text[0] == ';')
	{
		if( gTeam[playerid] == TEAM_MEDICS )
        {
			new string[128];
			GetPlayerName(playerid,nameee,sizeof(nameee));	format(string,sizeof(string),"Team Chat: [%s] ID: [%i]: %s",nameee,playerid,text[3]); SendClientMessageToAll(COLOR_YELLOW, string);
			new str[100];
   	        format(str,sizeof(str),"08,02Team Chat Medics: [%s] ID: [%i]: %s", nameee,playerid,text[3]);
   	   	    IRC_GroupSay(gGroupID, IRC_CHANNEL, str);
		}
		if( gTeam[playerid] == TEAM_RICHS )
		{
            new string[128];
			GetPlayerName(playerid,nameee,sizeof(nameee));	format(string,sizeof(string),"Team Chat: [%s] ID: [%i]: %s",nameee,playerid,text[3]); SendClientMessageToAll(COLOR_YELLOW, string);
			new str[100];
   	        format(str,sizeof(str),"08,02Team Chat Richs: [%s] ID: [%i]: %s", nameee,playerid,text[3]);
   	   	    IRC_GroupSay(gGroupID, IRC_CHANNEL, str);
		}
		if( gTeam[playerid] == TEAM_FARMERS )
		{
	    	new string[128];
			GetPlayerName(playerid,nameee,sizeof(nameee));	format(string,sizeof(string),"Team Chat: [%s] ID: [%i]: %s",nameee,playerid,text[3]); SendClientMessageToAll(COLOR_YELLOW, string);
             new str[100];
   	        format(str,sizeof(str),"08,02Team Chat Farmers: [%s] ID: [%i]: %s", nameee,playerid,text[3]);
   	   	    IRC_GroupSay(gGroupID, IRC_CHANNEL, str);
		}
		if( gTeam[playerid] == TEAM_SWAT )
		{
            new string[128];
			GetPlayerName(playerid,nameee,sizeof(nameee));	format(string,sizeof(string),"Team Chat: [%s] ID: [%i]: %s",nameee,playerid,text[3]); SendClientMessageToAll(COLOR_YELLOW, string);
            new str[100];
   	        format(str,sizeof(str),"08,02Team Chat Swat: [%s] ID: [%i]: %s", nameee,playerid,text[3]);
   	   	    IRC_GroupSay(gGroupID, IRC_CHANNEL, str);
		}
		if( gTeam[playerid] == TEAM_PILOTS )
		{
            new string[128];
    		GetPlayerName(playerid,nameee,sizeof(nameee));	format(string,sizeof(string),"Team Chat: [%s] ID: [%i]: %s",nameee,playerid,text[3]); SendClientMessageToAll(COLOR_YELLOW, string);
            new str[100];
   	        format(str,sizeof(str),"08,02Team Chat Pilots: [%s] ID: [%i]: %s", nameee,playerid,text[3]);
   	   	    IRC_GroupSay(gGroupID, IRC_CHANNEL, str);
		}
	    if( gTeam[playerid] == TEAM_KAMIKAZERS )
		{
            new string[128];
    		GetPlayerName(playerid,nameee,sizeof(nameee));	format(string,sizeof(string),"Team Chat: [%s] ID: [%i]: %s",nameee,playerid,text[3]); SendClientMessageToAll(COLOR_YELLOW, string);
    		new str[100];
   	        format(str,sizeof(str),"08,02Team Chat Kamikazers: [%s] ID: [%i]: %s", nameee,playerid,text[3]);
   	   	    IRC_GroupSay(gGroupID, IRC_CHANNEL, str);
		}
		if( gTeam[playerid] == TEAM_IMMIGRANTS )
		{
            new string[128];
    		GetPlayerName(playerid,nameee,sizeof(nameee));	format(string,sizeof(string),"Team Chat: [%s] ID: [%i]: %s",nameee,playerid,text[3]); SendClientMessageToAll(COLOR_YELLOW, string);
            new str[100];
   	        format(str,sizeof(str),"08,02Team Chat Immigrants: [%s] ID: [%i]: %s", nameee,playerid,text[3]);
   	   	    IRC_GroupSay(gGroupID, IRC_CHANNEL, str);
		}
	    if( gTeam[playerid] == TEAM_CHICKENS )
	  	{
            new string[128];
    		GetPlayerName(playerid,nameee,sizeof(nameee));	format(string,sizeof(string),"Team Chat: [%s] ID: [%i]: %s",nameee,playerid,text[3]); SendClientMessageToAll(COLOR_YELLOW, string);
    		new str[100];
            format(str,sizeof(str),"08,02Team Chat Kamikazers: [%s] ID: [%i]: %s", nameee,playerid,text[3]);
 	        IRC_GroupSay(gGroupID, IRC_CHANNEL, str);
		}
		return 1;
	}
And i've 2 problems:

I write "test" ingame,and and irc appear in this way:



The name doesnt show,and the text is cutted.

Same happen in-game:



What i done wrong?
Reply
#2

Haven't read through all code but

sizeof str

should be

sizeof(str)

you get any compile errors?
Reply
#3

Ok i've fixed the code:

Код:
    if(text[0] == ';')
	{
		if( gTeam[playerid] == TEAM_MEDICS )
        {
			new string[128];
			GetPlayerName(playerid,nameee,sizeof(nameee));	format(string,sizeof(string),"Team Chat: [%s] ID: [%i]: %s",nameee,playerid,text[3]); SendClientMessageToAll(COLOR_YELLOW, string);
			new str[100];
   	        format(str,sizeof(str),"08,02Team Chat Medics: [%s] ID: [%i]: %s", nameee,playerid,text[3]);
   	   	    IRC_GroupSay(gGroupID, IRC_CHANNEL, str);
		}
		if( gTeam[playerid] == TEAM_RICHS )
		{
            new string[128];
			GetPlayerName(playerid,nameee,sizeof(nameee));	format(string,sizeof(string),"Team Chat: [%s] ID: [%i]: %s",nameee,playerid,text[3]); SendClientMessageToAll(COLOR_YELLOW, string);
			new str[100];
   	        format(str,sizeof(str),"08,02Team Chat Richs: [%s] ID: [%i]: %s", nameee,playerid,text[3]);
   	   	    IRC_GroupSay(gGroupID, IRC_CHANNEL, str);
		}
		if( gTeam[playerid] == TEAM_FARMERS )
		{
	    	new string[128];
			GetPlayerName(playerid,nameee,sizeof(nameee));	format(string,sizeof(string),"Team Chat: [%s] ID: [%i]: %s",nameee,playerid,text[3]); SendClientMessageToAll(COLOR_YELLOW, string);
             new str[100];
   	        format(str,sizeof(str),"08,02Team Chat Farmers: [%s] ID: [%i]: %s", nameee,playerid,text[3]);
   	   	    IRC_GroupSay(gGroupID, IRC_CHANNEL, str);
		}
		if( gTeam[playerid] == TEAM_SWAT )
		{
            new string[128];
			GetPlayerName(playerid,nameee,sizeof(nameee));	format(string,sizeof(string),"Team Chat: [%s] ID: [%i]: %s",nameee,playerid,text[3]); SendClientMessageToAll(COLOR_YELLOW, string);
            new str[100];
   	        format(str,sizeof(str),"08,02Team Chat Swat: [%s] ID: [%i]: %s", nameee,playerid,text[3]);
   	   	    IRC_GroupSay(gGroupID, IRC_CHANNEL, str);
		}
		if( gTeam[playerid] == TEAM_PILOTS )
		{
            new string[128];
    		GetPlayerName(playerid,nameee,sizeof(nameee));	format(string,sizeof(string),"Team Chat: [%s] ID: [%i]: %s",nameee,playerid,text[3]); SendClientMessageToAll(COLOR_YELLOW, string);
            new str[100];
   	        format(str,sizeof(str),"08,02Team Chat Pilots: [%s] ID: [%i]: %s", nameee,playerid,text[3]);
   	   	    IRC_GroupSay(gGroupID, IRC_CHANNEL, str);
		}
	    if( gTeam[playerid] == TEAM_KAMIKAZERS )
		{
            new string[128];
    		GetPlayerName(playerid,nameee,sizeof(nameee));	format(string,sizeof(string),"Team Chat: [%s] ID: [%i]: %s",nameee,playerid,text[3]); SendClientMessageToAll(COLOR_YELLOW, string);
    		new str[100];
   	        format(str,sizeof(str),"08,02Team Chat Kamikazers: [%s] ID: [%i]: %s", nameee,playerid,text[3]);
   	   	    IRC_GroupSay(gGroupID, IRC_CHANNEL, str);
		}
		if( gTeam[playerid] == TEAM_IMMIGRANTS )
		{
            new string[128];
    		GetPlayerName(playerid,nameee,sizeof(nameee));	format(string,sizeof(string),"Team Chat: [%s] ID: [%i]: %s",nameee,playerid,text[3]); SendClientMessageToAll(COLOR_YELLOW, string);
            new str[100];
   	        format(str,sizeof(str),"08,02Team Chat Immigrants: [%s] ID: [%i]: %s", nameee,playerid,text[3]);
   	   	    IRC_GroupSay(gGroupID, IRC_CHANNEL, str);
		}
	    if( gTeam[playerid] == TEAM_CHICKENS )
	  	{
            new string[128];
    		GetPlayerName(playerid,nameee,sizeof(nameee));	format(string,sizeof(string),"Team Chat: [%s] ID: [%i]: %s",nameee,playerid,text[3]); SendClientMessageToAll(COLOR_YELLOW, string);
    		new str[100];
            format(str,sizeof(str),"08,02Team Chat Kamikazers: [%s] ID: [%i]: %s", nameee,playerid,text[3]);
 	        IRC_GroupSay(gGroupID, IRC_CHANNEL, str);
		}
		return 1;
	}
Still the same and no compile errors.
Reply
#4

BUMP
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)