PDA

View Full Version : small wrong


mineralo
07/06/2012, 02:41 AM
cmd work but server saying unknown command :/
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),st ring);
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),st ring);
}
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;
}

Jarnu
07/06/2012, 02:44 AM
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?

Lorenc_
07/06/2012, 02:46 AM
Try debugging the whole code by putting print messages in between each statement:


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),st ring);
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),st ring);
}
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.

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.

X3nZ
07/06/2012, 02:47 AM
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.

mineralo
07/06/2012, 03:03 AM
ah, thanks Lorenc_ the mistake was in public of sending messages to clan maters ;)