Vehicle System Error -
DOL4N - 16.05.2015
Hey guys.
I'm working on a gamemode, which (would) include a vehicle buying/saving/loading system. I made every single stock which it requires. Saving path, free slot, saving vehicle, loading vehicle, creating vehicle.
Compiled it several times, no errors or warnings.
Код:
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
But when i write
LoadAllVehicles(); under OnGameModeInit and
SaveAllVehicles(); under OnGameModeExit,
it suddenly starts to show some errors which have nothing to do with the stocks or OnGameModeInit & -Exit. But when i remove the above lines, it shows no error.
.inc folder is up to date, every include which I need is on the top of the script.
Errors:
When LoadAllVehicles(); is under OnGameModeInit:
gamemodes\roleplay.pwn(337 -- 338) : error 047: array sizes do not match, or destination array is too small
Код:
Line 337: CreateVehicleEx(VehicleInfo[vehicleID][vmodel],VehicleInfo[vehicleID][xspawn],VehicleInfo[vehicleID][yspawn],VehicleInfo[vehicleID][zspawn],
Код:
Line 338: VehicleInfo[vehicleID][anglespawn],VehicleInfo[vehicleID][col1],VehicleInfo[vehicleID][col2],VehicleInfo[vehicleID][respawn],VehicleInfo[vehicleID][owner]);
When SaveAllVehicles(); is under OnGameModeExit:
gamemodes\roleplay.pwn(305) : error 017: undefined symbol "Open"
gamemodes\roleplay.pwn(305) : warning 213: tag mismatch
Код:
Line 305: new INI:dFile = Open(VehiclePath(vehicleID));
Please help me, I'm trying to solve this problem for 2 days..
Re: Vehicle System Error -
willsuckformoney - 16.05.2015
Show your enum for VehicleInfo?
Re: Vehicle System Error -
Konstantinos - 16.05.2015
I assume the problem is with CreateVehicleEx and specifically the last parameter.
Do you use y_ini? If so, INI_Open.
Re: Vehicle System Error -
DOL4N - 16.05.2015
Here it is:
Код:
enum vInfo
{
vmodel,
Float:xspawn,
Float:yspawn,
Float:zspawn,
Float:anglespawn,
col1,
col2,
respawn,
owner[MAX_PLAYER_NAME]
}
Re: Vehicle System Error -
Konstantinos - 16.05.2015
Can you post the parameters of CreateVehicleEx function? For example using
v_owner[MAX_PLAYER_NAME] as a parameter would give the error but without a size at all, it wouldn't.
Re: Vehicle System Error -
DOL4N - 16.05.2015
Код:
stock CreateVehicleEx(modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, respawntime, ownername[MAX_PLAYER_NAME]) <--- Konstantinos: [MAX_PLAYER_NAME] should not be there?
{
new carid = GetVehicleFreeSlot();
VehicleInfo[carid][vmodel] = modelid;
VehicleInfo[carid][xspawn] = x;
VehicleInfo[carid][yspawn] = y;
VehicleInfo[carid][zspawn] = z;
VehicleInfo[carid][anglespawn] = angle;
VehicleInfo[carid][col1] = color1;
VehicleInfo[carid][col2] = color2;
VehicleInfo[carid][respawn] = respawntime;
format(VehicleInfo[carid][owner], MAX_PLAYER_NAME, ownername);
validcar[carid] = true;
CreateVehicle(modelid, x, y, z, angle, color1, color2, respawntime);
return carid;
}
Re: Vehicle System Error -
Konstantinos - 16.05.2015
The size shouldn't be there. Replace it with
ownername[]
Re: Vehicle System Error -
DOL4N - 16.05.2015
It seems to be working. Thank you! +REP