GameText
#1

pawn Код:
if(!IsPlayerInDynamicCP(playerid, checkpoints[12])
            && !IsPlayerInDynamicCP(playerid, checkpoints[13])
            && !IsPlayerInDynamicCP(playerid, checkpoints[14])
            && !IsPlayerInDynamicCP(playerid, checkpoints[15])
            && !IsPlayerInDynamicCP(playerid, checkpoints[16])
            && !IsPlayerInDynamicCP(playerid, checkpoints[17])
            && !IsPlayerInDynamicCP(playerid, checkpoints[18])
            && !IsPlayerInDynamicCP(playerid, checkpoints[19])
            && !IsPlayerInDynamicCP(playerid, checkpoints[20])
            && !IsPlayerInDynamicCP(playerid, checkpoints[21])
            && !IsPlayerInDynamicCP(playerid, checkpoints[22])
            && !IsPlayerInDynamicCP(playerid, checkpoints[23])
            && !IsPlayerInDynamicCP(playerid, checkpoints[24])
            && !IsPlayerInDynamicCP(playerid, checkpoints[25]) && StoreRobbing[playerid] != -1) {

            GameTextForPlayer(playerid, "~r~Robbery failed!~n~Failed to stay in the ~r~checkpoint", 3000, 4);
            }
My storerobbing variable is -1 yet it still shows the game text.
Reply
#2

pawn Код:
for(new i = 12; i != 26; i++)
{
            if(!IsPlayerInDynamicCP(playerid, checkpoints[i])
           {
                if(i == 25)
                {
                    if(StoreRobbing[playerid] != -1))
                    {
                         GameTextForPlayer(playerid, "~r~Robbery failed!~n~Failed to stay in the ~r~checkpoint", 3000, 4); break;
                    }
                }
                continue;
            }
            else break;
}
That kind of structure would work, by the way. It's not perfect, I scripted something VAGUE. I don't know why that code shouldn't work.
Reply
#3

Pretty bad way to do it actually, it's better if you make a function AddRobPoint() for instance and this is very simple example...

pawn Код:
#define INVALID_ROB_POINT (0xFFFF)
#define MAX_ROB_POINTS 100

enum ROBDATA {
    RobID,
    bool:beingrobbed
}

new RobPoints[MAX_ROB_POINTS][ROBDATA];

public OnGameModeInit()
{
    for(new i = 0; i < MAX_ROB_POINTS; i++) { RobPoints[i][RobID] = INVALID_ROB_POINT; }
}

stock AddRobPoint(Float:robx, Float:roby, Float:robz)
{
    for(new i = 0; i < MAX_ROB_POINTS; i++)
    {
        if(RobPoints[i][RobID] == INVALID_ROB_POINT)
        {
             RobPoints[i][RobID] = CreateDynamicCP(robx, roby, robz, 2.0);
             return i;
        }
    }
    return INVALID_ROB_POINT;
}
That is just a basic set up you'll need more stuff in the enum such as recentlyrobbed, timetorob, playerrobid etc whatever you need goes into there then you just need to to update AddRobPoint() with additional parameters such as CP size etc in fact pretty much any dynamic system your write is going to follow this template design. I've written dozens of them so I can tell you the setup is almost always the same when designing dynamic systems.
Reply
#4

I have already made this type of system, it works pretty well and is unique to all shops not their interiors. Anyway, I want this so when they are robbing and they did exit the checkpoint (this code is in a timer) then ofc the robbery fails.
Reply
#5

OnPlayerLeaveDynamicCP(playerid, checkpointid); then check if they're robbing.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)