open/close hood and trunk - 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: open/close hood and trunk (
/showthread.php?tid=472440)
open/close hood and trunk -
kbalor - 28.10.2013
Hi guys I am looking for a command for /hood and /trunk. It would be this.
Hood - Open/Close
Trunk - Open/Close
So when I use hood it will open and when use hood again it will close same with trunk.
Waiting for you reply. Big Thanks!
Re: open/close hood and trunk -
DobbysGamertag - 28.10.2013
There's stocks in the sa-mp includes for such a thing

this isn't the script request thread.
But here. Hope its some use
http://pastebin.com/qxQbz46a
Credits to whoever it was. I forgot who.
Re: open/close hood and trunk -
DStreet - 28.10.2013
here's a /trunk cmd I use
Код:
if(strcmp(cmd, "/trunk", true) == 0)
{
new counter = 0;
new vid;
new check = 0;
for(new i = 0; i < MAX_VEHICLES; i++)
{
new dist = CheckPlayerDistanceToVehicle(4, playerid, i);
if(dist)
{
vid = i;
counter++;
}
}
switch(counter)
{
case 0:
{
SendClientMessage(playerid, COLOR_GREY, "No cars with trunk near you");
}
case 1:
{
for(new i = 0; i < sizeof(CreatedCars); i++)
{
if(CreatedCars[i] == vid)
{
check = 1;
CreatedCars[i] = INVALID_VEHICLE_ID;
break;
}
}
if(check == 1)
{
SendClientMessage(playerid, COLOR_RED, "This vehicle trunk is not available");
return 1;
}
if(IsAPlane(vid) || IsABike(vid) || IsAHelicopter(vid) || IsATrain(vid) || IsABoat(vid) || IsABus(vid) || GetVehicleModel(GetPlayerVehicleID(vid)) == 523)
{
SendClientMessage(playerid, COLOR_GREY, "This vehicle doesn't have a trunk");
return 1;
}
ShowPlayerDialog(playerid,TRUNKDIALOG,DIALOG_STYLE_LIST,"Trunk","Open / Close\nCheck\nPut stuff\nTake stuff","Ok","Cancel"); //Trunk
return 1;
}
default:
{
SendClientMessage(playerid, COLOR_GREY, "Found more then one car in range");
return 1;
}
}
}