06.02.2014, 17:51
Guys, I am working on a project for my server and I was wondering if there is a way to rotate non-occupied vehicles in 360 degrees ? Even thought I am going to use an object to rotate the vehicles.
GetVehicleZAngle(currentveh, angle);
SetVehicleZAngle(currentveh, angle);
//OnGameModeInit: SetTimer("RotateVehicle", 1000, 1); // e.g. bottom of your script: forward RotateVehicle(); public RotateVehicle() { new Float:angle; GetVehicleZAngle(vehicleid, angle); SetVehicleZAngle(vehicleid, angle + 5.0); // Turn vehicleid by 5 degrees }
pawn Код:
|
Use a Timer..
Код:
//OnGameModeInit: SetTimer("RotateVehicle", 1000, 1); // e.g. bottom of your script: forward RotateVehicle(); public RotateVehicle() { new Float:angle; GetVehicleZAngle(vehicleid, angle); SetVehicleZAngle(vehicleid, angle + 5.0); // Turn vehicleid by 5 degrees } |
//GetVehiclePos(vehicleid, &Float:X, &Float:Y, &Float:Z);
GetVehiclePos(VehID, X, Y, Z);
//GetVehicleZAngle(vehicleid, &Float:Z); -- May I also note that this function works even with un-occupied vehicles. It's only the "SetVehicleZAngle" that doesn't.
GetVehicleZAngle(VehID, A);
//DestroyVehicle(vehicleid);
DestroyVehicle(VehID);
//CreateVehicle(modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, respawn_delay);
CreateVehicle(model, X, Y, Z, A + 360, 0, 0, 5000);