SA-MP Forums Archive
/government (GodFather) - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /government (GodFather) (/showthread.php?tid=242376)



/government (GodFather) - darkknight123 - 20.03.2011

Ok I'm trying to make a /gov for my god father edit I dont like it how it is I'm wanting it something like

"_____________Government News Announcement ________________"
"%s %s: %s "
%s %s: %s"
"%s %s : %s "

if you cant see the patern then its without the

"_____________Government News Announcement ________________"

everytime
this is what it nomaly is

"_____________Government News Announcement ________________"
"%s %s: %s "
"_____________Government News Announcement ________________"
"%s %s: %s "
"_____________Government News Announcement ________________"
"%s %s: %s "
"_____________Government News Announcement ________________"
"%s %s: %s "

it spams heres the code im useing i tryed to edit it but I realy dont like the look I gave it so here if someone would be kind enough and help me fix this


pawn Код:
if(strcmp(cmd, "/government", true) == 0 || strcmp(cmd, "/gov", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(IsACop(playerid) || IsAAgent(playerid) || IsANG(playerid) || PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4 || PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pLeader] == 6)
            {
                if(PlayerInfo[playerid][pMember] == 1)
                {
                    if(PlayerInfo[playerid][pRank] < 4)
                    {
                        SendClientMessage(playerid, COLOR_GREY, "   You need to be Rank 4 to be able to use this !");
                        return 1;
                    }
                }
                else
                {
                    if(PlayerInfo[playerid][pRank] < 5)
                    {
                        SendClientMessage(playerid, COLOR_GREY, "   You need to be Rank 5 to be able to use this !");
                        return 1;
                    }
                }
                GetPlayerName(playerid, sendername, sizeof(sendername));
                new length = strlen(cmdtext);
                while ((idx < length) && (cmdtext[idx] <= ' '))
                {
                    idx++;
                }
                new offset = idx;
                new result[96];
                while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                {
                    result[idx - offset] = cmdtext[idx];
                    idx++;
                }
                result[idx - offset] = EOS;
                if(!strlen(result))
                {
                    SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/gov)ernment [text]");
                    return 1;
                }
                new rtext[64];
                if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1) //LSPD
                {
                    if(PlayerInfo[playerid][pRank] == 4) { rtext = "LSPD Captain"; }
                    else if(PlayerInfo[playerid][pRank] == 5) { rtext = "LSPD Deputy Chief"; }
                    else if(PlayerInfo[playerid][pRank] == 6) { rtext = "LSPD Chief"; }
                }
                else if(PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2) //FBI
                {
                    if(PlayerInfo[playerid][pRank] == 5) { rtext = "FBI Assistant Director"; }
                    else if(PlayerInfo[playerid][pRank] == 6) { rtext = "FBI Director"; }
                }
                else if(PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3) //SASP
                {
                    if(PlayerInfo[playerid][pRank] == 5) { rtext = "SASP Lt. Colonel"; }
                    else if(PlayerInfo[playerid][pRank] == 6) { rtext = "SASP Colonel"; }
                }
                else if(PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4) //Paramedic
                {
                    if(PlayerInfo[playerid][pRank] == 5) { rtext = "LSFMD Captain"; }
                    else if(PlayerInfo[playerid][pRank] == 6) { rtext = "LSFMD Battalion Chief"; }
                }
                else if(PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pLeader] == 5) //National Guard
                {
                    if(PlayerInfo[playerid][pRank] == 5) { rtext = "NG Colonel"; }
                    else if(PlayerInfo[playerid][pRank] == 6) { rtext = "NG General"; }
                }
                else if(PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pLeader] == 6) //Senate
                {
                    if(PlayerInfo[playerid][pRank] == 5) { rtext = "Vice Governor"; }
                    else if(PlayerInfo[playerid][pRank] == 6) { rtext = "Governor"; }
                }
                else if(PlayerInfo[playerid][pMember] == 7 || PlayerInfo[playerid][pLeader] == 7) //SS
                {
                    if(PlayerInfo[playerid][pRank] == 5) { rtext = "SS Vice Director"; }
                    else if(PlayerInfo[playerid][pRank] == 6) { rtext = "SS Director"; }
                }
                format(string, sizeof(string), "*Government Announcement* %s %s: %s",rtext,sendername, result);
                SendClientMessageToAll(COLOR_DBLUE, string);
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "   You are not a Cop / FBI / Fireman / Paramedic / NG / Governor !");
            }
        }
        return 1;
    }