I'm sure its easy, please help quick!
#5

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;
}
Reply


Messages In This Thread
I'm sure its easy, please help quick! - by grantism - 24.06.2012, 07:20
Re: I'm sure its easy, please help quick! - by doreto - 24.06.2012, 07:23
Re: I'm sure its easy, please help quick! - by grantism - 24.06.2012, 07:27
Re: I'm sure its easy, please help quick! - by Grand_Micha - 24.06.2012, 07:30
Re: I'm sure its easy, please help quick! - by Randy More - 24.06.2012, 08:13

Forum Jump:


Users browsing this thread: 1 Guest(s)