Zcmd help needed!
#1

Hello there fellow members, I'm in need with some help on a Zcmd im stuck on, It is a bank robbery system, Here is my current code that i need help with.
Код:
//START: Reset Bank Robbery Command

CMD:resetbankk(playerid, params[])
{
        if( PlayerInfo[ playerid ] [ pAdmin ] >= 99999 ) {
                                                BankRobbedRecently = 0;
                                                PlayerInfo[playerid][pRobTime] = 0;
                                 new string[128];
                          format( string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s has reset the bank robbery timer.", GetPlayerNameEx( playerid ) );
                          ABroadCast( COLOR_YELLOW, string, 4 );
                }
                else {
                    SendClientMessageEx( playerid, COLOR_GREY, "Command is not in your authority to be used!" );
                }
        return 1;
}

//END: Reset Bank Robbery Command

//START: Bank Robbery Command

forward UnsetBankRob();
public UnsetBankRob()
{
        BankRobbedRecently = 0;
        return 1;
}
CMD:robbank(playerid, params[])
        {
            new success = random(2);
            if(BankRobbedRecently == 1)
                {
                    SendClientMessage(playerid, COLOR_GREY, "* This location was robbed recently, try again later");
                    return 1;
                }
                if(PlayerInfo[playerid][pRobTime] >= 1)
                {
                    SendClientMessage(playerid, COLOR_GREY, "* You already attempted or robbed a place recently, please wait.-jake is god");
                    return 1;
                }



     if(!IsAtRobBankPoint(playerid))
            {
                if(GetPlayerWeapon(playerid) >= 24 && GetPlayerWeapon(playerid) <= 40)
                        {
                        if(PlayerInfo[playerid][pDuty] == 0)
                                {
                                if(success == 1)
                                        {
                                        SendClientMessage(playerid, COLOR_ORANGE, "* You are now Robbing the Los Santos bank, please remain in the checkpoint for 500 Seconds!");
                            RobbingTime[playerid] = 30;
                                    WantedPoints[playerid] = 6;
                                    SetPlayerCriminal(playerid,255, "Robbing the Bank");
                                    PlayerInfo[playerid][pRobTime] = 86400;
                                    BankRobbedRecently = 1;
                                                                        GivePlayerCash(playerid, 400000);
                                                                        SetTimer("UnsetBankRob",21600,false);

                                        }
                                        else
                                        {
                                            SendClientMessage(playerid, COLOR_ORANGE, "* You failed to rob the Bank!");
                                            WantedPoints[playerid] = 2;
                                    SetPlayerCriminal(playerid,255, "Attempting to rob the Bank");
                                                PlayerInfo[playerid][pRobTime] = 10;
                                        }
                                }
                                else
                                {
                                    SendClientMessage(playerid, COLOR_GREY, "* Go Off duty first!");
                                    return 1;
                                }
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_GREY, "* You need a deadly weapon to perform this Act!");
                            return 1;
                        }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "* You're not at the Bank Rob Point!");
                    return 1;
                }
                return 1;
        }

//END: Bank Robbery Command
I need help with "PlayerInfo[playerid][pRobTime] = 0;" line, i need it to set [pRobTime] in playerinfo for all players on the server, Anyone here able to help me out? Thanks in advanced.
Tyler.
Reply
#2

Use loop if you want to put all the players, for example:

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
     PlayerInfo[i][pRobTime] = 0;
}
Try.
Reply
#3

Thank you for your help man!, but do you mind explaining it in another way so i fully understand, since this is new, i will need to define the "i" function wont i? ive been working on this for about 5 hours trying to get it fully working its gotten to the point where i had to come to the forums and ask for help which i barely ever do.
Thanks!
Reply
#4

Actually i figured it out from your code, Thank you very much your a life saver!, Have a good day mate!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)