Vehicle System - Help
#1

Hey ya'all.
Let's get to the problem, shall we?

I recently made a Vehicle System that uses 'Enumerator'. I use SII include for saving/loading data. I'll give you some of my Snippets.

Creation of Vehicle.
pawn Код:
for(new i=1;i<MAX_CARS;i++)
    {
        AddStaticVehicleEx(VehicleInfo[i][vModel],VehicleInfo[i][vLocX],VehicleInfo[i][vLocY],VehicleInfo[i][vLocZ],VehicleInfo[i][vAngle],
        VehicleInfo[i][vColorOne],VehicleInfo[i][vColorTwo],-1);
        SetVehicleNumberPlate(i,VehicleInfo[i][vPlate]);
        SetVehicleToRespawn(i);
        new engine,lights,alarm,doors,bonnet,boot,objective;
        GetVehicleParamsEx(i,engine,lights,alarm,doors,bonnet,boot,objective);
        SetVehicleParamsEx(i,0,0,alarm,doors,bonnet,boot,objective);
Enumerator
pawn Код:
enum vInfo
{
    vModel,
    Float: vLocX,
    Float: vLocY,
    Float: vLocZ,
    Float: vAngle,
    vColorOne,
    vColorTwo,
    vOwner[MAX_PLAYER_NAME],
    vOwned,
    vDescription[MAX_PLAYER_NAME],
    vPrice,
    vLock,
    vTrunkWeapon[MAX_PLAYER_NAME],
    vTrunkWeaponAmmo,
    Float: vTrunkArmour,
    vCash,
    vAlarm,
    vFuel,
    vPlate[8],
    vSideJob,
    vParkingTicket,
}
new VehicleInfo[MAX_CARS][vInfo];
I use fwrite,io read, io append for Reading and Saving Data. But the result of this Vehicle system, is this.

Well, the Vehicles are saving, but are damn bugged on loading. In this pic, the vehicle at this Pos was a Fortune and a Cadrona at the back. Where did that Black Car come from? It isn't the only one, it spawns in Millions,one over another. Any help please?
Reply
#2

Код:
for ( new i=1;i<MAX_CARS;i++)
You're creating maximum cars available from the server.
Reply
#3

Quote:
Originally Posted by SanAndreasMP
Посмотреть сообщение
Код:
for ( new i=1;i<MAX_CARS;i++)
You're creating maximum cars available from the server.
I didn't quite get that. MAX_VEHICLES and MAX_CARS are different. MAX_VEHICLES is a pre defined thing, while MAX_CARS is what I defined, might be MAX_MOVINGTHINGS, if that's what you mean?
Reply
#4

Oh my bad, i got it wrong.
Reply
#5

Anybody else?
Reply
#6

Debug your script by printing VehicleInfo[i][vModel] before spawning the vehicle.

pawn Код:
printf("%d", VehicleInfo[i][vModel]);

//OR

new str[3];
format(str, sizeof str, "%d", VehicleInfo[i][vModel]);
SendClientMessageToAll(-1, str);
Reply
#7

Quote:
Originally Posted by SKAzini
Посмотреть сообщение
Debug your script by printing VehicleInfo[i][vModel] before spawning the vehicle.

pawn Код:
printf("%d", VehicleInfo[i][vModel]);

//OR

new str[3];
format(str, sizeof str, "%d", VehicleInfo[i][vModel]);
SendClientMessageToAll(-1, str);
Well, yea I did. But look, the problem is that MANY Million Vehicles spawn. Why is that so?
This is what happens.
http://i61.tinypic.com/2mwwa4h.png

UPDATE: I checked the log file and found this.
Код:
[09:41:04] 526
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
[09:41:04] 0
Reply
#8

I figured out the problem, after one whole day. I thank those who helped or tried to help here.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)