error 033: array must be indexed (variable "arrVehInfo")
#5

you may try this:
PHP код:
if(arrVehInfo[index][0][0] == iVehModel
PHP код:
public OnPlayerStateChange(playeridnewstateoldstate

    
// Was he onfoot and THEN he entered the driver and if yes, then only show him the info! 
    
if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER
    { 
        new 
iVeh GetPlayerVehicleID(playerid); // Get his vehicle ID not vehicle MODEL. 
        
new iVehModel GetVehicleModel(iVeh); // Can call implicitly the above 2 functions, but multiple calls, no - no or just for simplicity's sake 
        
for(new index 0index sizeof(arrVehInfo); index++ ) 
        { 
             if(
arrVehInfo[index][0][0] == iVehModel
             
// Yes - he's in that row's model 
             

                  new 
szString[80]; 
                  
format(szStringsizeof szString"VEHICLE: You can sell this %s at a nearby carshop for $%d."arrVehInfo[index][2], arrVehInfo[index][1] ) ; 
                  
// remember - the 0th pos was the model, 1st pos - the price and the 2nd pos - the string. 
                  
SendClientMessage(playerid, -1szString); 
                  break ; 
// You got the vehicle, why loop anymore? 
             

        } 
        return 
1
    } 
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)