20.02.2015, 22:46
Hello Community, i wanted to finish my Vehiclesystem but it seems like the Rotations arent getting set correctly.
Well, they get loaded correctly (using CreateVehicle) but if they explode or anything and onVehicleSpawn is called, the ZAngle is getting set wrongly (even when the coords are correct)
I already thinked off destroying the Cars and recreating them when they explode but maybe it works with SetVehicleZAngle aswell.
Maybe someone of you guys can find an error:
OnVehicleSpawn:
/fpark (to park the vehicles)
Can anyone of you see the error / mistake ? Inside the FactionCarInfo its defind as an Float value
// EDIT: The Debug gives me the following:
[00:14:55] OnVehicleSpawn: Saved: 223.67 - Current: 326.55
Regards:
Tigerkiller
Well, they get loaded correctly (using CreateVehicle) but if they explode or anything and onVehicleSpawn is called, the ZAngle is getting set wrongly (even when the coords are correct)
I already thinked off destroying the Cars and recreating them when they explode but maybe it works with SetVehicleZAngle aswell.
Maybe someone of you guys can find an error:
OnVehicleSpawn:
pawn Код:
for(new i; i < MAX_TOTALFACTIONCARS; ++i)
{
if(FactionCarInfo[i][fDBID] == 0 || FactionCarInfo[i][fElement] != vehicleid)
continue;
new Float:zAngle;
SetVehicleZAngle(vehicleid, FactionCarInfo[i][fSpawnA]);
SetVehiclePos(vehicleid, FactionCarInfo[i][fSpawnX], FactionCarInfo[i][fSpawnY], FactionCarInfo[i][fSpawnZ]);
GetVehicleZAngle(vehicleid, zAngle);
printf("OnVehicleSpawn: Saved: %.02f - Current: %.02f", FactionCarInfo[i][fSpawnA], zAngle);
TuneFactionVehicle(i);
break;
}
pawn Код:
ocmd:fpark(playerid)
{
new leader = PlayerInfo[playerid][pLeader],
member = PlayerInfo[playerid][pMember],
rank = PlayerInfo[playerid][pRank],
vID = GetPlayerVehicleID(playerid);
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && ((leader >= 1 || member >= 1) && rank >= 11) || PlayerInfo[playerid][pAdmin] >= 2000)
{
for(new i; i < MAX_TOTALFACTIONCARS; ++i)
{
if(FactionCarInfo[i][fDBID] == 0 || FactionCarInfo[i][fElement] != vID)
continue;
if(FactionCarInfo[i][fFaction] == member || FactionCarInfo[i][fFaction] == leader || PlayerInfo[playerid][pAdmin] >= 2000)
{
GetVehiclePos(vID, FactionCarInfo[i][fSpawnX], FactionCarInfo[i][fSpawnY], FactionCarInfo[i][fSpawnZ]);
GetVehicleZAngle(vID, FactionCarInfo[i][fSpawnA]);
SetVehicleZAngle(vID, FactionCarInfo[i][fSpawnA]);
FactionCarInfo[i][fChanged] = true;
SendClientMessage(playerid, COLOR_YELLOW, "Du hast das Fraktionsfahrzeug erfolgreich geparkt! (Es spawnt in 5 Sekunden hier!)");
} else
SendClientMessage(playerid, COLOR_GRAD1, "Du kannst dieses Fraktionsfahrzeug nicht parken!");
break;
}
}
return 1;
}
// EDIT: The Debug gives me the following:
[00:14:55] OnVehicleSpawn: Saved: 223.67 - Current: 326.55
Regards:
Tigerkiller