A Garage System? - 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)
+--- Thread: A Garage System? (
/showthread.php?tid=233962)
A Garage System? -
Luis- - 02.03.2011
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.
Re: A Garage System? -
SchurmanCQC - 02.03.2011
Explain this better, please.
Re: A Garage System? -
Antonio [G-RP] - 02.03.2011
Save it as a variable.
pawn Код:
new GarageCars[2]; // Two garages, then the number of cars in each garage.
Re: A Garage System? -
Luis- - 02.03.2011
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.
?
Re: A Garage System? -
Antonio [G-RP] - 02.03.2011
Nope, simply this.
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;
}
Re : A Garage System? -
Jack_Loreva - 11.11.2012
How it could be if you exit, is it like that?
Re: A Garage System? -
Faisal_khan - 11.11.2012
There's no point in bumping a year old topic. Make a new one kiddo.