SetVehicleZAngle
#1

When you try to change the rotation of the machine, nothing happens.

Code:
PHP код:
// Create vehicle:
new vehicleid CreateVehicle(4110.00.00.00.0, -1, -1, -1);
// Edit Vehicle Angle:
SetVehicleZAngle(vehicleid65.0000);
// Get Vehicle Angle:
new Float:z_angl;
GetVehicleZAngle(vehicleidz_angl);
printf("debug: %f"z_angl); 
Logs:
PHP код:
debug0.000000 
Reply
#2

Also faced with this problem.
Do something.
Reply
#3

Yeah, I aggree.
Please, fix it.
Reply
#4

You can just do this to set it's angle:
Quote:

new vehicleid = CreateVehicle(411, 0.0, 0.0, 0.0, 65.000, -1, -1, -1);

And I don't seem to get the point of why you would want to change the angle anyways, if you want to change the vehicle's angle where the player is sitting in, it's just as easy as this:
Quote:

SetVehicleZAngle(GetPlayerVehicleID(playerid), 65.000);

Reply
#5

Have similar problem that when a vehicle spawns, NOONE entered it and you try to get an angle, I get 0.0000 angle. But when someone is in vehicle, the gotten angle seems to be ok.
Reply
#6

Jimmy0wns, your method is not suitable.
Reply
#7

it not SA-MP bug, it bug of game GTA - SA opcode 0x0175
Reply
#8

Quote:
Originally Posted by [Saint]
Посмотреть сообщение
it not SA-MP bug, it bug of game GTA - SA opcode 0x0175
I think it's still a bug samp. The problem is particularly visible on the server side.
Reply
#9

Quote:
Originally Posted by Kolstin
Посмотреть сообщение
I think it's still a bug samp. The problem is particularly visible on the server side.
i know 100% it bug GTA SA, not SA-MP
Reply
#10

Quote:
Originally Posted by [Saint]
Посмотреть сообщение
i know 100% it bug GTA SA, not SA-MP
All the same it is necessary fixes ...
Reply
#11

Actually this is a SA-MP bug. Vehicle is not streamed for any player so there is no one who can 'broadcast' the update. Run that code again with a player close to the vehicle (not paused) and you'll see that Z-Angle changes.
Reply
#12

Quote:
Originally Posted by Spmn
Посмотреть сообщение
Actually this is a SA-MP bug. Vehicle is not streamed for any player so there is no one who can 'broadcast' the update. Run that code again with a player close to the vehicle (not paused) and you'll see that Z-Angle changes.
I agree that this is a problem SA-MP.
Reply
#13

There is a fix for that. There must be a delay between spawning and setting rotation.
PHP код:
SetTimerEx("VehRot",200,false,"df",vehicleid,65.0);
forward VehRot(veh,Float:angle);
public 
VehRot(veh,Float:angle){
      return 
SetVehicleZAngle(vehicleidangle); 

Reply
#14

CodeStyle175, this does not work! Evidence: http://forum.sa-mp.com/showpost.php?...ostcount=13487
Reply
#15

This function works, but when vehicle spawns there must be a delay.
Reply
#16

Delay would work only in some circumstances, but most of the time it wouldn't. (eg: when vehicle is not streamed for any player).

There are two possible fixes:
1. when you set angle of vehicle, check if it is streamed for any player (not paused). If it isn't then recreate it with the new angle. (also recreate the vehicle at OnVehicleSpawn);
2. check again if there is any player who has vehicle streamed in. If there isn't, assign new angle to a variable and when OnVehicleStreamIn is called for that vehicleid, set the new angle. This should work theoretically, but it is not reliable. I used this semi-fix on my server but there still were players reporting that vehicles' angle is set wrong. However I think using a delay here (at OnVehicleStreamIn) would work but I didn't test this.

Maybe YSF could fix this issue.
Reply
#17

Quote:
Originally Posted by CodeStyle175
Посмотреть сообщение
This function works, but when vehicle spawns there must be a delay.
This works only if the player is next. Unfortunately, your method is not the solution.
Reply
#18

Maybe it helps if you spawn bot put him in vehicle and then kick him. Then vehicle synces for playerid.
Reply
#19

Quote:
Originally Posted by CodeStyle175
Посмотреть сообщение
Maybe it helps if you spawn bot but him in vehicle and then kick him. Then vehicle synces for playerid.
Why do we have to use these crutches with bots? We need to get a normal fixed.
Reply
#20

I don't understand your request..

Here's the scenarios;

* You create the vehicle without an angle Angle of rotation IS KNOWN - 0.0
* You set the angle ANGLE IS KNOWN - 65.0
* Nobody streamed the vehicle - vehicle MUST have the same angle Angle of rotation IS KNOWN- 65.0
* Someone moves the vehicle - Angle of rotation IS KNOWN - retreive with function

In none of these states is the angle of rotation unknown. You either retreive the data - and if the server requires someone to stream the vehicle to provide you the angle of rotation, it cannot change from e.g. 65.0 unless someone goes close enough to change it...

This is not a problem - at all. Unless you have ghosts..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)