Problems with cmd
#1

Helllo got a problem with a cmd i guess it some bracket missing but i cant find it please help ill add rep!


Error on line 18332 ill show wich one (The secound last line in the script Return 1

Код:
(18332) : warning 225: unreachable code
Here is the code
Код:
CMD:liveban(playerid, params[])
{
	 if(PlayerInfo[playerid][pFaction] != NEWS) return SCM(playerid, COLOR_WHITE,"You are not a News Reporter!");
	 if(PlayerInfo[playerid][pRank] < 5) return SCM(playerid, COLOR_LIGHTRED, "You are not authorized to use this command.");
	    
		new 
			giveplayerid,
			newsreporter,
	        string[128];

	    if(sscanf(params, "u", giveplayerid)) 
			return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /liveban [player]");
			
		if(!IsPlayerConnected(giveplayerid))
			return SendClientMessage(playerid, COLOR_GRAD1, "Invalid player specified.");
			
		foreach(Player, i) {
			if(TalkingLive[i] == giveplayerid) newsreporter = i;
		}
			
		if(TalkingLive[newsreporter] != INVALID_PLAYER_ID) {
			SendClientMessage(newsreporter, COLOR_LIGHTBLUE, "* Live conversation ended.");
			SendClientMessage(TalkingLive[newsreporter], COLOR_LIGHTBLUE, "* Live conversation ended.");
			TogglePlayerControllable(newsreporter, 1);
			TogglePlayerControllable(TalkingLive[newsreporter], 1);
			TalkingLive[TalkingLive[newsreporter]] = INVALID_PLAYER_ID;
			TalkingLive[newsreporter] = INVALID_PLAYER_ID;
		}
		
	    if(PlayerInfo[giveplayerid][pLiveBanned] == 0) {
	        PlayerInfo[giveplayerid][pLiveBanned] = 1;
	        format(string, sizeof(string), "%s has interview banned %s", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
	        ICNews(COLOR_LIGHTGREEN,string);
			format(string, sizeof(string), "You have been interview banned by %s", GetPlayerNameEx(playerid));
	        SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
	        return 1;
	    }  else  {
	        PlayerInfo[giveplayerid][pLiveBanned] = 0;
	        format(string, sizeof(string), "%s has unbanned %s from interviews", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
	        ICNews(COLOR_LIGHTGREEN,string);
			format(string, sizeof(string), "You have been interview unbanned by %s", GetPlayerNameEx(playerid));
	        SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
	        return 1;
	    }
	return 1; /// 18332 ================ERROR HERE for some reason//
}
Reply
#2

What is the error? and I think It's not a problem with brackets.
Reply
#3

Код:
CMD:liveban(playerid, params[])
{
	 if(PlayerInfo[playerid][pFaction] != NEWS) return SCM(playerid, COLOR_WHITE,"You are not a News Reporter!");
	 if(PlayerInfo[playerid][pRank] < 5) return SCM(playerid, COLOR_LIGHTRED, "You are not authorized to use this command.");

		new
			giveplayerid,
			newsreporter,
	        string[128];

	    if(sscanf(params, "u", giveplayerid))
			return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /liveban [player]");

		if(!IsPlayerConnected(giveplayerid))
			return SendClientMessage(playerid, COLOR_GRAD1, "Invalid player specified.");

		foreach(Player, i) {
			if(TalkingLive[i] == giveplayerid) newsreporter = i;
		}

		if(TalkingLive[newsreporter] != INVALID_PLAYER_ID) {
			SendClientMessage(newsreporter, COLOR_LIGHTBLUE, "* Live conversation ended.");
			SendClientMessage(TalkingLive[newsreporter], COLOR_LIGHTBLUE, "* Live conversation ended.");
			TogglePlayerControllable(newsreporter, 1);
			TogglePlayerControllable(TalkingLive[newsreporter], 1);
			TalkingLive[TalkingLive[newsreporter]] = INVALID_PLAYER_ID;
			TalkingLive[newsreporter] = INVALID_PLAYER_ID;
		}

	    if(PlayerInfo[giveplayerid][pLiveBanned] == 0) {
	        PlayerInfo[giveplayerid][pLiveBanned] = 1;
	        format(string, sizeof(string), "%s has interview banned %s", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
	        ICNews(COLOR_LIGHTGREEN,string);
			format(string, sizeof(string), "You have been interview banned by %s", GetPlayerNameEx(playerid));
	        SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
	        return 1;
	    }  else  {
	        PlayerInfo[giveplayerid][pLiveBanned] = 0;
	        format(string, sizeof(string), "%s has unbanned %s from interviews", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
	        ICNews(COLOR_LIGHTGREEN,string);
			format(string, sizeof(string), "You have been interview unbanned by %s", GetPlayerNameEx(playerid));
	        SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
	        return 1;
	    }
return 1;
Reply
#4

should it really end like this ?


Код:
	    }
return 1;
Reply
#5

Nope
Reply
#6

Please help me :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)