if(AccInfo[playerid][SpawnedCarID] != INVALID_VEHICLE_ID)
{
DestroyVehicle(AccInfo[playerid][SpawnedCarID]);
AccInfo[playerid][SpawnedCarID] = INVALID_VEHICLE_ID;
}
if(AccInfo[playerid][SpawnedCarID] != INVALID_VEHICLE_ID)
{
DestroyVehicle(AccInfo[playerid][SpawnedCarID]);
AccInfo[playerid][SpawnedCarID] = INVALID_VEHICLE_ID;
}
if(PlayerInfo[playerid][CarID] != -1)
{
if(IsValidVehicle(PlayerInfo[playerid][CarID]))
DestroyVehicle(PlayerInfo[playerid][CarID]);
DestroyDynamic3DTextLabel(PlayerInfo[playerid][textie]);
PlayerInfo[playerid][CarID] = -1;
}
if(AccInfo[playerid][SpawnedCarID] != INVALID_VEHICLE_ID)
{
printf("CMD:CAR = Old spawned car ID = %d BY Payerid = %d",AccInfo[playerid][SpawnedCarID],playerid);
DestroyVehicle(AccInfo[playerid][SpawnedCarID]);
AccInfo[playerid][SpawnedCarID] = INVALID_VEHICLE_ID;
}
LVehicleID = CreateVehicle(car, X,Y,Z, Angle123, colour1, colour2, -1);
AccInfo[playerid][SpawnedCarID] = LVehicleID;
if(AccInfo[playerid][SpawnedCarID] != INVALID_VEHICLE_ID)
{
DestroyVehicle(AccInfo[playerid][SpawnedCarID]);
AccInfo[playerid][SpawnedCarID] = INVALID_VEHICLE_ID;
}
LVehicleIDt = CreateVehicle(560,X,Y,Z,Angle123,1,-1,-1);
AccInfo[playerid][SpawnedCarID] = LVehicleIDt;
//Joining the race:
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
RemovePlayerFromVehicle(playerid);
if(AccInfo[playerid][SpawnedCarID] != INVALID_VEHICLE_ID)
{
DestroyVehicle(AccInfo[playerid][SpawnedCarID]);
AccInfo[playerid][SpawnedCarID] = INVALID_VEHICLE_ID;
}
//////////////
//then this function is called:
forward PutRacerInVehicle(i); //called from the function timer, so the maps can load.
public PutRacerInVehicle(i)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(i, x,y, z);
new car = CreateVehicle(Data[RaceCar], x, y, Data[StartZ]+1,Data[Angle], -1, -1, -1);
SetVehicleVirtualWorld(car, raceworld);
PutPlayerInVehicle(i, car, 0);
AccInfo[i][SpawnedCarID] = car;
return 1;
}
[09:01:42] CMD:CAR = Old spawned car ID = 489 BY Payerid = 11 [09:01:42] CMD:CAR = LvehicleID = 255 [09:01:42] CMD:CAR = new spawned car ID (VAR) = 255 BY Payerid = 11 |
stock SpawnPlayerVehicle(playerid, vehicleid, Float:x,Float:y,Float:z,Float:angle, color1313,color2323, respawn = -1,putinvehicle)
{
#pragma unused respawn
if(IsValidVehicle(AccInfo[playerid][SpawnedCarID]))
{
printf("SpawnPlayerVehicle: Old spawned car ID = %d BY Playerid = %d (Destroyed)",AccInfo[playerid][SpawnedCarID],playerid);
DestroyVehicle(AccInfo[playerid][SpawnedCarID]);
AccInfo[playerid][SpawnedCarID] = -1;
}
AccInfo[playerid][SpawnedCarID] = CreateVehicle(vehicleid, x,y,z, angle, color1313, color2323, 240);
printf("SpawnPlayerVehicle: New spawned car ID = %d BY Playerid = %d (Created)",AccInfo[playerid][SpawnedCarID],playerid);
if(AccInfo[playerid][SpawnedCarID] == 255)
{
print("IT WAS Vehicle ID 255, was sent to hell (World 255)");
SetVehicleVirtualWorld(255, 255);
AccInfo[playerid][SpawnedCarID] = CreateVehicle(vehicleid, x,y,z, angle, color1313, color2323, 240);
printf("SpawnPlayerVehicle: New spawned car ID = %d BY Playerid = %d (Created)",AccInfo[playerid][SpawnedCarID],playerid);
if(!IsPlayerInRace[playerid])
putinvehicle = 0;
}
if(AccInfo[playerid][SpawnedCarID] == 255)
{
print("IT WAS Vehicle ID 255, was sent to hell AGAIN (World 255)\nFATAL ERROR VEHICLE 255 !!!!");
SetVehicleVirtualWorld(255, 255);
return scm(playerid, red, "An Error Occured. Please contact one of the scripters! (Vehicle 255)");
}
SetVehicleVirtualWorld(AccInfo[playerid][SpawnedCarID], GetPlayerVirtualWorld(playerid));
LinkVehicleToInterior(AccInfo[playerid][SpawnedCarID], GetPlayerInterior(playerid));
if(putinvehicle == 1)
{
PutPlayerInVehicle(playerid, AccInfo[playerid][SpawnedCarID], 0);
}
return 1;
}
//here is the paste from my log, first occurrence in the i could find, appears randomly from /carmenu [15:07:36] SpawnPlayerVehicle: Old spawned car ID = 470 BY Playerid = 6 (Destroyed) [15:07:36] SpawnPlayerVehicle: New spawned car ID = 255 BY Playerid = 6 (Created) [15:07:36] IT WAS Vehicle ID 255, was sent to hell (World 255) //I set the Virtual world of the vehicle, and tries to spawn a new one, as a temporary "patch". [15:07:36] SpawnPlayerVehicle: New spawned car ID = 456 BY Playerid = 6 (Created)
#undef CreateVehicle
#undef DestroyVehicle
stock Log_CreateVehicle(vehicletype,Float:x,Float:y,Float:z,Float:rotation,color1,color2,respawn_delay) {
new vehicleid = CreateVehicle(vehicletype,x,y,z,rotation,color1,color2,respawn_delay);
printf("CreateVehicle(%d,%f,%f,%f,%f,%d,%d,%d) = %d",vehicletype,x,y,z,rotation,color1,color2,respawn_delay,vehicleid);
return vehicleid;
}
#define CreateVehicle Log_CreateVehicle
stock Log_DestroyVehicle(vehicleid)
{
if(!IsValidVehicle(vehicleid))
return 0;
else
{
printf("><>><><><<<<<>>< DestroyVehicle(%d) >><<<<>><<><<<<<><>>", vehicleid);
DestroyVehicle(vehicleid);
return 1;
}
}
#define DestroyVehicle Log_DestroyVehicle
[18:47:49] SpawnPlayerVehicle: Old spawned car ID = 458 BY Playerid = 1 (Destroyed) [18:47:49] ><>><><><<<<<>>< DestroyVehicle(458) >><<<<>><<><<<<<><>> [18:47:49] CreateVehicle(444,1807.247070,-1297.331298,132.105606,0.000000,-1,-1,240) = 255 [18:47:49] SpawnPlayerVehicle: New spawned car ID = 255 BY Playerid = 1 (Created) [18:47:49] IT WAS Vehicle ID 255, was sent to hell (World 255) [18:47:49] CreateVehicle(444,1807.247070,-1297.331298,132.105606,0.000000,-1,-1,240) = 458 [18:47:49] SpawnPlayerVehicle: New spawned car ID = 458 BY Playerid = 1 (Created)