SHOW:
|
|
- or go back to the newest paste.
1 | - | //this isn't the exact source code as I don't have it anymore, since I've been slowly updating the code |
1 | + | |
2 | ||
3 | //global variables | |
4 | DWORD timePressed = 0; | |
5 | DWORD amountOfTimePressed = 0; | |
6 | Ped me = NULL; | |
7 | Vehicle veh = NULL; | |
8 | ||
9 | //global functions | |
10 | bool isKeyPressed(int nVirtKey) | |
11 | { | |
12 | //return (GetKeyState(nVirtKey) & 0x8000) != 0; | |
13 | return (GetAsyncKeyState(nVirtKey) & 0x8000) != 0; | |
14 | } | |
15 | ||
16 | //inside main function | |
17 | while (true) | |
18 | { | |
19 | if (isKeyPressed(key)) //check if jump key pressed | |
20 | { | |
21 | if (timePressed == 0) timePressed = GetTickCount(); //set time the key was pressed | |
22 | } | |
23 | else if (timePressed != 0) //check if key was pressed | |
24 | { | |
25 | amountOfTimePressed = GetTickCount() - timePressed; //get the amount of time the key was pressed | |
26 | if (amountOfTimePressed > maxTimeHoldButton) amountOfTimePressed = maxTimeHoldButton; //if above max then set it to the max | |
27 | me = PLAYER::PLAYER_PED_ID(); //get the player ped | |
28 | if (ENTITY::DOES_ENTITY_EXIST(me) && ENTITY::GET_ENTITY_HEALTH(me) > 0 && PED::IS_PED_IN_ANY_VEHICLE(me, 1)) //check if alive, and is in vehicle | |
29 | { | |
30 | veh = PED::GET_VEHICLE_PED_IS_USING(me); //get vehicle | |
31 | if (ENTITY::DOES_ENTITY_EXIST(veh) && VEHICLE::IS_VEHICLE_ON_ALL_WHEELS(veh)) //check if vehicle exists (again) and check if is on all wheels | |
32 | { | |
33 | ENTITY::APPLY_FORCE_TO_ENTITY(veh, 0, 0, 0, amountOfTimePressed * multiplier, 0, 0, 0, 0, 1, 1, 1, 0, 1); //apply force | |
34 | } | |
35 | } | |
36 | ||
37 | timePressed = 0; //reset time pressed | |
38 | } | |
39 | ||
40 | WAIT(0); | |
41 | } |