PDA

View Full Version : Right mouse click FLIP the car


SkyWings
05/04/2012, 12:48 PM
Hello,

What is code of flip the car with right mouse button?

Thanks for help.

Faisal_khan
05/04/2012, 01:50 PM
EDIT:

Untested hope this works for you.

Add this below your defines,
KEY_AIM* (128)
We added this because key is not defined in SA:MP includes. You must define this yourself.


public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (PRESSED(KEY_FIRE))
{
if (IsPlayerInAnyVehicle(playerid))
{
AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
new currentveh;
new Float:angle;
currentveh = GetPlayerVehicleID(playerid);
GetVehicleZAngle(currentveh, angle);
SetVehicleZAngle(currentveh, angle);
SendClientMessage(playerid, 0xFFFFFFFF, "Your vehicle has been flipped.");
}
}
return 1;
}

SkyWings
05/04/2012, 03:17 PM
EDIT:

if (PRESSED(KEY_FIRE))


lol. Didin't working with

if (PRESSED(KEY_AIM*))
{

Faisal_khan
06/04/2012, 07:02 AM
Oh here is the updated one:

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (PRESSED(KEY_AIM))
{
if (IsPlayerInAnyVehicle(playerid))
{
AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
new currentveh;
new Float:angle;
currentveh = GetPlayerVehicleID(playerid);
GetVehicleZAngle(currentveh, angle);
SetVehicleZAngle(currentveh, angle);
SendClientMessage(playerid, 0xFFFFFFFF, "Your vehicle has been flipped.");
}
}
return 1;
}


And remove the * from
KEY_AIM* (128)

SkyWings
06/04/2012, 12:31 PM
Didin't working. :/

Rob_Maate
06/04/2012, 12:35 PM
Currently working on a RolePlay and a TDM server.
Soon gonna publish the TDM.

TIP For scripters: dont make GMs which are very common like stunt, RP, TDm or any other. Make A Unique one.

just sayin

Back on topic:

I'm not sure if KEY_AIM works in a car... Let me test the code and i'll get back to you in a moment

MadeMan
06/04/2012, 12:39 PM
AFAIK the aim key doesn't work in vehicles.

Faisal_khan
06/04/2012, 12:44 PM
Try any of these Keys:
DefineValueGametext-Key on FootGametext-Key in Vehicle
KEY_ACTION1~k~~PED_ANSWER_PHONE~~k~~VEHICLE_FIREWE APON~-
KEY_CROUCH2~k~~PED_DUCK~~k~~VEHICLE_HORN~
KEY_FIRE4~k~~PED_FIREWEAPON~
~k~~PED_FIREWEAPON_ALT~~k~~VEHICLE_FIREWEAPON~
~k~~VEHICLE_FIREWEAPON_ALT~
KEY_SPRINT8~k~~PED_SPRINT~~k~~VEHICLE_ACCELERATE~
KEY_SECONDARY_ATTACK16~k~~VEHICLE_ENTER_EXIT~~k~~V EHICLE_FIREWEAPON_ALT~
KEY_JUMP32~k~~PED_JUMPING~~k~~VEHICLE_BRAKE~
KEY_LOOK_RIGHT64-~k~~VEHICLE_LOOKRIGHT~
KEY_HANDBRAKE128~k~~PED_LOCK_TARGET~~k~~VEHICLE_HA NDBRAKE~
KEY_LOOK_LEFT256-~k~~VEHICLE_LOOKLEFT~
KEY_SUBMISSION512-~k~~TOGGLE_SUBMISSIONS~
KEY_LOOK_BEHIND512~k~~PED_LOOKBEHIND~~k~~VEHICLE_L OOKBEHIND~
KEY_ANALOG_UP2048-~k~~VEHICLE_TURRETUP~
KEY_ANALOG_DOWN4096-~k~~VEHICLE_TURRETDOWN~
KEY_ANALOG_LEFT8192~k~~VEHICLE_LOOKLEFT~~k~~VEHICL E_TURRETLEFT~
KEY_ANALOG_RIGHT16384~k~~VEHICLE_LOOKRIGHT~~k~~VEH ICLE_TURRETRIGHT~
Key not defined in SA:MP includes. You must define this yourself or use KEY_HANDBRAKE.
[**] Support for this key was added in 0.3d. It will not be detectable in earlier versions.

Up/Down-Keys
DefineValueGametext-Key on FootGametext-Key in Vehicle
KEY_UP-128~k~~GO_FORWARD~~k~~VEHICLE_STEERUP~
KEY_DOWN128~k~~GO_BACK~~k~~VEHICLE_STEERDOWN~
Left/Right-Keys
DefineValueGametext-Key on FootGametext-Key in Vehicle
KEY_LEFT-128~k~~GO_LEFT~~k~~VEHICLE_STEERLEFT~
KEY_RIGHT128~k~~GO_RIGHT~~k~~VEHICLE_STEERRIGHT~


Link for that:

GetPlayerKeys (http://wiki.sa-mp.com/wiki/GetPlayerKeys)