Command /flip
#1

Anyone know why this code works?

PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
    if(
strcmp(cmdtext"/flip"true) == 0)
    {
        new 
currentveh;
        new 
Float:angle;
        
currentveh GetPlayerVehicleID(playerid);
        
GetVehicleZAngle(currentvehangle);
        
SetVehicleZAngle(currentvehangle);
        
SendClientMessage(playerid0xFFFFFFFF"Your vehicle has been flipped.");
        return 
1;
    }
     return 
0;

Because, from what I understood, the vehicle should be in the same angle, but this is not what happens.
Reply
#2

Save it to a variable then later on just reset the facing angle of the vehicle
Reply
#3

Код:
if (strcmp(cmdtext, "/flip", true) == 0) {
	new VehicleID, Float:X, Float:Y, Float:Z;
   	GetPlayerPos(playerid, X, Y, Z);
   	VehicleID = GetPlayerVehicleID(playerid);
    SetVehiclePos(VehicleID, X, Y, Z);
    SetVehicleZAngle(VehicleID, 0);
    SendClientMessage(playerid, COLOR_GREY,"Vehicle Fliped!");
	return 1;
Reply
#4

Quote:
Originally Posted by Lorenc_
Посмотреть сообщение
Save it to a variable then later on just reset the facing angle of the vehicle
What ? I just want to know how this code works.
Reply
#5

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/flip", true) == 0)
    {
        new currentveh;//Create a new variable
        new Float:angle;//Create a new variable
        currentveh = GetPlayerVehicleID(playerid);//Insert into variable
        GetVehicleZAngle(currentveh, angle);//Get the vehicleZAngle of currentveh with value angle
        SetVehicleZAngle(currentveh, angle);//Set the vehicleZAngle of currentveh with value angle
        SendClientMessage(playerid, 0xFFFFFFFF, "Your vehicle has been flipped.");//Send a client massage to the command user
        return 1;
    }
     return 0;
}
Like that?
Reply
#6

More or less ...

Example: My vehicle's ZAngle is 42.4, so it will stored in the variable angle ( GetVehicleZAngle(currentveh, angle); ), so when I set it again for 42.4 ( SetVehicleZAngle(currentveh, angle); ) the car would be at the same angle. Right ?

But in fact the car gets at the correct angle and not the angle angle.
Reply
#7

Quote:

But in fact the car gets at the correct angle and not the angle angle.

What do you mean by correct angle?
Reply
#8

The z angle don't is the vehicle flip angle, is the vehicle rotation, when you use the function "SetVehicleZAngle", the car is fliped to right position.
Reply
#9

CyNiC, could you pm me explaining this ?
Reply
#10

But how to check if car is "roof down" not on wheels.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)