Team Chat
#1

This is what I have:
PHP код:
if (strcmp("/t"cmdtexttrue10) == 0)
    {
        if(
GetPlayerTeam(playerid) == 1)
        {
            new 
string[128]; GetPlayerName(playerid,string,sizeof(string));
            
format(string,sizeof(string),"[Radio Chat] %s: %s",string,text[1]);
            
SendClientMessageToAll(0xFDAC6DAA,string);
        }
        return 
1;
    } 
These are the errors I NEED help with:

Код:
GM.pwn(201) : error 017: undefined symbol "text"
GM.pwn(201) : warning 215: expression has no effect
GM.pwn(201) : error 001: expected token: ";", but found "]"
GM.pwn(201) : error 029: invalid expression, assumed zero
GM.pwn(201) : fatal error 107: too many error messages on one line
ALL these errors are on this line:
Код:
format(string,sizeof(string),"[Radio Chat] %s: %s",string,text[1]);
can anyone assist me in correcting this problem
Reply
#2

Here is the command in ZCMD, I can convert it if you would like.
Код:
CMD:t(playerid, params[])
{
	if(GetPlayerTeam(playerid) == 1)
	{
	 new string[128];
     	format(string,sizeof(string),"[Radio Chat] %s: %s", GetName(playerid), string);
      	SendClientMessageToAll(0xFDAC6DAA,string);
      	return 1;
	}
}
You just need to add the stock "GetName"
Код:
stock GetName(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    return name;
}
This is untested.

Edit: Compiled, it works for me.
Reply
#3

pawn Код:
CMD:t(playerid, params[])
{
   if(isnull(params)) return SP COLOR_RED,"USAGE: /t < Text >");
   new str[128], pName[MAX_PLAYER_NAME];
   GetPlayerName(playerid, pName, sizeof(pName));
   for(new i = 0; i < MAX_PLAYERS; i++) //This so it loops thru all the players
   { //notice the bracket here..
      if(gTeam[i] == gTeam[playerid])//so the message playerid sends will be sent to only team members..
      {
         format(str,sizeof(str),"[TEAM]: %s[%i]: %s",pName,playerid,params);
         SendClientMessage(i,-1,str);
      }
   }
   return 1;
}
Reply
#4

Quote:
Originally Posted by Strier
Посмотреть сообщение
pawn Код:
CMD:t(playerid, params[])
{
   if(isnull(params)) return SP COLOR_RED,"USAGE: /®adio < Text >");
   new str[128], pName[MAX_PLAYER_NAME];
   GetPlayerName(playerid, pName, sizeof(pName));
   for(new i = 0; i < MAX_PLAYERS; i++) //This so it loops thru all the players
   {
      if(gTeam[i] == gTeam[playerid])
      {
         format(str,sizeof(str),"[TEAM]: %s[%i]: %s",pName,playerid,params);
         SendClientMessage(i,-1,str);
      }
   }
   return 1;
}
I like this one more so I'll use this
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)