28.11.2018, 14:50
Hey today i scripted a car shop system but it shows me this in the console
and this in the code
The string size is 300
i think this is because of the carname but idk how to solve it
Код:
Attempted to read/write array element at negative index -400
Код:
new caridd = dtc_AutohausCar[playerid] -1;
if(caridd < 0)
{
caridd = AhCars;
}
new car,preis,counter;
for(new ah = 0; ah < sizeof(dtcKaufliste);ah++)
{
if(dtcKaufliste[ah][dtc_Autohaus] == autohaus)
{
if( counter == caridd)
{
car = dtcKaufliste[ah][dtc_CarModel];
preis = dtcKaufliste[ah][dtc_CarPreis];
}
counter ++;
}
}
new c1 = random(120);
new c2 = random(120);
DestroyVehicle(dtc_AutohausSCar[playerid]);
dtc_AutohausSCar[playerid] = CreateVehicle(car, DtcSonstiges[autohaus][1][0],DtcSonstiges[autohaus][1][1],DtcSonstiges[autohaus][1][2],DtcSonstiges[autohaus][1][3],c1,c2,-1);
SetVehicleVirtualWorld(dtc_AutohausSCar[playerid],55+playerid);
PlayerTextDrawShow(playerid,CarKauf[playerid]);
format(string,sizeof(string),"~r~---------- AUTOHAUS ----------~n~~g~Fahrzeug: ~w~%s~n~~g~Preis: ~w~$%d~n~~b~Auswaehlen:~n~~w~ <LMB<~b~&~w~>RMB> ~n~~b~Kaufen:~w~ Enter ~n~~b~Abbrechen:~w~ Tab",CarName[car-400],preis);
PlayerTextDrawSetString(playerid,CarKauf[playerid],string);
dtc_AutohausCar[playerid] = caridd;
i think this is because of the carname but idk how to solve it

