Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma semicolon 1
- // ===================
- // >>> DEFINE
- // ===================
- #define PLUGIN_AUTHOR "Bioly"
- #define PLUGIN_VERSION "0.1"
- #define LoopValidClients(%1) for(int %1 = 1; %1 < MaxClients; %1++) if(IsValidClient(%1))
- // ===================
- // >>> CFG
- // ===================
- #define PREFIX "[{lightred}Sklep{default}]"
- #define ITEMCOST_GLOCK 5
- #define ITEMCOST_USP 5
- #define ITEMCOST_PARACHUTE 5
- #define ITEMCOST_DEAGLE 5
- #define ITEMCOST_AK47 5
- #define ITEMCOST_AWP 5
- #define ITEMCOST_KNIFE 5
- #define ITEMCOST_REAMMO 5
- #define ITEMCOST_UAMMO 5
- #define ITEMCOST_FLASHLIGHT 5
- #define ITEMCOST_MHEALTH 5
- #define ITEMCOST_HEALTHS 5
- #define ITEMCOST_HE 5
- #define ITEMCOST_MOLO 5
- #define ITEMCOST_SPEED 5
- #define ITEMCOST_DJ 5
- #define ITEMCOST_JETPACK 5
- #define DEFINE_FUEL 1.0
- #define DEFINE_REGEN 0.1 // Ilosc regenerowanego paliwa przez 1 sekunde
- // ====================
- // >>> INCLUDE
- // ====================
- #include <sourcemod>
- #include <sdktools>
- #include <cstrike>
- #include <sdkhooks>
- #include <errors>
- #include <colors>
- #include <gum>
- #include <smlib>
- // ====================
- // >>> ZMIENNE
- // ====================
- bool g_bGlock[MAXPLAYERS];
- bool g_bUSP[MAXPLAYERS];
- bool g_bParachute[MAXPLAYERS];
- bool g_bParachuteInUse[MAXPLAYERS];
- bool g_bDeagle[MAXPLAYERS];
- bool g_bAK47[MAXPLAYERS];
- bool g_bAWP[MAXPLAYERS];
- bool g_bKnife[MAXPLAYERS];
- bool g_bKnifeCD[MAXPLAYERS];
- bool g_bUAmmo[MAXPLAYERS];
- bool g_bFlashLight[MAXPLAYERS];
- bool g_bDJ[MAXPLAYERS];
- bool g_bJetPack[MAXPLAYERS];
- float g_fFuel[MAXPLAYERS];
- float g_fTime[MAXPLAYERS];
- int g_iVelocity = -1;
- #pragma newdecls required
- EngineVersion g_Game;
- // ===========================
- // >>> PLUGIN INFO
- // ===========================
- public Plugin myinfo =
- {
- name = "[Bioly] Gun EXP Shop",
- author = PLUGIN_AUTHOR,
- description = "N/A",
- version = PLUGIN_VERSION,
- url = "id/ToTenBioly"
- };
- // ====================
- // >>> OnPluginStart
- // ====================
- public void OnPluginStart()
- {
- Errors.SetPluginName("[Bioly] Gun EXP Shop");
- g_Game = GetEngineVersion();
- if (g_Game != Engine_CSGO && g_Game != Engine_CSS)
- {
- Errors.ThrowCriticalError(0, "Ten plugin jest tylko do CSGO/CSS.");
- }
- HookEvent("player_spawn", playerSpawn);
- HookEvent("weapon_fire", weaponFire, EventHookMode_Pre);
- RegConsoleCmd("sm_sklep", ShopCommand);
- AddCommandListener(FlashLight, "+lookatweapon");
- g_iVelocity = FindSendPropInfo("CBasePlayer", "m_vecVelocity[0]");
- if (g_iVelocity == -1)
- {
- SetFailState("Can not find m_vecVelocity[0] offset");
- }
- }
- public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
- {
- MarkNativeAsOptional("setPlayerUnlocks");
- MarkNativeAsOptional("getPlayerUnlocks");
- return APLRes_Success;
- }
- public void playerSpawn(Event event, char[] name, bool dontBroadcast)
- {
- int client = GetClientOfUserId(event.GetInt("userid"));
- g_bUAmmo[client] = false;
- g_bDJ[client] = false;
- g_bJetPack[client] = false;
- }
- public Action weaponFire(Event event, char[] name, bool dontBroadcast)
- {
- int client = GetClientOfUserId(event.GetInt("userid"));
- if (IsPlayerAlive(client))
- {
- if (g_bUAmmo[client])
- {
- int iWeaponIndex = GetEntPropEnt(client, Prop_Data, "m_hActiveWeapon");
- if (IsValidEdict(iWeaponIndex))
- {
- SetEntProp(iWeaponIndex, Prop_Data, "m_iClip1", GetEntProp(iWeaponIndex, Prop_Data, "m_iClip1") + 1);
- }
- }
- }
- }
- public void OnClientPutInServer(int client)
- {
- SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
- ResetAllVariables(client);
- }
- public void OnClientDisconnect(int client)
- {
- SDKUnhook(client, SDKHook_OnTakeDamage, OnTakeDamage);
- ResetAllVariables(client);
- }
- public Action ShopCommand(int client, int args)
- {
- char sBuffer[128];
- Menu SHOPMenu = new Menu(SHOPMenuCallback);
- SHOPMenu.SetTitle("Sklep :: Kup\n \n");
- Format(sBuffer, sizeof(sBuffer), "Większe obrażenia z Glocka [%i EXPa]", ITEMCOST_GLOCK);
- SHOPMenu.AddItem("glock", sBuffer, g_bGlock[client] ? ITEMDRAW_DISABLED:ITEMDRAW_DEFAULT);
- Format(sBuffer, sizeof(sBuffer), "Większe obrażenia z USP-S [%i EXPa]", ITEMCOST_USP);
- SHOPMenu.AddItem("usp", sBuffer, g_bUSP[client] ? ITEMDRAW_DISABLED:ITEMDRAW_DEFAULT);
- Format(sBuffer, sizeof(sBuffer), "Spadochron [%i EXPa]", ITEMCOST_PARACHUTE);
- SHOPMenu.AddItem("parachute", sBuffer, g_bParachute[client] ? ITEMDRAW_DISABLED:ITEMDRAW_DEFAULT);
- Format(sBuffer, sizeof(sBuffer), "Większe obrażenia z Deagla [%i EXPa]", ITEMCOST_DEAGLE);
- SHOPMenu.AddItem("deagle", sBuffer, g_bDeagle[client] ? ITEMDRAW_DISABLED:ITEMDRAW_DEFAULT);
- Format(sBuffer, sizeof(sBuffer), "Większe obrażenia z AK-47 [%i EXPa]", ITEMCOST_AK47);
- SHOPMenu.AddItem("ak47", sBuffer, g_bAK47[client] ? ITEMDRAW_DISABLED:ITEMDRAW_DEFAULT);
- Format(sBuffer, sizeof(sBuffer), "Większe obrażenia z AWP [%i EXPa]", ITEMCOST_AWP);
- SHOPMenu.AddItem("awp", sBuffer, g_bAWP[client] ? ITEMDRAW_DISABLED:ITEMDRAW_DEFAULT);
- Format(sBuffer, sizeof(sBuffer), "Odpychający nóż [%i EXPa]", ITEMCOST_KNIFE);
- SHOPMenu.AddItem("knife", sBuffer, g_bKnife[client] ? ITEMDRAW_DISABLED:ITEMDRAW_DEFAULT);
- Format(sBuffer, sizeof(sBuffer), "Odnów amunicje [%i EXPa]", ITEMCOST_REAMMO);
- SHOPMenu.AddItem("reammo", sBuffer, IsPlayerAlive(client) ? ITEMDRAW_DEFAULT:ITEMDRAW_DISABLED);
- Format(sBuffer, sizeof(sBuffer), "Nieskończona amunicja [%i EXPa]", ITEMCOST_UAMMO);
- SHOPMenu.AddItem("uammo", sBuffer, g_bUAmmo[client] ? ITEMDRAW_DISABLED:ITEMDRAW_DEFAULT);
- Format(sBuffer, sizeof(sBuffer), "Latarka [%i EXPa]", ITEMCOST_FLASHLIGHT);
- SHOPMenu.AddItem("flashlight", sBuffer, g_bFlashLight[client] ? ITEMDRAW_DISABLED:ITEMDRAW_DEFAULT);
- Format(sBuffer, sizeof(sBuffer), "Strzykawka [%i EXPa]", ITEMCOST_HEALTHS);
- SHOPMenu.AddItem("healths", sBuffer, IsPlayerAlive(client) ? ITEMDRAW_DEFAULT:ITEMDRAW_DISABLED);
- Format(sBuffer, sizeof(sBuffer), "+50 HP [%i EXPa]", ITEMCOST_MHEALTH);
- SHOPMenu.AddItem("mhealth", sBuffer, IsPlayerAlive(client) ? ITEMDRAW_DEFAULT:ITEMDRAW_DISABLED);
- Format(sBuffer, sizeof(sBuffer), "Granat odłamkowy [%i EXPa]", ITEMCOST_HE);
- SHOPMenu.AddItem("he", sBuffer, IsPlayerAlive(client) ? ITEMDRAW_DEFAULT:ITEMDRAW_DISABLED);
- Format(sBuffer, sizeof(sBuffer), "Molotov [%i EXPa]", ITEMCOST_MOLO);
- SHOPMenu.AddItem("molo", sBuffer, IsPlayerAlive(client) ? ITEMDRAW_DEFAULT:ITEMDRAW_DISABLED);
- Format(sBuffer, sizeof(sBuffer), "RedBull [%i EXPa]", ITEMCOST_SPEED);
- SHOPMenu.AddItem("speed", sBuffer, IsPlayerAlive(client) ? ITEMDRAW_DEFAULT:ITEMDRAW_DISABLED);
- Format(sBuffer, sizeof(sBuffer), "Double Jump [%i EXPa]", ITEMCOST_DJ);
- SHOPMenu.AddItem("dj", sBuffer, IsPlayerAlive(client) && g_bDJ[client] == false ? ITEMDRAW_DEFAULT:ITEMDRAW_DISABLED);
- Format(sBuffer, sizeof(sBuffer), "JetPack [%i EXPa]", ITEMCOST_JETPACK);
- SHOPMenu.AddItem("jetpack", sBuffer, IsPlayerAlive(client) && g_bJetPack[client] == false ? ITEMDRAW_DEFAULT:ITEMDRAW_DISABLED);
- SHOPMenu.Display(client, 0);
- return Plugin_Handled;
- }
- public int SHOPMenuCallback(Menu SHOPMenu, MenuAction action, int param1, int param2)
- {
- switch (action)
- {
- case MenuAction_Select:
- {
- char sItem[64];
- SHOPMenu.GetItem(param2, sItem, sizeof(sItem));
- if (StrEqual(sItem, "glock"))
- {
- if (getPlayerUnlocks(param1) < ITEMCOST_GLOCK)
- {
- CPrintToChat(param1, "%s Nie posiadasz wystarczająco dużo EXPa!", PREFIX);
- return;
- }
- CPrintToChat(param1, "%s Poprawnie zakupiłeś ulepszenie.", PREFIX);
- g_bGlock[param1] = true;
- setPlayerUnlocks(param1, getPlayerUnlocks(param1) - ITEMCOST_GLOCK);
- }
- else if (StrEqual(sItem, "usp"))
- {
- if (getPlayerUnlocks(param1) < ITEMCOST_USP)
- {
- CPrintToChat(param1, "%s Nie posiadasz wystarczająco dużo EXPa!", PREFIX);
- return;
- }
- CPrintToChat(param1, "%s Poprawnie zakupiłeś ulepszenie.", PREFIX);
- g_bUSP[param1] = true;
- setPlayerUnlocks(param1, getPlayerUnlocks(param1) - ITEMCOST_USP);
- }
- else if (StrEqual(sItem, "parachute"))
- {
- if (getPlayerUnlocks(param1) < ITEMCOST_PARACHUTE)
- {
- CPrintToChat(param1, "%s Nie posiadasz wystarczająco dużo EXPa!", PREFIX);
- return;
- }
- CPrintToChat(param1, "%s Poprawnie zakupiłeś ulepszenie.", PREFIX);
- g_bParachute[param1] = true;
- setPlayerUnlocks(param1, getPlayerUnlocks(param1) - ITEMCOST_PARACHUTE);
- }
- else if (StrEqual(sItem, "deagle"))
- {
- if (getPlayerUnlocks(param1) < ITEMCOST_DEAGLE)
- {
- CPrintToChat(param1, "%s Nie posiadasz wystarczająco dużo EXPa!", PREFIX);
- return;
- }
- CPrintToChat(param1, "%s Poprawnie zakupiłeś ulepszenie.", PREFIX);
- g_bDeagle[param1] = true;
- setPlayerUnlocks(param1, getPlayerUnlocks(param1) - ITEMCOST_DEAGLE);
- }
- else if (StrEqual(sItem, "ak47"))
- {
- if (getPlayerUnlocks(param1) < ITEMCOST_AK47)
- {
- CPrintToChat(param1, "%s Nie posiadasz wystarczająco dużo EXPa!", PREFIX);
- return;
- }
- CPrintToChat(param1, "%s Poprawnie zakupiłeś ulepszenie.", PREFIX);
- g_bAK47[param1] = true;
- setPlayerUnlocks(param1, getPlayerUnlocks(param1) - ITEMCOST_AK47);
- }
- else if (StrEqual(sItem, "awp"))
- {
- if (getPlayerUnlocks(param1) < ITEMCOST_AWP)
- {
- CPrintToChat(param1, "%s Nie posiadasz wystarczająco dużo EXPa!", PREFIX);
- return;
- }
- CPrintToChat(param1, "%s Poprawnie zakupiłeś ulepszenie.", PREFIX);
- g_bAWP[param1] = true;
- setPlayerUnlocks(param1, getPlayerUnlocks(param1) - ITEMCOST_AWP);
- }
- else if (StrEqual(sItem, "knife"))
- {
- if (getPlayerUnlocks(param1) < ITEMCOST_KNIFE)
- {
- CPrintToChat(param1, "%s Nie posiadasz wystarczająco dużo EXPa!", PREFIX);
- return;
- }
- CPrintToChat(param1, "%s Poprawnie zakupiłeś ulepszenie.", PREFIX);
- g_bKnife[param1] = true;
- setPlayerUnlocks(param1, getPlayerUnlocks(param1) - ITEMCOST_KNIFE);
- }
- else if (StrEqual(sItem, "reammo"))
- {
- if (getPlayerUnlocks(param1) < ITEMCOST_REAMMO)
- {
- CPrintToChat(param1, "%s Nie posiadasz wystarczająco dużo EXPa!", PREFIX);
- return;
- }
- int iWeaponIndex = GetEntPropEnt(param1, Prop_Data, "m_hActiveWeapon");
- if (IsValidEdict(iWeaponIndex))
- {
- SetEntProp(iWeaponIndex, Prop_Data, "m_iClip1", 200);
- SetEntProp(iWeaponIndex, Prop_Data, "m_iClip2", 400);
- CPrintToChat(param1, "%s Poprawnie zakupiłeś ulepszenie.", PREFIX);
- setPlayerUnlocks(param1, getPlayerUnlocks(param1) - ITEMCOST_REAMMO);
- }
- }
- else if (StrEqual(sItem, "uammo"))
- {
- if (getPlayerUnlocks(param1) < ITEMCOST_UAMMO)
- {
- CPrintToChat(param1, "%s Nie posiadasz wystarczająco dużo EXPa!", PREFIX);
- return;
- }
- g_bUAmmo[param1] = true;
- CPrintToChat(param1, "%s Poprawnie zakupiłeś ulepszenie.", PREFIX);
- setPlayerUnlocks(param1, getPlayerUnlocks(param1) - ITEMCOST_UAMMO);
- }
- else if (StrEqual(sItem, "flashlight"))
- {
- if (getPlayerUnlocks(param1) < ITEMCOST_FLASHLIGHT)
- {
- CPrintToChat(param1, "%s Nie posiadasz wystarczająco dużo EXPa!", PREFIX);
- return;
- }
- g_bFlashLight[param1] = true;
- CPrintToChat(param1, "%s Poprawnie zakupiłeś ulepszenie.", PREFIX);
- setPlayerUnlocks(param1, getPlayerUnlocks(param1) - ITEMCOST_FLASHLIGHT);
- }
- else if (StrEqual(sItem, "healths"))
- {
- if (getPlayerUnlocks(param1) < ITEMCOST_HEALTHS)
- {
- CPrintToChat(param1, "%s Nie posiadasz wystarczająco dużo EXPa!", PREFIX);
- return;
- }
- GivePlayerItem(param1, "weapon_healthshot");
- CPrintToChat(param1, "%s Poprawnie zakupiłeś ulepszenie.", PREFIX);
- setPlayerUnlocks(param1, getPlayerUnlocks(param1) - ITEMCOST_HEALTHS);
- }
- else if (StrEqual(sItem, "mhealth"))
- {
- if (getPlayerUnlocks(param1) < ITEMCOST_MHEALTH)
- {
- CPrintToChat(param1, "%s Nie posiadasz wystarczająco dużo EXPa!", PREFIX);
- return;
- }
- SetEntityHealth(param1, GetClientHealth(param1) + 50);
- CPrintToChat(param1, "%s Poprawnie zakupiłeś ulepszenie.", PREFIX);
- setPlayerUnlocks(param1, getPlayerUnlocks(param1) - ITEMCOST_MHEALTH);
- }
- else if (StrEqual(sItem, "he"))
- {
- if (getPlayerUnlocks(param1) < ITEMCOST_HE)
- {
- CPrintToChat(param1, "%s Nie posiadasz wystarczająco dużo EXPa!", PREFIX);
- return;
- }
- GivePlayerItem(param1, "weapon_hegrenade");
- CPrintToChat(param1, "%s Poprawnie zakupiłeś ulepszenie.", PREFIX);
- setPlayerUnlocks(param1, getPlayerUnlocks(param1) - ITEMCOST_HE);
- }
- else if (StrEqual(sItem, "molo"))
- {
- if (getPlayerUnlocks(param1) < ITEMCOST_MOLO)
- {
- CPrintToChat(param1, "%s Nie posiadasz wystarczająco dużo EXPa!", PREFIX);
- return;
- }
- GivePlayerItem(param1, "weapon_molotov");
- CPrintToChat(param1, "%s Poprawnie zakupiłeś ulepszenie.", PREFIX);
- setPlayerUnlocks(param1, getPlayerUnlocks(param1) - ITEMCOST_MOLO);
- }
- else if (StrEqual(sItem, "speed"))
- {
- if (getPlayerUnlocks(param1) < ITEMCOST_SPEED)
- {
- CPrintToChat(param1, "%s Nie posiadasz wystarczająco dużo EXPa!", PREFIX);
- return;
- }
- SetEntPropFloat(param1, Prop_Send, "m_flLaggedMovementValue", 1.5);
- CPrintToChat(param1, "%s Poprawnie zakupiłeś ulepszenie.", PREFIX);
- setPlayerUnlocks(param1, getPlayerUnlocks(param1) - ITEMCOST_SPEED);
- }
- else if (StrEqual(sItem, "dj"))
- {
- if (getPlayerUnlocks(param1) < ITEMCOST_DJ)
- {
- CPrintToChat(param1, "%s Nie posiadasz wystarczająco dużo EXPa!", PREFIX);
- return;
- }
- g_bDJ[param1] = true;
- CPrintToChat(param1, "%s Poprawnie zakupiłeś ulepszenie.", PREFIX);
- setPlayerUnlocks(param1, getPlayerUnlocks(param1) - ITEMCOST_DJ);
- }
- else if (StrEqual(sItem, "jetpack"))
- {
- if (getPlayerUnlocks(param1) < ITEMCOST_JETPACK)
- {
- CPrintToChat(param1, "%s Nie posiadasz wystarczająco dużo EXPa!", PREFIX);
- return;
- }
- g_bJetPack[param1] = true;
- CPrintToChat(param1, "%s Poprawnie zakupiłeś ulepszenie.", PREFIX);
- setPlayerUnlocks(param1, getPlayerUnlocks(param1) - ITEMCOST_JETPACK);
- }
- }
- case MenuAction_End:
- {
- delete SHOPMenu;
- }
- }
- }
- public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype, int &weapon, float damageForce[3], float damagePosition[3])
- {
- char sWeapon[64];
- GetClientWeapon(attacker, sWeapon, sizeof(sWeapon));
- if (StrEqual(sWeapon, "weapon_glock"))
- {
- if (g_bGlock[attacker])
- {
- damage += (damage * 0.05);
- return Plugin_Changed;
- }
- }
- else if (StrEqual(sWeapon, "weapon_deagle"))
- {
- if (g_bDeagle[attacker])
- {
- damage += (damage * 0.2);
- return Plugin_Changed;
- }
- }
- else if (StrEqual(sWeapon, "weapon_ak47"))
- {
- if (g_bAK47[attacker])
- {
- damage += (damage * 0.15);
- return Plugin_Changed;
- }
- }
- else if (StrEqual(sWeapon, "weapon_awp"))
- {
- if (g_bAWP[attacker])
- {
- damage += (damage * 0.5);
- return Plugin_Changed;
- }
- }
- else if (StrEqual(sWeapon, "weapon_usp_silencer"))
- {
- if (g_bUSP[attacker])
- {
- damage += (damage * 0.05);
- return Plugin_Changed;
- }
- }
- else if ((StrContains(sWeapon, "weapon_knife", true) != -1) || (StrContains(sWeapon, "weapon_bayonet", true) != -1))
- {
- if (g_bKnife[attacker] && !g_bKnifeCD[attacker])
- {
- g_bKnifeCD[attacker] = true;
- float vector[3];
- float attackerloc[3];
- float clientloc[3];
- float origin[3];
- GetEntPropVector(victim, Prop_Send, "m_vecOrigin", origin);
- origin[2] += 50.0;
- GetClientAbsOrigin(attacker, attackerloc);
- GetClientAbsOrigin(victim, clientloc);
- MakeVectorFromPoints(attackerloc, clientloc, vector);
- NormalizeVector(vector, vector);
- ScaleVector(vector, 800.0);
- TeleportEntity(victim, origin, NULL_VECTOR, vector);
- CreateTimer(5.0, CDKnife, attacker);
- }
- }
- return Plugin_Continue;
- }
- public Action CDKnife(Handle timer, int client)
- {
- g_bKnifeCD[client] = false;
- }
- public void OnGameFrame()
- {
- for (int client = 0; client <= MaxClients; client++)
- {
- if (IsValidClient(client))
- {
- if (g_bParachuteInUse[client])
- {
- float fVelocity[3];
- float fFallspeed = 100 * (-1.0);
- GetEntDataVector(client, g_iVelocity, fVelocity);
- if (fVelocity[2] < 0.0)
- {
- if (fVelocity[2] >= fFallspeed)
- {
- fVelocity[2] = fFallspeed;
- }
- else
- {
- fVelocity[2] = fVelocity[2] + 50.0;
- }
- TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, fVelocity);
- SetEntDataVector(client, g_iVelocity, fVelocity);
- }
- }
- }
- }
- }
- public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon)
- {
- if (!IsClientInGame(client))
- return Plugin_Continue;
- if (IsPlayerAlive(client) && g_bParachute[client])
- {
- if (buttons & IN_USE)g_bParachuteInUse[client] = true;
- else g_bParachuteInUse[client] = false;
- }
- if (IsPlayerAlive(client) && g_bDJ[client])
- {
- static int g_fLastButtons[MAXPLAYERS + 1], g_fLastFlags[MAXPLAYERS + 1], g_iJumps[MAXPLAYERS + 1], fCurFlags, fCurButtons;
- fCurFlags = GetEntityFlags(client);
- fCurButtons = GetClientButtons(client);
- if (g_fLastFlags[client] & FL_ONGROUND && !(fCurFlags & FL_ONGROUND) && !(g_fLastButtons[client] & IN_JUMP) && fCurButtons & IN_JUMP)g_iJumps[client]++;
- else if (fCurFlags & FL_ONGROUND)g_iJumps[client] = 0;
- else if (!(g_fLastButtons[client] & IN_JUMP) && fCurButtons & IN_JUMP && g_iJumps[client] <= 1)
- {
- g_iJumps[client]++;
- float vVel[3];
- GetEntPropVector(client, Prop_Data, "m_vecVelocity", vVel);
- vVel[2] = 250.0;
- TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, vVel);
- }
- g_fLastFlags[client] = fCurFlags;
- g_fLastButtons[client] = fCurButtons;
- }
- if (IsPlayerAlive(client) && g_bJetPack[client])
- {
- float m_fTime = GetGameTime();
- if (buttons & IN_JUMP)
- {
- if (g_fFuel[client] > 0.1)
- {
- float m_fVelocity[3];
- GetEntPropVector(client, Prop_Data, "m_vecVelocity", m_fVelocity);
- m_fVelocity[2] += 12.0;
- TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, m_fVelocity);
- g_fFuel[client] -= m_fTime - g_fTime[client];
- if (g_fFuel[client] < 0.0)
- g_fFuel[client] = 0.0;
- }
- else
- g_fFuel[client] = 0.0;
- }
- if (g_fFuel[client] < DEFINE_FUEL)
- {
- g_fFuel[client] += (m_fTime - g_fTime[client]) * DEFINE_REGEN;
- if (g_fFuel[client] > DEFINE_FUEL)
- g_fFuel[client] = DEFINE_FUEL;
- }
- g_fTime[client] = m_fTime;
- }
- return Plugin_Continue;
- }
- public Action FlashLight(int client, const char[] command, int args)
- {
- if (!g_bFlashLight[client])
- return Plugin_Continue;
- if (!IsPlayerAlive(client))
- return Plugin_Continue;
- SetEntProp(client, Prop_Send, "m_fEffects", GetEntProp(client, Prop_Send, "m_fEffects") ^ 4);
- ClientCommand(client, "playgamesound \"items/flashlight1.wav\"");
- return Plugin_Handled;
- }
- public void ResetAllVariables(int client)
- {
- g_bGlock[client] = false;
- g_bUSP[client] = false;
- g_bParachute[client] = false;
- g_bDeagle[client] = false;
- g_bAK47[client] = false;
- g_bAWP[client] = false;
- g_bKnife[client] = false;
- g_bKnifeCD[client] = false;
- g_bUAmmo[client] = false;
- g_bFlashLight[client] = false;
- g_bDJ[client] = false;
- g_bJetPack[client] = false;
- g_fFuel[client] = 0.0;
- g_fTime[client] = 0.0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement