04.02.2012, 23:15
(
Последний раз редактировалось rubygta; 06.02.2012 в 14:59.
)
Hello, there. I created /engine and /lights commands earlier today, and it worked great, but then something happened, I don't know what but something did happen.. So, please see if you guys can see what's wrong here. Compiles fine
Okay, the problem is: When I enter the vehicle, it turns the engine and lights on, and when I exit it, they both turn off..
Thanks in advance.
new
OnVehicleSpawn
And of course, the commands
Okay, the problem is: When I enter the vehicle, it turns the engine and lights on, and when I exit it, they both turn off..
Thanks in advance.
new
pawn Код:
new Engine[MAX_VEHICLES];
new Lights[MAX_VEHICLES];
pawn Код:
public OnVehicleSpawn(vehicleid)
{
Engine[vehicleid] = 0;
Lights[vehicleid] = 0;
return 1;
}
pawn Код:
CMD:engine(playerid, params[])
{
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerState(playerid) == 2)
{
new vehicle = GetPlayerVehicleID(playerid);
if(Engine[vehicle] == 0)
{
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
Engine[vehicle] = 1;
SetVehicleParamsEx(vehicle, 1, lights, alarm, doors, bonnet, boot, 0);
SCM(playerid, -1, "Engine"#COL_GREEN" On");
}else if(Engine[vehicle] == 1)
{
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
Engine[vehicle] = 0;
SetVehicleParamsEx(vehicle, 0, lights, alarm, doors, bonnet, boot, 0);
SCM(playerid, -1, "Engine"#COL_RED" Off");
}
}else return SCM(playerid, -1, "You're not the driver of the vehicle.");
}else return SCM(playerid, -1, "You're not in a vehicle.");
return 1;
}
pawn Код:
CMD:lights(playerid, params[])
{
if(GetPlayerState(playerid) == 2)
{
new vehicle = GetPlayerVehicleID(playerid);
if(Lights[vehicle] == 0)
{
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
Lights[vehicle] = 1;
SetVehicleParamsEx(vehicle, engine, 1, alarm, doors, bonnet, boot, 0);
SCM(playerid, -1, "Lights"#COL_GREEN" On");
}else if(Lights[vehicle] == 1)
{
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
Lights[vehicle] = 0;
SetVehicleParamsEx(vehicle, engine, 0, alarm, doors, bonnet, boot, 0);
SCM(playerid, -1, "Lights"#COL_RED" Off");
}
}else return SCM(playerid, -1, "You're not the driver of the vehicle");
return 1;
}