SA-MP Forums Archive
Problem with teamchat - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem with teamchat (/showthread.php?tid=200813)



Problem with teamchat - Face9000 - 19.12.2010

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?


Re: Problem with teamchat - Moglizorz. - 19.12.2010

Haven't read through all code but

sizeof str

should be

sizeof(str)

you get any compile errors?


Re: Problem with teamchat - Face9000 - 19.12.2010

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.


Re: Problem with teamchat - Face9000 - 20.12.2010

BUMP