PHP код:
command(car, playerid, params[])
{
if(isnull(params))
{
SendClientMessage(playerid, WHITE, "SYTNAX: /car [usage]");
SendClientMessage(playerid, WHITE, "USAGES: hood, lights, trunk.");
}
else
{
new closestid = GetClosestCar(playerid, 5);
new vehicleid = GetPlayerVehicleID(playerid);
new Float:x, Float:y, Float:z;
new engine, lights, alarm, doors, bonnet, boot, objective;
new string[256];
GetVehicleParamsEx(closestid, engine,lights,alarm,doors,bonnet, boot,objective);
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
GetVehiclePos(vehicleid, x, y, z);
if(IsPlayerInRangeOfPoint(playerid, 5, x, y, z-3))
{
if(strcmp(params, "hood", true) == 0)
{
if(Vehicles[closestid][Hood] == 0)
{
Vehicles[closestid][Hood] = 1;
format(string, 256, "* %s opens the hood of their vehicle.", GetName(playerid));
NearByMessage(playerid, PURPLE, string);
SetVehicleParamsEx(closestid, engine, lights, alarm, doors, 1, boot, objective);
}
else if(Vehicles[closestid][Hood] == 1)
{
Vehicles[closestid][Hood] = 0;
format(string, 256, "* %s closes the hood of their vehicle.", GetName(playerid));
NearByMessage(playerid, PURPLE, string);
SetVehicleParamsEx(closestid, engine, lights, alarm, doors, 0, boot, objective);
}
}
}
if(IsPlayerInRangeOfPoint(playerid, 5, x, y, z+3))
{
if(strcmp(params, "trunk", true) == 0)
{
if(Vehicles[closestid][Trunk] == 0)
{
Vehicles[closestid][Trunk] = 1;
format(string, 256, "* %s extends his right arm towards the trunk, opening the trunk of their vehicle.", GetName(playerid));
NearByMessage(playerid, PURPLE, string);
SetVehicleParamsEx(closestid, engine, lights, alarm, doors, bonnet, 1, objective);
}
else if(Vehicles[closestid][Trunk] == 1)
{
Vehicles[closestid][Trunk] = 0;
format(string, 256, "* %s closes the hood of their vehicle.", GetName(playerid));
NearByMessage(playerid, PURPLE, string);
SetVehicleParamsEx(closestid, engine, lights, alarm, doors, bonnet, 0, objective);
}
}
}
}