SA-MP Forums Archive
[HELP] Look at this... Dont even know how to call it. - 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: [HELP] Look at this... Dont even know how to call it. (/showthread.php?tid=206360)



[SOLVED] Look at this... Dont even know how to call it. - Universal - 03.01.2011

SOLVED

PS. trolol


Re: [HELP] Look at this... Dont even know how to call it. - Universal - 03.01.2011

Well?


Re: [HELP] Look at this... Dont even know how to call it. - Babul - 03.01.2011

in your LoadVehicle(), i suspect THIS line to cause the trouble:
Код:
SetVehicleNumberPlate(CreateVehicle(carDB[i][cModel].....
CreateVehicle() returns not 1, but the Vehicles' ID it created, your car gets assigned the 1 (as first vehicle created).
i suggest you to create a large array for holding the cars you want to control, like
Код:
new Vehicle[MAX_VEHICLES];
then you can access it anytime by using that Variable w/o need to think which "real" ID it got:
Код:
for(new loop=0;loop<MAX_VEHICLES;loop++)
{
SetVehicleNumberPlate(Vehicle[i],carDB[Vehicle[i]][cNumber]);
}
this will fuck up your /lock command now, but the sense of using arrays are obvious i guess
btw: it (arrays used as pointers) do excellent with streamed objects aswell ^^


Re: [HELP] Look at this... Dont even know how to call it. - Universal - 03.01.2011

Quote:
Originally Posted by Babul
Посмотреть сообщение
in your LoadVehicle(), i suspect THIS line to cause the trouble:
Код:
SetVehicleNumberPlate(CreateVehicle(carDB[i][cModel].....
CreateVehicle() returns not 1, but the Vehicles' ID it created, your car gets assigned the 1 (as first vehicle created).
i suggest you to create a large array for holding the cars you want to control, like
Код:
new Vehicle[MAX_VEHICLES];
then you can access it anytime by using that Variable w/o need to think which "real" ID it got:
Код:
for(new loop=0;loop<MAX_VEHICLES;loop++)
{
SetVehicleNumberPlate(Vehicle[i],carDB[Vehicle[i]][cNumber]);
}
this will fuck up your /lock command now, but the sense of using arrays are obvious i guess
btw: it (arrays used as pointers) do excellent with streamed objects aswell ^^
So now, instea of using this:

pawn Код:
for(new i=0; i<MAX_VEHICLES; i++)
{
 if(IsPlayerInVehicle(playerid,i))
 {
   return 1;
 }
}
I should do this:
pawn Код:
for(new i=0; i<MAX_VEHICLES; i++)
{
       if(IsPlayerInVehicle(playerid,Vehicle[i]))
      {
             return 1;
        }
}
?