whats wrong? -
-Rebel Son- - 08.12.2010
Im trying to make two commands to turn the lights on and off, and engine on and off, but somereason they turn on, but wont turn off. anyone see anything i missed?
pawn Код:
if(strcmp(cmdtext, "/engine",true) == 0) {
if(Engine[playerid] == 0){
Engine[playerid] =1;
new vid = GetPlayerVehicleID(playerid);
if(vid != INVALID_VEHICLE_ID) {
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
}
else
{
if(vid != INVALID_VEHICLE_ID)
{
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
Engine[playerid] =0;
}
}
}
return 1;
}
if(strcmp(cmdtext, "/lights",true) == 0){
if(Lights[playerid] == 0){
Lights[playerid] =1;
new vid123 = GetPlayerVehicleID(playerid);
if(vid123 != INVALID_VEHICLE_ID)
{
GetVehicleParamsEx(vid123,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid123,engine,VEHICLE_PARAMS_ON,alarm,doors,bonnet,boot,objective);
}
else
{
if(vid123 != INVALID_VEHICLE_ID)
{
Lights[playerid] =0;
GetVehicleParamsEx(vid123,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid123,engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective);}}
}
return 1;
}
Re: whats wrong? -
Biesmen - 08.12.2010
Try this:
pawn Код:
if(strcmp(cmdtext, "/lights",true) == 0){
if(IsPlayerInAnyVehicle(playerid)
if(Lights[playerid] == 0){
Lights[playerid] = 1;
new vid123 = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vid123,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid123,engine,VEHICLE_PARAMS_ON,alarm,doors,bonnet,boot,objective);
return 1;
}
if(Lights[playerid] == 1){
Lights[playerid] = 0;
GetVehicleParamsEx(vid123,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid123,engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective);
return 1;
}
}
Edit: Oh, I see you have the same problem for engines. Try this one for the engines:
pawn Код:
if(strcmp(cmdtext, "/engine",true) == 0) {
if(IsPlayerInAnyVehicle(playerid) {
if(Engine[playerid] == 0){
Engine[playerid] =1;
new vid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
return 1;
}
if(Engine[playerid] == 1) {
{
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
Engine[playerid] =0;
return 1;
}
}
Re: whats wrong? -
-Rebel Son- - 08.12.2010
Oh captain my captian, thank you biesman