24.06.2012, 08:13
I got your point, but as for another resolution you can have "govon" variable defined in the starting of the script, and only gives the value 0 when connecting, not each time you submit the command, then make another command that ends the gov. announcement which it just gives the govon value 0, for example:
pawn Код:
new govon[MAX_PLAYERS]; // Somewhere in the starting of the script.
pawn Код:
CMD:gov(playerid, params[])
{
new string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!IsACop(playerid) || !IsFBi || !IsLSFMD || !IsAGov(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an LEO/Government Official.");
if(!PlayerInfo[playerid][pFacLeader]) return SendClientMessage(playerid, COLOR_GREY, "You are not a faction leader.");
if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/gov)ernment announcement [text]");
if(AntiAdv(playerid, params)) return 1;
if (govon[playerid] == 0)
{
SendClientMessageToAll(COLOR_WHITE, "|___________ Government News Announcement ___________|");
format(string, sizeof(string), "** [%s] %s %s: %s **", RPFN(playerid), RPFRN(playerid), RPN(playerid), params);
SendClientMessageToAll(COLOR_BLUE, string);
govon[playerid] == 1;
return 1;
}
else if (govon[playerid] == 1)
{
format(string, sizeof(string), "** [%s] %s %s: %s **", RPFN(playerid), RPFRN(playerid), RPN(playerid), params);
SendClientMessageToAll(COLOR_BLUE, string);
return 1;
}
return 1;
}
CMD:endgov(playerid, params[])
{
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!IsACop(playerid) || !IsFBi || !IsLSFMD || !IsAGov(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an LEO/Government Official.");
if(!PlayerInfo[playerid][pFacLeader]) return SendClientMessage(playerid, COLOR_GREY, "You are not a faction leader.");
if(govon[playerid] == 0) return SendClientMessage(playerid, COLOR_GREY, "You didn't start any announcement yet.");
SendClientMessage(playerid, COLOR_GREY, "You have ended your announcement to the public.");
govon[playerid] = 0;
return 1;
}