Warning 215: Expression has no effect
#1

PHP код:
SetVehicleStatus(vehicleidstatus){
    new 
enginelightsalarmdoorsbonnetbootobjective;
    
GetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective);
    switch(
status){
        case 
0:{
            (
engine == 0) ? SetVehicleParamsEx(vehicleidVEHICLE_PARAMS_ONlightsalarmdoorsbonnetbootobjective) : SetVehicleParamsEx(vehicleidVEHICLE_PARAMS_OFFVEHICLE_PARAMS_OFFalarmdoorsbonnetbootobjective); // ERROR
        
}
        case 
1:{
            (
lights == 0) ? SetVehicleParamsEx(vehicleidengineVEHICLE_PARAMS_ONalarmdoorsbonnetbootobjective) : SetVehicleParamsEx(vehicleidengineVEHICLE_PARAMS_OFFalarmdoorsbonnetbootobjective); // ERROR
        
}
        case 
2:{
            (
bonnet == 0) ? SetVehicleParamsEx(vehicleidenginelightsalarmdoorsVEHICLE_PARAMS_ONbootobjective) : SetVehicleParamsEx(vehicleidenginelightsalarmdoorsVEHICLE_PARAMS_OFFbootobjective); // ERROR
        
}
        case 
3:{
            (
boot == 0) ? SetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetVEHICLE_PARAMS_ONobjective) : SetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetVEHICLE_PARAMS_OFFobjective); // ERROR
        
}
        case 
4:{
            (
doors == 0) ? SetVehicleParamsEx(vehicleidenginelightsalarmVEHICLE_PARAMS_ONbonnetbootobjective) : SetVehicleParamsEx(vehicleidengineVEHICLE_PARAMS_OFFalarmdoorsbonnetbootobjective); // ERROR
        
}
    }
    return 
1;

Help me please!
Reply
#2

if statement before the conditions.
Reply
#3

Can I use "?" and ":" condition? It is also a condition.
Reply
#4

Try this
PHP код:
SetVehicleStatus(vehicleidstatus){ 
    new 
enginelightsalarmdoorsbonnetbootobjective
    
GetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective); 
    switch(
status){ 
        case 
0:{ 
            (
engine 0) ? SetVehicleParamsEx(vehicleidVEHICLE_PARAMS_ONlightsalarmdoorsbonnetbootobjective) : SetVehicleParamsEx(vehicleidVEHICLE_PARAMS_OFFVEHICLE_PARAMS_OFFalarmdoorsbonnetbootobjective); // ERROR 
        

        case 
1:{ 
            (
lights 0) ? SetVehicleParamsEx(vehicleidengineVEHICLE_PARAMS_ONalarmdoorsbonnetbootobjective) : SetVehicleParamsEx(vehicleidengineVEHICLE_PARAMS_OFFalarmdoorsbonnetbootobjective); // ERROR 
        

        case 
2:{ 
            (
bonnet 0) ? SetVehicleParamsEx(vehicleidenginelightsalarmdoorsVEHICLE_PARAMS_ONbootobjective) : SetVehicleParamsEx(vehicleidenginelightsalarmdoorsVEHICLE_PARAMS_OFFbootobjective); // ERROR 
        

        case 
3:{ 
            (
boot 0) ? SetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetVEHICLE_PARAMS_ONobjective) : SetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetVEHICLE_PARAMS_OFFobjective); // ERROR 
        

        case 
4:{ 
            (
doors 0) ? SetVehicleParamsEx(vehicleidenginelightsalarmVEHICLE_PARAMS_ONbonnetbootobjective) : SetVehicleParamsEx(vehicleidengineVEHICLE_PARAMS_OFFalarmdoorsbonnetbootobjective); // ERROR 
        

    } 
    return 
1

Reply
#5

https://sampforum.blast.hk/showthread.php?tid=216730 read about the ternary operator. Also I think it's better to use the if-else statement here.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)