Robing system
#1

Hi friends

pawn Код:
#define MAX_ROB_STORE   100
new
        RobCP[MAX_ROB_STORE],
        PlayerBar:RobBar[MAX_ROB_STORE],
        gBarValue[MAX_PLAYERS][MAX_ROB_STORE],
        gInc[MAX_PLAYERS][MAX_ROB_STORE],
        GetBarID[MAX_PLAYERS],
        bool: pRobbing[MAX_PLAYERS][MAX_ROB_STORE],
        bool: Robbed[MAX_ROB_STORE]
;

In OnGameModeint: RobCP[0] = CreateDynamicCP(-2436.2815, 499.1061, 29.9396, 1.5);

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_WALK && GetPlayerTeam(playerid) == TEAM_CIVILIAN)
    {
        for (new i; i < MAX_ROB_STORE; ++i)
        {
            if(IsPlayerInDynamicCP(playerid, RobCP[i]))
            {
                if(pRobbing[playerid][i]) return SendClientMessage( playerid, COLOR_ERROR, "[ERROR] You are already robbing store");
                if(Robbed[i]) return SendClientMessage( playerid, COLOR_ERROR, "[ERROR] Store has been robbed recently, please wait patiently!" );

                pRobbing[playerid][i] = 1;
                Robbed[i] = 1;

                GetBarID[playerid] = i;
                RobBar[i] = CreatePlayerProgressBar(playerid, 547.000000, 446.000000, 10.000000, 50.000000, -11927297, 100, BAR_DIRECTION_UP);
                SetPlayerProgressBarValue(playerid, RobBar[i], 0);
                gBarValue[playerid][i] = 0;
                ShowPlayerProgressBar(playerid, RobBar[i]);
                ProgressBarTime(playerid);
               
                return 1;
            }
        }
    }
    return 1;
}

timer ProgressBarTime[1000](playerid)
{
    if(gBarValue[playerid][GetBarID[playerid]] <= 0) gInc[playerid][GetBarID[playerid]] = 1;

    SetPlayerProgressBarValue(0, RobBar[GetBarID[playerid]], gBarValue[playerid][GetBarID[playerid]]);
    gBarValue[playerid][GetBarID[playerid]] += gInc[playerid][GetBarID[playerid]];
}
I'm doing a dynamic system theft anything you can create points of robbery with a command, but hey that's not the point right now.

I get warning 213: tag mismatch in these lines:

pawn Код:
pRobbing[playerid][i] = 1; //warning 213: tag mismatch
                Robbed[i] = 1; //warning 213: tag mismatch
If you have suggestions for better elsewhere in the code they are also grateful

Thanks
Reply
#2

Quote:
Originally Posted by Cerealguy
Посмотреть сообщение
Hi friends
pawn Код:
pRobbing[playerid][i] = 1;
    Robbed[i] = 1;
should be
pawn Код:
pRobbing[playerid][i] = true;
    Robbed[i] = true;
because they are bool
Reply
#3

oh I'm such an idiot, thanks friend
Reply
#4

No problems
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)