if(listitem == 1) // Put in trunk
{
for(new vid; vid<MAX_VEHICLES; vid++)
{
if(Carinfo[vid][Trunk] == 0)
{
SendClientMessage(playerid, COLOR_RED,"{FF6A22}INFO: {FFFFFF}You need to open trunk first.");
return 1;
}
}
}
enum Car
{
Float:F, // Fuel
VehWin, // Windows
Trunk,
tWeapon1,
tWeapon2,
tWeapon3,
tWeapon4,
tWeapon5,
tWeapon6,
tAmmo1,
tAmmo2,
tAmmo3,
tAmmo4,
tAmmo5,
tAmmo6
};
new Carinfo[MAX_VEHICLES][Car];
forward Float:GetXYBehindCar(vid, &Float:q, &Float:w, Float:distance);
Float:GetXYBehindCar(vid, &Float:q, &Float:w, Float:distance)
{
new Float:a;
GetVehiclePos(vid, q, w, a);
GetVehicleZAngle(vid, a);
q += (distance * -floatsin(-a, degrees));
w += (distance * -floatcos(-a, degrees));
return a;
}
if(dialogid == DIALOG_TRUNK)
{
new vehicle = GetPlayerVehicleID(playerid);
new e,l,a,d,b,bo,o;
GetVehicleParamsEx(vehicle,e,l,a,d,b,bo,o);
if(response)
{
if(listitem == 0) // Open the trunk
{
for(new vid; vid<MAX_VEHICLES; vid++)
{
new Float: vx, Float:vy, Float:vz;
GetVehiclePos(vid,vx,vy,vz);
GetXYBehindCar(vid, vx, vy, 1.5);
if(Carinfo[vehicle][Trunk] == 1)
{
SendClientMessage(playerid, -1,"{FF6A22}INFO: {FFFFFF}Trunk is already open.");
return 1;
}
if(IsPlayerInRangeOfPoint(playerid,1.5,vx,vy,vz))
{
Carinfo[vehicle][Trunk] = 1;
SetVehicleParamsEx(vid,e,l,a,d,b,1,o);
return 1;
}
}
}
if(listitem == 1) // Put in trunk
{
if(Carinfo[vehicle][Trunk] == 0)
{
SendClientMessage(playerid, -1,"{FF6A22}INFO: {FFFFFF}You need to open trunk first.");
return 1;
}
}
if(listitem == 2) // Take from trunk
{
if(Carinfo[vehicle][Trunk] == 0)
{
SendClientMessage(playerid, -1,"{FF6A22}INFO: {FFFFFF}You need to open trunk first.");
return 1;
}
}
if(listitem == 3) // Close the trunk
{
for(new vid; vid<MAX_VEHICLES; vid++)
{
new Float: vx, Float:vy, Float:vz;
GetVehiclePos(vid,vx,vy,vz);
GetXYBehindCar(vid, vx, vy, 1.5);
if(Carinfo[vehicle][Trunk] == 0)
{
SendClientMessage(playerid, -1,"{FF6A22}INFO: {FFFFFF}Trunk is already close.");
return 1;
}
if(IsPlayerInRangeOfPoint(playerid,1.5,vx,vy,vz))
{
Carinfo[vehicle][Trunk] = 0;
SetVehicleParamsEx(vid,e,l,a,d,b,0,o);
return 1;
}
}
}
}
return 1;
}
if(car....)
new engine, lights, alarm, doors, bonnet, boot, objective; if(GetVehicleParamsEx(vehicleid, bonnet, 1)
forward Float:GetXYBehindCar(vid, &Float:q, &Float:w, Float:distance);
Float:GetXYBehindCar(vid, &Float:q, &Float:w, Float:distance)
{
new Float:a;
GetVehiclePos(vid, q, w, a);
GetVehicleZAngle(vid, a);
q += (distance * -floatsin(-a, degrees));
w += (distance * -floatcos(-a, degrees));
return a;
}
if(listitem == 1) // Put in trunk
{
for(new vid; vid<MAX_VEHICLES; vid++)
{
new e,l,a,d,b,bo,o;
GetVehicleParamsEx(vid,e,l,a,d,b,bo,o);
if(bo == 0)
{
SendClientMessage(playerid, COLOR_RED,"{00FF00}INFO: {FFFFFF}open it");
return 1;
}
}
}
if(listitem == 2) // Take from trunk
{
for(new vid; vid<MAX_VEHICLES; vid++)
{
new e,l,a,d,b,bo,o;
GetVehicleParamsEx(vid,e,l,a,d,b,bo,o);
if(bo == 0)
{
SendClientMessage(playerid, COLOR_RED,"{00FF00}INFO: {FFFFFF}open it");
return 1;
}
}
}
if(dialogid == DIALOG_TRUNK)
{
if(response)
{
if(listitem == 0) // Open the trunk
{
for(new vid; vid<MAX_VEHICLES; vid++)
{
new Float: vx, Float:vy, Float:vz;
GetVehiclePos(vid,vx,vy,vz);
GetXYBehindCar(vid, vx, vy, 2.5);
if(IsPlayerInRangeOfPoint(playerid,2.5,vx,vy,vz))
{
new e,l,a,d,b,bo,o;
GetVehicleParamsEx(vid,e,l,a,d,b,bo,o);
switch(VTrunk[vid])
{
case 0:
{
SetVehicleParamsEx(vid,e,l,a,d,b,1,o);
VTrunk[vid]=1;
format(string, sizeof(string), "* %s presses the button at the trunk and afterwards opens it.", Name);
ProxDetector(30.0, playerid, string, COLOR_DBLUE,COLOR_DBLUE,COLOR_DBLUE,COLOR_DBLUE,COLOR_DBLUE);
}
case 1:
{
SetVehicleParamsEx(vid,e,l,a,d,b,0,o);
VTrunk[vid]=0;
format(string, sizeof(string), "* %s grabs the edge of the trunk and closes it.", Name);
ProxDetector(30.0, playerid, string, COLOR_DBLUE,COLOR_DBLUE,COLOR_DBLUE,COLOR_DBLUE,COLOR_DBLUE);
}
}
return 1;
}
}
}
if(listitem == 1) // Put in trunk
{
for(new vid; vid<MAX_VEHICLES; vid++)
{
new e,l,a,d,b,bo,o;
GetVehicleParamsEx(vid,e,l,a,d,b,bo,o);
if(bo > 0)
{
SendClientMessage(playerid, COLOR_RED,"{00FF00}INFO: {FFFFFF}test message");
return 1;
}
else
{
SendClientMessage(playerid, COLOR_RED,"{00FF00}INFO: {FFFFFF} Closed");
return 1;
}
}
}
VTrunk[vid] |