Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma semicolon 1
- #include <sourcemod>
- #include <sdktools>
- #include <cstrike>
- #include <sdkhooks>
- #define LoopIngameClients(%1) for(int %1=1;%1<=MaxClients;++%1)\
- if(IsClientInGame(%1))
- #define BOOSTER_MIN_SPEED 5.0
- #define BOOSTED_MAX_SPEED -5.0
- #define BOOST_SPEED 600.0
- #define HEIGHT_DIFF 61.0
- #define HEIGHT_DIFF_DUCKED 45.0
- public Plugin myinfo =
- {
- name = "Skyboost",
- author = "Zipcore",
- description = "Skyboost for trikz",
- version = "1.0",
- url = "zipcore#googlemail.com"
- };
- public void OnPluginStart()
- {
- LoopIngameClients(i)
- OnClientPutInServer(i);
- }
- public OnClientPutInServer(int client)
- {
- SDKHook(client, SDKHook_StartTouch, OnStartTouch);
- }
- public Action OnStartTouch(int client, int other)
- {
- // client = upper player
- // other = boosting player
- //Player touched another player
- if(other > 0 && other <= MaxClients)
- {
- // Are players alive?
- if(!IsClientInGame(client) || !IsPlayerAlive(client))
- return Plugin_Continue;
- if(!IsClientInGame(other) || !IsPlayerAlive(other))
- return Plugin_Continue;
- float cPos[3];
- GetClientAbsOrigin(client, cPos);
- float oPos[3];
- GetClientAbsOrigin(other, oPos);
- // Check Height Diff
- float HeightDiff = cPos[2] - oPos[2];
- //Diff smaller as possible with duck
- if (HeightDiff <= 45.0)
- return Plugin_Continue;
- // Diff smaler as possible without duck
- if (HeightDiff <= 61.0 && !(GetClientButtons(other) & IN_DUCK))
- return Plugin_Continue;
- float cVel[3];
- GetEntPropVector(client, Prop_Data, "m_vecAbsVelocity", cVel);
- float oVel[3];
- GetEntPropVector(other, Prop_Data, "m_vecAbsVelocity", oVel);
- // Is player falling fast enought?
- if(cVel[2] > BOOSTED_MAX_SPEED)
- return Plugin_Continue;
- // Is player jumping fast enought?
- if (oVel[2] < BOOSTER_MIN_SPEED)
- return Plugin_Continue;
- // Boost player
- cVel[2] = BOOST_SPEED;
- TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, cVel);
- }
- return Plugin_Continue;
- }
Add Comment
Please, Sign In to add comment