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

If I was creating this:
pawn Код:
CMD:gov(playerid, params[])
{
    new string[128], new govon;
    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.");
    govon == 0;
    if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/gov)ernment announcement [text]");
    if(AntiAdv(playerid, params)) return 1;
    if (govon == 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 == 1;
        return 1;
    }
    else if (govon == 1)
    {
        format(string, sizeof(string), "** [%s] %s %s: %s **", RPFN(playerid), RPFRN(playerid), RPN(playerid), params);
        SendClientMessageToAll(COLOR_BLUE, string);
        return 1;
    }
    return 1;
}
How would I create a little timer say after 1 minute of /gov not being done, govon returns to 0?
Reply
#2

you mean after 1 min you can cmd again ?
Reply
#3

No after 1 minutes the govon returns to 0, if you see I don't want the stupid ____Government Announcement___ to show every time someone /gov's so... I want it to be like, this. Imagine this IG.
pawn Код:
5:35:01: /gov Number 1
= __________Government Announcement__________
LSPD Chief: Number 1

5:35:04: /gov Number 2
=
LSPD Chief: Number 2  ( NOTE HERE THERE ISNT _____ THIS CRAP )


5:36:05: /gov Number 3
=
_____________Government Announcement__________ ( HERE IT IS, AFTER A MINUTE )
LSPD Chief: Number 3
Look at the times, hope that helps.
Reply
#4

You have to check for it, obviously. For the cmd, check
if(govon==1) return 0;
or whatever, and then use a pre-defined timer:
if(govon==0){if(IsCop(playerid)||etc){SetTimer("Go vTime",etc.); govon=1;}}


Later, you forward GovTime(playerid);
public GovTime(playerid)
{
KillTimer(GovTimer);
govon =0;
}


Simple as that.
Reply
#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


Forum Jump:


Users browsing this thread: 3 Guest(s)