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;
}