Team chat -
Mattakil - 15.06.2013
Im trying to make a chat for a team, so they can communicate with eachother(kinda like RP server's /f chat)
Here is the code:
pawn Код:
public OnPlayerText(playerid, text[])
{
if(GetPlayerTeam(playerid) = 1)//line 186
{
new string[128],
message[100];
format(string, sizeof(string), "[Red Team] %s {%s}: %s", GetPlayerName(playerid), playerid, message);
foreach (new i : Player)
{
if(GetPlayerTeam(i) = 1)
{
SendClientMessage(i, COLYELLOW, string);
return 1;
}
}
}
if(GetPlayerTeam(playerid) = 2)
{
new string[128],
message[100];
format(string, sizeof(string), "[Blue Team] %s {%s}: %s", GetPlayerName(playerid), playerid, message);
foreach (new i : Player)
{
if(GetPlayerTeam(i) = 2)
{
SendClientMessage(i, COLYELLOW, string);
return 1;
}
}
}
return 0;
}
Here are the errors
Код:
(186) : warning 211: possibly unintended assignment
(186) : error 022: must be lvalue (non-constant)
(186) : warning 215: expression has no effect
(186) : error 001: expected token: ";", but found ")"
(186) : error 029: invalid expression, assumed zero
(186) : fatal error 107: too many error messages on one line
Re: Team chat -
WillyP - 15.06.2013
pawn Код:
if(GetPlayerTeam(playerid == 1))//line 186
Re: Team chat -
Mattakil - 15.06.2013
that worked, thanks, although I am still getting
(207) : warning 211: possibly unintended assignment
Re: Team chat -
WillyP - 15.06.2013
What's line 207?
Re: Team chat -
Mattakil - 15.06.2013
the { below foreach
Re: Team chat -
WillyP - 15.06.2013
You may have one too many brackets somewhere, I can't really look into detail as I'm pretty busy
Re: Team chat -
Mattakil - 15.06.2013
Nawh its not that, if it was that, then it would give an error, but thanks anyway
Re: Team chat -
mastermax7777 - 15.06.2013
if(GetPlayerTeam(playerid == 1))//line 186
wtf?
isnt it
if(GetPlayerTeam(playerid) == 1)//line 186
Re: Team chat -
Mattakil - 15.06.2013
figured it out, maybe i shouldnt copy paste help answers :S
if(GetPlayerTeam(playerid) == 1)
The way you showed it was if the ID is 1.
Re: Team chat -
Mattakil - 15.06.2013
Oh, I didnt see your post! Anyway, yeah, I made a noob mistake, I put = instead of == :P