Chat team problem
#1

Hey

I make a chat team command. You can speak with the players of your team by doing /t.

Here is my code :
Код:
	if(!strcmp(cmdtext, "/t", true))
	{
		new gTeam[MAX_PLAYERS];
		new string[128], Player[MAX_PLAYER_NAME];
		GetPlayerName(playerid, Player, MAX_PLAYER_NAME);
		format(string, 128, "Equipe: %s: %s", Player, cmdtext[1]);
		for(new i=0; i<MAX_PLAYERS; i++) if(gTeam[i]==gTeam[playerid]) SendClientMessage(i, 0xFFFF00FF, string);
		return 1;
	}
But ingame I write "/t come on guys" and server says "SERVER : UNKNOWN COMMAND" but if I only write "/t" server says :" Equipe: Amator(pseudo):".

I don't see what's wrong? Can you help?
Reply
#2

pawn Код:
if(!strcmp(cmdtext, "/t", true, 2))
    {
        new gTeam[MAX_PLAYERS];
        new string[128], Player[MAX_PLAYER_NAME];
        GetPlayerName(playerid, Player, MAX_PLAYER_NAME);
        format(string, 128, "Equipe: %s: %s", Player, cmdtext[1]);
        for(new i=0; i<MAX_PLAYERS; i++) if(gTeam[i]==gTeam[playerid]) SendClientMessage(i, 0xFFFF00FF, string);
        return 1;
    }
Try this.
Reply
#3

Thank you it works but the 't' from "/t" appear in the message : I write "/t Come on guys" and server says "Equipe: Amator: t Come on guys"
Reply
#4

pawn Код:
if(!strcmp(cmdtext, "/t", true, 2))
    {
        new gTeam[MAX_PLAYERS];
        new string[128], Player[MAX_PLAYER_NAME];
        GetPlayerName(playerid, Player, MAX_PLAYER_NAME);
        format(string, 128, "Equipe: %s: %s", Player, cmdtext[2]);
        for(new i=0; i<MAX_PLAYERS; i++) if(gTeam[i]==gTeam[playerid]) SendClientMessage(i, 0xFFFF00FF, string);
        return 1;
    }
Try that
Reply
#5

Works 100% thank you so much
Reply
#6

No Problem
Reply
#7

Aw, didn't see that. My fault. Thanks to Luis for the rest. ^^ *Teamwork*

No Problem.
Reply
#8

Quote:
Originally Posted by Jeffry
Посмотреть сообщение
Aw, didn't see that. My fault. Thanks to Luis for the rest. ^^ *Teamwork*

No Problem.
Lol, Its alright.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)