Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <cstrike>
- #include <sdktools>
- #pragma semicolon 1
- #pragma newdecls required
- char tag[64] = "VIP";
- int offsetHe;
- int offsetFlash;
- int offsetSmoke;
- int offsetInc;
- int offsetMol;
- int g_fLastButtons[MAXPLAYERS+1], g_fLastFlags[MAXPLAYERS+1], g_iJumps[MAXPLAYERS+1];
- public void OnPluginStart()
- {
- HookEvent("bomb_planted", EventBombPlanted);
- HookEvent("bomb_defused", EventBombDefused);
- HookEvent("player_spawn", PlayerSpawn);
- HookEvent("player_death", PlayerDeath);
- }
- public void OnMapStart()
- {
- int entindex;
- entindex = CreateEntityByName("weapon_hegrenade");
- DispatchSpawn(entindex);
- offsetHe = GetEntProp(entindex, Prop_Send, "m_iPrimaryAmmoType");
- AcceptEntityInput(entindex, "Kill");
- entindex = CreateEntityByName("weapon_flashbang");
- DispatchSpawn(entindex);
- offsetFlash = GetEntProp(entindex, Prop_Send, "m_iPrimaryAmmoType");
- AcceptEntityInput(entindex, "Kill");
- entindex = CreateEntityByName("weapon_smokegrenade");
- DispatchSpawn(entindex);
- offsetSmoke = GetEntProp(entindex, Prop_Send, "m_iPrimaryAmmoType");
- AcceptEntityInput(entindex, "Kill");
- entindex = CreateEntityByName("weapon_incgrenade");
- DispatchSpawn(entindex);
- offsetInc = GetEntProp(entindex, Prop_Send, "m_iPrimaryAmmoType");
- AcceptEntityInput(entindex, "Kill");
- entindex = CreateEntityByName("weapon_molotov");
- DispatchSpawn(entindex);
- offsetMol = GetEntProp(entindex, Prop_Send, "m_iPrimaryAmmoType");
- AcceptEntityInput(entindex, "Kill");
- }
- public Action PlayerSpawn(Event event, const char[] name, bool dontBroadcast)
- {
- int client = GetClientOfUserId(GetEventInt(event, "userid"));
- if(IsValidPlayer(client) && IsPlayerVIP(client))
- {
- if(IsPlayerAlive(client))
- {
- CreateTimer(0.1, GiveEquipment, GetEventInt(event, "userid"), TIMER_FLAG_NO_MAPCHANGE);
- }
- }
- }
- public Action GiveEquipment(Handle timer, any userid) {
- int client = GetClientOfUserId(userid);
- if(!IsPlayerAlive(client) || !IsValidPlayer(client)) return;
- SetEntProp(client, Prop_Send, "m_ArmorValue", 100);
- SetEntProp(client, Prop_Send, "m_bHasHelmet", 1);
- SetEntityHealth(client, GetEntProp(client, Prop_Send, "m_iHealth") + 5);
- if(GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0)
- {
- if(GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetHe) < 1)
- GivePlayerItem(client, "weapon_hegrenade");
- if(GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetFlash) < 1)
- GivePlayerItem(client, "weapon_flashbang");
- if(GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetSmoke) < 1)
- GivePlayerItem(client, "weapon_smokegrenade");
- if(GetClientTeam(client) == CS_TEAM_CT)
- if(GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetInc) < 1)
- GivePlayerItem(client, "weapon_incgrenade");
- if(GetClientTeam(client) == CS_TEAM_T)
- if(GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetMol) < 1)
- GivePlayerItem(client, "weapon_molotov");
- if(GetClientTeam(client) == CS_TEAM_CT)
- if (GetEntProp(client, Prop_Send, "m_bHasDefuser") == 0)
- GivePlayerItem(client, "item_defuser");
- }
- }
- public Action PlayerDeath(Handle event, const char[] name, bool dontBroadcast)
- {
- int attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
- if(!IsValidPlayer(attacker) || !IsPlayerVIP(attacker)) return;
- int health = GetClientHealth(attacker);
- SetEntityHealth(attacker, health+5);
- int money = GetEntProp(attacker, Prop_Send, "m_iAccount");
- SetEntProp(attacker, Prop_Send, "m_iAccount", money+100);
- bool headshot = GetEventBool(event, "headshot", false);
- if(headshot)
- {
- health = GetClientHealth(attacker);
- SetEntityHealth(attacker, health+5);
- money = GetEntProp(attacker, Prop_Send, "m_iAccount");
- SetEntProp(attacker, Prop_Send, "m_iAccount", money+200);
- }
- if(GetClientHealth(attacker) > 105)
- SetEntityHealth(attacker, 105);
- }
- public Action EventBombPlanted(Event event, const char[] name, bool dontBroadcast)
- {
- int client = GetClientOfUserId(GetEventInt(event, "userid"));
- int money = GetEntProp(client, Prop_Send, "m_iAccount");
- if(IsPlayerVIP(client))
- SetEntProp(client, Prop_Send, "m_iAccount", money+250);
- }
- public Action EventBombDefused(Event event, const char[] name, bool dontBroadcast)
- {
- int client = GetClientOfUserId(GetEventInt(event, "userid"));
- int money = GetEntProp(client, Prop_Send, "m_iAccount");
- if(IsPlayerVIP(client))
- SetEntProp(client, Prop_Send, "m_iAccount", money+250);
- }
- public void OnClientPostAdminCheck(int client)
- {
- if(IsPlayerVIP(client))
- {
- PrintToChatAll(" %s \x03%N\x01 \x01", tag, client);
- }
- }
- public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon)
- {
- if (IsValidPlayer(client) && IsPlayerVIP(client))
- {
- int fCurFlags = GetEntityFlags(client);
- int fCurButtons = GetClientButtons(client);
- if (g_fLastFlags[client] & FL_ONGROUND)
- {
- if (!(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)
- {
- if ( 1 <= g_iJumps[client] < 2)
- {
- 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;
- }
- }
- stock bool IsValidPlayer(int client)
- {
- if(client >= 1 && client <= MaxClients && IsClientInGame(client) && IsClientConnected(client) && !IsFakeClient(client) && !IsClientReplay(client) && !IsClientSourceTV(client))
- return true;
- return false;
- }
- stock bool IsPlayerVIP(int client)
- {
- if(GetUserFlagBits(client) & ADMFLAG_CUSTOM6)
- return true;
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement