CMD:trunk(playerid,params[])
{
new vid;
vid = GetPlayerVehicleID(playerid);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
if(boot)
{
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,true,objective);
SCM(playerid,COLOR_LIGHTRED,"You Have Poped The Trunk!");
}
else
{
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,false,objective);
SCM(playerid,COLOR_LIGHTRED,"You Have Closed The Trunk!");
}
return 1;
}
if(!boot)
if(!boot)
CMD:trunkclose(playerid,params[])
{
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,false,objective);
SCM(playerid,COLOR_LIGHTRED,"You Have Closed The Trunk!");
return 1;
}
If boot is open, open the boot again? That's what your script is doing. Fix:
pawn Код:
|
Hmm, I even dunno what a trunk is!^^
But why this? PHP код:
Try making an extra command! pawn Код:
|
CMD:trunk(playerid, params[])
{
new string[128];
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
new engine,lights,alarm,doors,bonnet,boot,objective;
new oldcar = gLastCar[playerid];
new Float:cX, Float:cY, Float:cZ;
GetVehicleParamsEx(oldcar, engine, lights, alarm, doors, bonnet, boot, objective);
GetVehiclePos(oldcar, cX, cY, cZ);
new vehicleid = GetPlayerVehicleID(playerid);
if(!IsAPlane(vehicleid) || !IsAHelicopter(vehicleid) || !IsABike(vehicleid) || !IsATrain(vehicleid) || !IsABoat(vehicleid))
{
if(IsPlayerDriver(playerid) || IsPlayerInRangeOfPoint(playerid, 5, cX+2, cY, cZ))
{
if(boot != 1)
{
boot = 1;
SetVehicleParamsEx(oldcar,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_ON,objective);
SendClientMessage(playerid, 0xFFFFFFAA, "[Vehicle Control] You've opened the trunk!");
format(string, sizeof(string), "* %s opens up the trunk of the car.", sendername);
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
else
{
boot = 0;
SetVehicleParamsEx(oldcar,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_OFF,objective);
SendClientMessage(playerid, 0xFFFFFFAA, "[Vehicle Control] You've shut the trunk!");
format(string, sizeof(string), "* %s closes the trunk of the car.", sendername);
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
}
}
return boot;
}
stock IsPlayerDriver(playerid)
{
if(IsPlayerConnected(playerid) && GetPlayerState(playerid)==PLAYER_STATE_DRIVER)
{
return 1;
}
return 0;
}