small wrong -
mineralo - 07.06.2012
cmd work but server saying unknown command :/
pawn Код:
if(strcmp(cmd, "/c", true)==0)
{
if(PlayerInfo[playerid][pClanMem] == 250) return SendClientMessage(playerid,c_r,"( ! ) You're not in a clan !");
new string[250];
new clanf = PlayerInfo[playerid][pClanMem];
if(Clans[clanf][Front] == 1)
{
if(PlayerInfo[playerid][pClanMem] == PlayerInfo[playerid][pClanKey])
{
format(string,sizeof(string),"( C ) Boss [%s]%s : %s",Clans[clanf][cName],PlayerName(playerid),cmdtext[3]);
}
else
{
format(string,sizeof(string),"( C ) [%s]%s : %s",Clans[clanf][cName],PlayerName(playerid),cmdtext[3]);
}
MessageToClan(playerid,GetPlayerColor(playerid),string);
return 1;
}
else
{
if(PlayerInfo[playerid][pClanMem] == PlayerInfo[playerid][pClanKey])
{
format(string,sizeof(string),"( C ) Boss %s[%s] : %s",PlayerName(playerid),Clans[clanf][cName],cmdtext[3]);
}
else
{
format(string,sizeof(string),"( C ) %s[%s] : %s",PlayerName(playerid),Clans[clanf][cName],cmdtext[3]);
}
MessageToClan(playerid,GetPlayerColor(playerid),string);
}
return 1;
}
Код:
forward MessageToClan(playerid,color,const string[]);
public MessageToClan(playerid,color,const string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
new clan = PlayerInfo[i][pClanMem];
if(IsPlayerConnected(i) == 1) if(clan == PlayerInfo[playerid][pClanMem]) SendClientMessage(i, color, string);
}
return 1;
}
Re: small wrong - Jarnu - 07.06.2012
nothing is wrong with your script.. this Error only Pops up when you have one command Multiple Time.. maybe that /c command is already in used in your Script?
Re: small wrong -
Lorenc_ - 07.06.2012
Try debugging the whole code by putting print messages in between each statement:
pawn Код:
if(strcmp(cmd, "/c", true)==0)
{
if(PlayerInfo[playerid][pClanMem] == 250) return SendClientMessage(playerid,c_r,"( ! ) You're not in a clan !");
print("1");
new string[250];
new clanf = PlayerInfo[playerid][pClanMem];
print("1");
if(Clans[clanf][Front] == 1) {
print("2");
if(PlayerInfo[playerid][pClanMem] == PlayerInfo[playerid][pClanKey]) {
print("2");
format(string,sizeof(string),"( C ) Boss [%s]%s : %s",Clans[clanf][cName],PlayerName(playerid),cmdtext[3]);
}
print("2");
else {
print("2");
format(string,sizeof(string),"( C ) [%s]%s : %s",Clans[clanf][cName],PlayerName(playerid),cmdtext[3]);
}
print("2");
MessageToClan(playerid,GetPlayerColor(playerid),string);
return 1;
print("2");
}
else {
print("3");
if(PlayerInfo[playerid][pClanMem] == PlayerInfo[playerid][pClanKey]) {
print("4");
format(string,sizeof(string),"( C ) Boss %s[%s] : %s",PlayerName(playerid),Clans[clanf][cName],cmdtext[3]);
}
else {
print("5");
format(string,sizeof(string),"( C ) %s[%s] : %s",PlayerName(playerid),Clans[clanf][cName],cmdtext[3]);
}
MessageToClan(playerid,GetPlayerColor(playerid),string);
}
return 1;
}
Check how many ones it prints, twos, threes, fours and fives it prints. If it doesn't print any, check which section the code stops on.
I hope I made this clear.
pawn Код:
stock MessageToClan(playerid,color,const string[])
{
for(new i; i < MAX_PLAYERS; i++)
{
if( IsPlayerConnected( i ) )
{
new clan = PlayerInfo[i][pClanMem];
if(clan == PlayerInfo[playerid][pClanMem]) SendClientMessage(i, color, string);
}
}
return 1;
}
Change to public if needed outside your gamemode.
Try that as well.
Re: small wrong -
X3nZ - 07.06.2012
As Jarnu said.
Tip: Hit CRTL + F, then type "/c", do this two times, but click forward/backward each time. You'll see if you have two commands.
Re: small wrong -
mineralo - 07.06.2012
ah, thanks Lorenc_ the mistake was in public of sending messages to clan maters