Whats the problem ?
#1

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if(strcmp(cmdtext, "/kill", true) == 0)
	{
		SetPlayerHealth(playerid, 0);
	}

  if(strcmp(cmdtext, "/help", true) == 0)
  {

		SendClientMessage(playerid, COLOR_RED, "** HELP **");
		SendClientMessage(playerid, COLOR_RED, "** COMMANDS ** /help /kill** "); //More help here Florynho

		}
		
{
    new string[256];
    GetPlayerName(playerid, string, 24);
    format(string, 256, "%s Need Help!!!", string);
    for (new i; i != GetMaxPlayers(); i ++)
      if (GetPlayerTeam(i) == GetPlayerTeam(playerid))
        SendClientMessage(i, GetPlayerColor(playerid), string);
    return 0;
  }
  
	return 0;
}
Whats wrong with this code , i get these warnings

Код:
D:\samp02Xserver.win32\gamemodes\new.pwn(19) : warning 217: loose indentation
D:\samp02Xserver.win32\gamemodes\new.pwn(29) : warning 225: unreachable code
D:\samp02Xserver.win32\gamemodes\new.pwn(29) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Warnings.
Reply
#2

Loose Intendation meanse something like this->
(for Example
Код:
if(strcmp("/bla",cmdtext,true) == 0)
  {
 blablabla
return 1;
}
->This would give the warning "loose intendation"<-
It says that function is not on the same line with other functions..don't know how to say it but
look ^^

Код:
if(strcmp("/bla",cmdtext,true) == 0)
{
blablabla
return 1;
}
Here not ^^

And your unreachable code is this->
Код:
    new string[256];
    GetPlayerName(playerid, string, 24);
    format(string, 256, "%s Need Help!!!", string);
    for (new i; i != GetMaxPlayers(); i ++)
      if (GetPlayerTeam(i) == GetPlayerTeam(playerid))
        SendClientMessage(i, GetPlayerColor(playerid), string);
    return 0; //Here must be return 1; because return 0; below would never be reached 
  }
  
	return 0;
}
So take this->
Код:
    new string[256];
    GetPlayerName(playerid, string, 24);
    format(string, 256, "%s Need Help!!!", string);
    for (new i; i != GetMaxPlayers(); i ++)
    if (GetPlayerTeam(i) == GetPlayerTeam(playerid))
    SendClientMessage(i, GetPlayerColor(playerid), string);
    return 1; 
    }
    return 0;
}
...In fact now you would have NO warnings

Bearfist
Reply
#3

Oh , so spaces do matter Thanks bro
Reply
#4

No problem
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)