Accessing element at negative index -400
#3

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
The vehicle does not exist (invalid) so GetVehicleModel returns 0. You can prevent it and if the vehicle does not exist, it'll print "N/A" instead:
pawn Код:
new String[128], modelid = GetVehicleModel(vehicleid);

format(String, sizeof(String), "{94CB80}• Pardavėte transportą {ff0000}%s {94CB80}uћ {ff0000}%sЂ{94CB80}.", (modelid) ? (VehicleNames[modelid - 400]) : ("N/A"), FormatuotiSkaicius(MoneyCount));
SendClientMessage(playerid, -1, String);
However, I'd suggest to check if the modelid is not valid and don't send the message at all.
Thanks, it works. But why in another code it works too (as on the my example)?
Reply


Messages In This Thread
Accessing element at negative index -400 - by rOps - 24.04.2015, 19:16
Re: Accessing element at negative index -400 - by Konstantinos - 24.04.2015, 19:19
Re: Accessing element at negative index -400 - by rOps - 24.04.2015, 19:24

Forum Jump:


Users browsing this thread: 1 Guest(s)