Help array erros
#1

im fixxed, tks
Reply
#2

Try this
Код:
CMD:conce(playerid,params[])
        new 
            nomedocarro[80],
            string[128]
        ;

        for(new index = 0; index < sizeof Conce; index++){
            if(sscanf(params,"s[80]",nomedocarro)){
                SendClientMessage(playerid, -1, "/conce [nome do carro]");
                format(string, 128, "Carlist:%s(ID:%d) = $%d",
                    Conce[index][1],
                    Conce[index][0],
                    Conce[index][2]
                    );
                SendClientMessage(playerid, -1, string);
            }

            if(!strcmp(nomedocarro, Conce[index][1]))
            {
                if(GetPlayerMoney(playerid) < Conce[index][3] ) return SendClientMessage(playerid, COLOR_RED, "You do not have enough money."); // error 032: array index out of bounds (variable "Conce")
                GivePlayerMoney(playerid,- Conce[index][3] ); // error 032: array index out of bounds (variable "Conce")
                carpos[playerid][0] = 549.4260;
                carpos[playerid][1] = -1271.7909;
                carpos[playerid][2] = 17.3374;
                carpos[playerid][3] = 332.4741;
                carid[playerid] = Conce[index][0] ; // error 006: must be assigned to an array
                carro[playerid] = CreateVehicle(carid[playerid], carpos[playerid][0], carpos[playerid][1], carpos[playerid][2], carpos[playerid][3], 0, 1, 60);
            }else{
                SendClientMessage(playerid, -1, "Nгo existe este veiculo em nossa concessionбria.");
            }
        }
        return true;
    }
Reply
#3

im try, erros in comments again
pawn Код:
CMD:conce(playerid,params[]) {
        new nomedocarro[80], string[128];
        for(new index = 0; index < sizeof Conce; index++) {
            if(sscanf(params,"s[80]",nomedocarro)){
                SendClientMessage(playerid, -1, "/conce [nome do carro]");
                format(string, 128, "Carlist:%s(ID:%d) = $%d",
                    Conce[index][1],
                    Conce[index][0],
                    Conce[index][2]
                    );
                SendClientMessage(playerid, -1, string);
            }

            if(!strcmp(nomedocarro, Conce[index][1]))
            {
                if(GetPlayerMoney(playerid) < Conce[index][3] ) return SendClientMessage(playerid, COLOR_RED, "You do not have enough money."); // error 032: array index out of bounds (variable "Conce")
                GivePlayerMoney(playerid,- Conce[index][3] ); // error 032: array index out of bounds (variable "Conce")
                carpos[playerid][0] = 549.4260;
                carpos[playerid][1] = -1271.7909;
                carpos[playerid][2] = 17.3374;
                carpos[playerid][3] = 332.4741;
                carid[playerid] = Conce[index][0] ; // error 006: must be assigned to an array
                carro[playerid] = CreateVehicle(carid[playerid], carpos[playerid][0], carpos[playerid][1], carpos[playerid][2], carpos[playerid][3], 0, 1, 60);
            }else{
                SendClientMessage(playerid, -1, "Nгo existe este veiculo em nossa concessionбria.");
            }
        }
        return true;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)