Problems with cmd - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problems with cmd (
/showthread.php?tid=457561)
Problems with cmd -
Pk93 - 12.08.2013
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//
}
Re: Problems with cmd -
Lucky™ - 12.08.2013
What is the error? and I think It's not a problem with brackets.
Re: Problems with cmd -
Lucky™ - 12.08.2013
Код:
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;
Re: Problems with cmd -
Pk93 - 12.08.2013
should it really end like this ?
Re: Problems with cmd -
verlaj - 12.08.2013
Nope
Re: Problems with cmd -
Pk93 - 12.08.2013
Please help me :P