SHOW:
|
|
- or go back to the newest paste.
1 | #pragma semicolon 1 | |
2 | ||
3 | #include <sourcemod> | |
4 | #include <sdktools> | |
5 | #include <cstrike> | |
6 | #include <sdkhooks> | |
7 | ||
8 | #define LoopIngameClients(%1) for(int %1=1;%1<=MaxClients;++%1)\ | |
9 | if(IsClientInGame(%1)) | |
10 | ||
11 | #define BOOSTER_MIN_SPEED 5.0 | |
12 | #define BOOSTED_MAX_SPEED -5.0 | |
13 | #define BOOST_SPEED 600.0 | |
14 | ||
15 | #define HEIGHT_DIFF 61.0 | |
16 | #define HEIGHT_DIFF_DUCKED 45.0 | |
17 | ||
18 | public Plugin myinfo = | |
19 | { | |
20 | name = "Skyboost", | |
21 | author = "Zipcore", | |
22 | description = "Skyboost for trikz", | |
23 | version = "1.0", | |
24 | url = "zipcore#googlemail.com" | |
25 | }; | |
26 | ||
27 | public void OnPluginStart() | |
28 | { | |
29 | LoopIngameClients(i) | |
30 | OnClientPutInServer(i); | |
31 | } | |
32 | ||
33 | public OnClientPutInServer(int client) | |
34 | { | |
35 | SDKHook(client, SDKHook_StartTouch, OnStartTouch); | |
36 | } | |
37 | ||
38 | public Action OnStartTouch(int client, int other) | |
39 | { | |
40 | // client = upper player | |
41 | // other = boosting player | |
42 | ||
43 | //Player touched another player | |
44 | if(other > 0 && other <= MaxClients) | |
45 | { | |
46 | // Are players alive? | |
47 | if(!IsClientInGame(client) || !IsPlayerAlive(client)) | |
48 | return Plugin_Continue; | |
49 | ||
50 | if(!IsClientInGame(other) || !IsPlayerAlive(other)) | |
51 | return Plugin_Continue; | |
52 | ||
53 | float cPos[3]; | |
54 | GetClientAbsOrigin(client, cPos); | |
55 | ||
56 | float oPos[3]; | |
57 | GetClientAbsOrigin(other, oPos); | |
58 | ||
59 | // Check Height Diff | |
60 | float HeightDiff = cPos[2] - oPos[2]; | |
61 | ||
62 | //Diff smaller as possible with duck | |
63 | if (HeightDiff <= 45.0) | |
64 | return Plugin_Continue; | |
65 | ||
66 | // Diff smaler as possible without duck | |
67 | if (HeightDiff <= 61.0 && !(GetClientButtons(other) & IN_DUCK)) | |
68 | return Plugin_Continue; | |
69 | ||
70 | float cVel[3]; | |
71 | GetEntPropVector(client, Prop_Data, "m_vecAbsVelocity", cVel); | |
72 | ||
73 | float oVel[3]; | |
74 | GetEntPropVector(other, Prop_Data, "m_vecAbsVelocity", oVel); | |
75 | ||
76 | // Is player falling fast enought? | |
77 | if(cVel[2] > BOOSTED_MAX_SPEED) | |
78 | return Plugin_Continue; | |
79 | ||
80 | // Is player jumping fast enought? | |
81 | if (oVel[2] < BOOSTER_MIN_SPEED) | |
82 | return Plugin_Continue; | |
83 | ||
84 | // Boost player | |
85 | cVel[2] = BOOST_SPEED; | |
86 | TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, cVel); | |
87 | } | |
88 | ||
89 | return Plugin_Continue; | |
90 | } |