[Still Not Fixed] /engine, and /lights problem -
rubygta - 04.02.2012
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
pawn Код:
new Engine[MAX_VEHICLES];
new Lights[MAX_VEHICLES];
OnVehicleSpawn
pawn Код:
public OnVehicleSpawn(vehicleid)
{
Engine[vehicleid] = 0;
Lights[vehicleid] = 0;
return 1;
}
And of course, the commands
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;
}
Re: /engine, and /lights problem -
ғαιιοцт - 04.02.2012
I don't think you can do anything about that.
Samp automatically makes the lights go off when no player is in the vehicle.
Re: /engine, and /lights problem -
rubygta - 04.02.2012
Not true. I've seen this before. plus, it worked before.
Re: /engine, and /lights problem -
ғαιιοцт - 04.02.2012
Ok, then show me your onplayerexitvehicle and onplayerstatechange please.
Re: /engine, and /lights problem -
rubygta - 04.02.2012
OnPlayerExitVehicle
pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}
Empty..
OnPlayerStateChange
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new carid;
new i = 0;
if(carid == CopCar[i])
{
if(PlayerInfo[playerid][pMember] == 1)
return 1;
}
else return RemovePlayerFromVehicle(playerid), SCM(playerid,RED,"You're NOT an Flint County Sheriffs Department Officer!");
if(carid == FBI[i])
{
if(PlayerInfo[playerid][pMember] == 2)
return 1;
}
else return RemovePlayerFromVehicle(playerid), SCM(playerid,RED,"You're NOT in the FBI!");
if(carid == FCFD[i])
{
if(PlayerInfo[playerid][pMember] == 3)
return 1;
}
else return RemovePlayerFromVehicle(playerid), SCM(playerid,RED,"You're NOT an Flint County Fire Department member!");
return 1;
}
Doubt it's anything wrong with that ;s
Re: /engine, and /lights problem -
ғαιιοцт - 04.02.2012
Ok, the I don't know, sorry
Re: /engine, and /lights problem -
rubygta - 05.02.2012
Thanks, anyway
Hope there's somebody here that can help me solve this.
Re: /engine, and /lights problem -
wolfcock - 05.02.2012
*Fixed by me.
Re: /engine, and /lights problem -
ғαιιοцт - 05.02.2012
So what was wrong?
Re: /engine, and /lights problem -
wolfcock - 05.02.2012
He forgot to put:
"Engine = 0;" on "OnGameModeInit"