Command /flip - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Command /flip (
/showthread.php?tid=266734)
Command /flip -
Shadoww5 - 05.07.2011
Anyone know why this code works?
PHP код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/flip", true) == 0)
{
new currentveh;
new Float:angle;
currentveh = GetPlayerVehicleID(playerid);
GetVehicleZAngle(currentveh, angle);
SetVehicleZAngle(currentveh, angle);
SendClientMessage(playerid, 0xFFFFFFFF, "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.
Re: Command /flip -
Lorenc_ - 05.07.2011
Save it to a variable then later on just reset the facing angle of the vehicle
Re: Command /flip -
HayZatic - 05.07.2011
Код:
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;
Re: Command /flip -
Shadoww5 - 06.07.2011
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.
Re: Command /flip -
=WoR=Varth - 06.07.2011
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?
Re: Command /flip -
Shadoww5 - 06.07.2011
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.
Re: Command /flip -
=WoR=Varth - 06.07.2011
Quote:
But in fact the car gets at the correct angle and not the angle angle.
|
What do you mean by correct angle?
Re: Command /flip -
CyNiC - 06.07.2011
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.
Re: Command /flip -
Shadoww5 - 06.07.2011
CyNiC, could you pm me explaining this ?
Re: Command /flip -
Larry123 - 14.08.2011
But how to check if car is "roof down" not on wheels.