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

PHP код:
new arrVehInfo[][][] =
{
      {
41156000"Infernus"},
      {
54112000"Bullet"}
}; 
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] == 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;
    } 
ERROR:

PHP код:
(16268) : error 033: array must be indexed (variable "arrVehInfo")
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
1 Error

Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)