SetVehicleZAngle Issue
#1

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:
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;
        }
/fpark (to park the vehicles)
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;
}
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
Reply
#2

I dont know the exact solution as well the cause for this but try setting vehicle pos first and then the zangle in OnVehicleSpawn Callback.
Reply
#3

Well, first of all: Thanks for your response.
I had already tryed it but it seems like it doesnt works too.


Regards: Tigerkiller
Reply
#4

It's a samp bug which is pretty annoying, it's easy to fix though.

if you want the vehicle to have the correct angle upon respawn or upon the spawning position, you will have to put a player inside the vehicle, set the rotation, then remove the player from the vehicle.

That worked for me, it's a sortof workaround, it's annoying but I believe it's fixed in 0.3.7
Reply
#5

Okay, thanks you for your response. I better said for it to get fixxed
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)