16.10.2012, 05:20
(
Последний раз редактировалось Abreezy; 16.10.2012 в 06:29.
)
Fixed.
CMD:lock(playerid, params[])
{
#pragma unused paramst6
new vid = GetPlayerVehicleID(playerid);
new model = GetVehicleModel(vid);
new string[128];
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
if(IsPlayerInAnyVehicle(playerid))
{
GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective);
if(doors == 0)
{
SetVehicleParamsEx(vid,engine,lights,alarm,1,bonnet,boot,objective);
format(string, sizeof(string), "* %s presses the button on the door panel, locking the %s. *", pName2(playerid),VehicleNames[model-400]);
SendLocalMessage(playerid, string, 10.0, COLOR_PURPLE, COLOR_PURPLE);
}
else if(doors == 1)
{
SetVehicleParamsEx(vid,engine,lights,alarm,0,bonnet,boot,objective);
format(string, sizeof(string), "* %s presses the button on the door panel, unlocking the %s. *", pName2(playerid),VehicleNames[model-400]);
SendLocalMessage(playerid, string, 10.0, COLOR_PURPLE, COLOR_PURPLE);
}
}
else
{
new nearest = GetNearestVehicle(playerid, 15.0);
new models = GetVehicleModel(nearest);
if(nearest < 0)
{
SendClientMessage(playerid, COLOR_WHITE, "> Your remote can't reach the vehicle, get closer.");
}
else if(nearest >= 0)
{
GetVehicleParamsEx(nearest, engine, lights, alarm, doors, bonnet, boot, objective);
if(doors == 0)
{
format(string, sizeof(string), "* %s takes their keys out, pressing the button, locking the %s. *", pName2(playerid), VehicleNames[models-400]);
SendLocalMessage(playerid, string, 10.0, COLOR_PURPLE, COLOR_PURPLE);
SetVehicleParamsEx(nearest,engine,lights,alarm,1,bonnet,boot,objective);
}
else if(doors == 1)
{
SetVehicleParamsEx(nearest,engine,lights,alarm,0,bonnet,boot,objective);
format(string, sizeof(string), "* %s presses the button on the door panel, unlocking the %s. *", pName2(playerid), VehicleNames[models-400]);
SendLocalMessage(playerid, string, 10.0, COLOR_PURPLE, COLOR_PURPLE);
}
}
}
return 1;
}
if(nearest < 0)
{
SendClientMessage(playerid, COLOR_WHITE, "> Your remote can't reach the vehicle, get closer.");
}
CMD:lock(playerid, params[])
{
#pragma unused paramst6
new vid = GetPlayerVehicleID(playerid);
new model = GetVehicleModel(vid);
new string[128];
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
if(IsPlayerInAnyVehicle(playerid))
{
GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective);
if(doors == 0)
{
SetVehicleParamsEx(vid,engine,lights,alarm,1,bonnet,boot,objective);
format(string, sizeof(string), "* %s presses the button on the door panel, locking the %s. *", pName2(playerid),VehicleNames[model-400]);
SendLocalMessage(playerid, string, 10.0, COLOR_PURPLE, COLOR_PURPLE);
}
else if(doors == 1)
{
SetVehicleParamsEx(vid,engine,lights,alarm,0,bonnet,boot,objective);
format(string, sizeof(string), "* %s presses the button on the door panel, unlocking the %s. *", pName2(playerid),VehicleNames[model-400]);
SendLocalMessage(playerid, string, 10.0, COLOR_PURPLE, COLOR_PURPLE);
}
}
else
{
new nearest = GetNearestVehicle(playerid, 15.0);
new models = GetVehicleModel(nearest);
if(!nearest >= 0)
{
SendClientMessage(playerid, COLOR_WHITE, "> Your remote can't reach the vehicle, get closer.");
}
else if(nearest >= 0)
{
GetVehicleParamsEx(nearest, engine, lights, alarm, doors, bonnet, boot, objective);
if(doors == 0)
{
format(string, sizeof(string), "* %s takes their keys out, pressing the button, locking the %s. *", pName2(playerid), VehicleNames[models-400]);
SendLocalMessage(playerid, string, 10.0, COLOR_PURPLE, COLOR_PURPLE);
SetVehicleParamsEx(nearest,engine,lights,alarm,1,bonnet,boot,objective);
}
else if(doors == 1)
{
SetVehicleParamsEx(nearest,engine,lights,alarm,0,bonnet,boot,objective);
format(string, sizeof(string), "* %s presses the button on the door panel, unlocking the %s. *", pName2(playerid), VehicleNames[models-400]);
SendLocalMessage(playerid, string, 10.0, COLOR_PURPLE, COLOR_PURPLE);
}
}
}
return 1;
}
if(nearest == 0)
if(nearest == INVALID_VEHICLE_ID) // Since 0 is not the invalid ID for the vehicles.