Array index out of bounds
#2

I am pretty sure the line off error is this -
pawn Код:
format(msg, sizeof(msg), "~g~>> ~r~You have spawned ~g~%s", VehicleNames[GetVehicleModelIdFromName(params) - 400]);
As you have used optional specifier in sscanf that means possible inputs could be like these :
Quote:

/v sultan [params = "sultan"]
/v sultan 154 [params = "sultan 154"]
/v sultan 154 31 [params = "sultan 154 31"]

Now you see first condition is ok but if user enters other two then that will cause a major problem
If u have vehicle model already then why use GetVehicleModelIdFromName(params)..
So use this line -
Quote:

format(msg, sizeof(msg), "~g~>> ~r~You have spawned ~g~%s", VehicleNames[VehicleID - 400]);

Note : you have used this line at two places so replace the line with line i gave in both two places
Reply


Messages In This Thread
Array index out of bounds - by kesarthakur - 17.01.2015, 12:32
Re: Array index out of bounds - by BroZeus - 17.01.2015, 12:55

Forum Jump:


Users browsing this thread: 1 Guest(s)