Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <sdktools>
- #include <cstrike>
- #include <sdkhooks>
- #include <scp>
- public Plugin:myinfo = {
- name = "VIP",
- author = "Ktoś",
- description = "",
- version = "1",
- url = ""
- }
- int g_fLastButtons[MAXPLAYERS+1], g_fLastFlags[MAXPLAYERS+1], g_iJumps[MAXPLAYERS+1];
- int offsetHe, offsetSmoke, offsetFlash, offsetDecoy, offsetHealth, offsetInc, offsetMol, offsetTa;
- public OnPluginStart() {
- HookEvent("player_spawn", Event_PlayerSpawn);
- HookEvent("player_death", Event_PlayerDeath);
- }
- public OnMapStart() {
- ServerCommand("sv_disable_immunity_alpha 1");
- int entindex = CreateEntityByName("weapon_hegrenade");
- DispatchSpawn(entindex);
- offsetHe = 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_flashbang");
- DispatchSpawn(entindex);
- offsetFlash = GetEntProp(entindex, Prop_Send, "m_iPrimaryAmmoType");
- AcceptEntityInput(entindex, "Kill");
- entindex = CreateEntityByName("weapon_decoy");
- DispatchSpawn(entindex);
- offsetDecoy = GetEntProp(entindex, Prop_Send, "m_iPrimaryAmmoType");
- AcceptEntityInput(entindex, "Kill");
- entindex = CreateEntityByName("weapon_healthshot");
- DispatchSpawn(entindex);
- offsetHealth = 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");
- entindex = CreateEntityByName("weapon_tagrenade");
- DispatchSpawn(entindex);
- offsetTa = GetEntProp(entindex, Prop_Send, "m_iPrimaryAmmoType");
- AcceptEntityInput(entindex, "Kill");
- }
- public Action Event_PlayerSpawn(Handle event, const char[] name, bool dontBroadcast)
- {
- int client = GetClientOfUserId(GetEventInt(event, "userid"));
- if (IsValidPlayer(client) && IsPlayerVip(client)) {
- CS_SetClientClanTag(client, "[VIP]");
- SetEntityGravity(client, 0.8);
- SetEntPropFloat(client, Prop_Send, "m_flLaggedMovementValue", 1.2);
- SetEntityRenderColor(client, 255, 255, 255, 240);
- if ((GetTeamScore(CS_TEAM_T) + GetTeamScore(CS_TEAM_CT)) == 0) SetEntProp(client , Prop_Send, "m_bHasHelmet", 1);
- if ((GetTeamScore(CS_TEAM_T) + GetTeamScore(CS_TEAM_CT)) > 0) SetEntProp(client ,Prop_Send,"m_ArmorValue",100,1);
- if ((GetTeamScore(CS_TEAM_T) + GetTeamScore(CS_TEAM_CT)) > 0) SetEntProp(client , Prop_Send, "m_bHasHelmet", 1);
- if (GetClientTeam(client) == CS_TEAM_CT && GetEntProp(client, Prop_Send, "m_bHasDefuser") == 0) GivePlayerItem(client, "item_defuser");
- if (PlayerGrenade(client, 3) < 1) GivePlayerItem(client, "weapon_flashbang");
- if (PlayerGrenade(client, 5) < 2) GivePlayerItem(client, "weapon_healthshot");
- if (PlayerGrenade(client, 5) < 2) GivePlayerItem(client, "weapon_healthshot");
- }
- }
- public Action:Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast) {
- int client = GetClientOfUserId(GetEventInt(event, "attacker"));
- bool headshot = GetEventBool(event, "headshot");
- if (IsValidPlayer(client) && IsPlayerVip(client)) {
- SetEntityHealth(client, GetEntProp(client, Prop_Send, "m_iHealth") + 5);
- if(headshot) SetEntityHealth(client, GetEntProp(client, Prop_Send, "m_iHealth") + 10);
- }
- }
- 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;
- }
- }
- public void OnClientPutInServer(int client) {
- if (IsValidPlayer(client)) {
- SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
- if (IsPlayerVip(client)) PrintToChatAll("VIP %N dołącza na serwer.",client);
- if (IsPlayerVip(client)) CS_SetClientClanTag(client, "[VIP]");
- }
- }
- public Action OnChatMessage(int &author, Handle recipients, char[] name, char[] message) {
- if (IsValidPlayer(author) && IsPlayerVip(author)) {
- int MaxMessageLength = MAXLENGTH_MESSAGE - strlen(name) - 5;
- Format(name, MaxMessageLength, "[VIP]%s",name);
- return Plugin_Changed;
- }
- return Plugin_Continue;
- }
- public Action OnTakeDamage(int client, int &attacker, int &inflictor, float &damage, int &damagetype) {
- if (IsValidPlayer(attacker)) damage = damage + damage * float(25) / 100.0;
- if (IsPlayerVip(client)) {
- if(damagetype & DMG_FALL) {
- return Plugin_Handled;
- }
- damage = damage - damage * float(10) / 100.0;
- }
- return Plugin_Changed;
- }
- stock bool IsValidPlayer(int client) {
- if(client >= 1 && client <= MaxClients && IsClientConnected(client) && !IsFakeClient(client) && IsClientInGame(client) )
- return true;
- return false;
- }
- stock int PlayerGrenade(int client, int granat)
- {
- if (granat == 1) return GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetHe);
- else if (granat == 2) return GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetSmoke);
- else if (granat == 3) return GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetFlash);
- else if (granat == 4) return GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetDecoy);
- else if (granat == 5) return GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetHealth);
- else if (granat == 6) {
- if (GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetInc) > GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetMol)) return GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetInc);
- else return GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetMol);
- }
- else if (granat == 7) return GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetTa);
- return 0;
- }stock bool IsPlayerVip(int client) {
- if (CheckCommandAccess(client, "check_vip", ADMFLAG_CUSTOM6, false)) return true;
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement