Problem with the ZAngle
#1

Hello!

I have a little problem. I did a little command to create some vehicles. When I want to park these with an extra command so the vehicle destroys and creates again to save the positions (so that when the vehicle destroys that it will spawn at the latest position).
But: The ZAngle doesn't update and this vehicle will stand always in the equal direction.

PHP код:
ocmd:apark(playerid,params[])
{
    if(
Player[playerid][pAdmin] < 5)return SendClientMessage(playerid,-1,"{b65e5e}Fehler:{FFFFFF} Du besitzt nicht die Rechte fьr diesen Befehl!");
    if(!
IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,-1,"{b65e5e}Fehler:{FFFFFF} Du bist in keinem Fahrzeug!");
    new 
Float:X,Float:Y,Float:Z,Float:A,string[20],query[200];
    
GetPlayerPos(playerid,X,Y,Z);
    
GetPlayerFacingAngle(playerid,A);
    for(new 
i,j=MAX_POLICE_CARS;i<j;i++)
    {
        if(
PoliceCars[i][polVehID] == GetPlayerVehicleID(playerid))
        {
            
mysql_format(handle,query,sizeof(query),"UPDATE `policecars` SET `parkx`='%f',`parky`='%f',`parkz`='%f',`parka`='%f' WHERE `db_id`='%d'",X,Y,Z,A,PoliceCars[i][polDB_ID]);
            
mysql_tquery(handle,query,"","");
            
SetVehicleZAngle(PoliceCars[i][polVehID],A);
            
DestroyVehicle(PoliceCars[i][polVehID]);
            
PoliceCars[i][polVehID] = CreateVehicle(PoliceCars[i][polModel],X,Y,Z,A,PoliceCars[i][polFarbe1],PoliceCars[i][polFarbe2],-1,0);
            
format(string,sizeof(string),"PD%04d",PoliceCars[i][polVehID]);
            
SetVehicleNumberPlate(PoliceCars[i][polVehID],string);
            
SendClientMessage(playerid,-1,"{30983c}** Du hast das Polizeifahrzeug erfolgreich umgeparkt!");
            
PutPlayerInVehicle(playerid,PoliceCars[i][polVehID],0);
            return 
1;
        }
    }
    return 
1;

That's the park command.

I know that's a samp bug, but how can I fix this?

Best wishes.
Reply
#2

https://sampwiki.blast.hk/wiki/GetVehicleZAngle instead of GetPlayerFacingAngle.
Reply
#3

Thanks!!!

I thought it isn't important which of these functions (GetPlayerPos and GetPlayerFacingAngle or GetVehiclePos and GetVehicleZAngle) I use.

But, it solved my problem. THAAANKS
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)