Little random problem - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Little random problem (
/showthread.php?tid=171865)
Little random problem -
DyDy - 28.08.2010
Код:
new Veh = random(sizeof(VehiclesNames));
sInfo[Vehicle] = VehiclesNames[Veh - MIN_VEH_ID];//7158
(7158) : error 006: must be assigned to an array
Whats wrong?
Re: Little random problem -
Mauzen - 28.08.2010
Maybe you wanted to do it this way
pawn Код:
sInfo[Veh] = VehiclesNames[Veh - MIN_VEH_ID];//7158
Edit: Oops, no, I think the vehicle was correct
Edit 2: the problem is the [Veh - MIN_VEH_ID]. If the random returns e.g. 10, but MIN_VEH_ID is 20, it will result a negative value and crash the server.