A Garage System?
#1

Hi, Could someone possibly make me a Garage Template were you are able to have only 3 cars inside of the Garage if you attempt to add a 4th one to it an error messages shows saying something like this "ERROR: You already have 3 Vehicles in your Garage".

I would be really happy if someone could make this Template.
Reply
#2

Explain this better, please.
Reply
#3

Save it as a variable.

pawn Код:
new GarageCars[2]; // Two garages, then the number of cars in each garage.
Reply
#4

Hmm, So would it be like this?

pawn Код:
new GarageCars[2][3]; // The [3] is the maximum cars.
or

pawn Код:
new GarageCars[2];
new Garage[3]; // Maximum cars.
?
Reply
#5

Nope, simply this.

pawn Код:
new GarageCars[2];
Because, there is an invisible [] after the GarageCars[2] that holds a variable. That variable, in this case, is the amount of cars.

So when somebody does, for example, /enter to the garage.

pawn Код:
if(strcmp(cmdtext, "/enter", true) == 0)
{
    if(IsPlayerInRangeOfPoint(playerid, 3, Float:x, Float:y, Float:z))
    {
        if(GarageCars[0] < 4)
        {
            SetPlayerPos(playerid, Float:intx, Float:inty, Float:intz);
            SetPlayerInterior(playerid, interiorid);
            GarageCars[0]++;
        }
        else
        {
            SendClientMessage(playerid, -1, "This garage is full.");
        }
    }
    return 1;
}
Reply
#6

How it could be if you exit, is it like that?

Код:
GarageCars[0]--;
Reply
#7

There's no point in bumping a year old topic. Make a new one kiddo.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)