Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <codmod>
- #include <sdkhooks>
- #include <sdktools>
- new const String:nazwa[] = "[VIP] Exacto";
- new const String:opis[] = "Twoje granaty samonaprowadzają się! DMG +int";
- new const String:bronie[] = "#weapon_m4a1#weapon_ak47#weapon_glock#weapon_hegrenade";
- new const inteligencja = 0;
- new const zdrowie = 10;
- new const obrazenia = 0;
- new const wytrzymalosc = 20;
- new const kondycja = 0;
- #define PREFIX "\x01\x0B \x02[cs-placzabaw.pl]\x01"
- #define PENGUIN_REFRESH_RATE 0.1
- new bool:ma_klase[65];
- new sprite_beam,
- sprite_halo;
- ConVar g_PenguinSpeed;
- ConVar g_PenguinFuse;
- ConVar g_PenguinTimeToSeek;
- ConVar g_cooldown;
- ///////////////////////////////////////////
- stock float floatmin(float x, float y)
- {
- return x <= y ? x : y;
- }
- //////////////////////////////////////////
- public Plugin:myinfo =
- {
- name = nazwa,
- author = "Linux`",
- description = "Cod Klasa",
- version = "1.0",
- url = "http://steamcommunity.com/id/linux2006"
- };
- public OnPluginStart()
- {
- cod_register_class(nazwa, opis, bronie, inteligencja, zdrowie, obrazenia, wytrzymalosc, kondycja);
- g_PenguinSpeed = CreateConVar("superheromod_penguin_speed", "1500");
- g_PenguinFuse = CreateConVar("superheromod_penguin_fuse", "10");
- g_PenguinTimeToSeek = CreateConVar("superheromod_penguin_time_to_seek", "1");
- g_cooldown = CreateConVar("superheromod_hobgoblin_replenish_cooldown", "15");
- HookEvent("hegrenade_detonate", WybuchGranata);
- }
- public OnMapStart()
- {
- sprite_beam = PrecacheModel("sprites/laserbeam.vmt");
- sprite_halo = PrecacheModel("sprites/glow01.vmt");
- }
- public cod_class_enabled(client)
- {
- if(GetUserFlagBits(client) & ADMFLAG_RESERVATION)
- {
- ma_klase[client] = true;
- CreateTimer(g_cooldown.FloatValue, Timer_Grenade, GetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE);
- return COD_CONTINUE;
- }
- PrintToChat(client, "%s Klasa dostępna tylko dla posiadaczy VIP", PREFIX);
- return COD_STOP;
- }
- public cod_class_disabled(client)
- {
- ma_klase[client] = false;
- }
- public Action:RegisterStart(Handle:timer)
- {
- cod_register_class(nazwa, opis, bronie, inteligencja, zdrowie, obrazenia, wytrzymalosc, kondycja);
- }
- public Action Timer_Grenade(Handle timer, any data)
- {
- int client = GetClientOfUserId(data);
- if(!IsValidClient(client) || !IsPlayerAlive(client))
- return Plugin_Stop;
- if(!ma_klase[client])
- return Plugin_Stop;
- GiveGrenade(client);
- return Plugin_Continue;
- }
- public void GiveGrenade(int client)
- {
- if(IsPlayerAlive(client))
- GivePlayerItem(client, "weapon_hegrenade");
- CreateTimer(g_cooldown.FloatValue, Timer_Grenade, GetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE);
- }
- public int FindClosestTarget(int client)
- {
- float playerPos[3];
- float targetPos[3];
- float distance = 9999999999.0;
- int returnclient = -1;
- GetClientAbsOrigin(client, playerPos);
- for (int i = 1; i <= MaxClients;i++)
- {
- if(!IsValidClient(i) || !IsPlayerAlive(i))
- continue;
- if(GetClientTeam(client) == GetClientTeam(i))
- continue;
- GetClientAbsOrigin(i, targetPos);
- float currentdistance = GetVectorDistance(playerPos, targetPos);
- distance = floatmin(distance, currentdistance);
- if(distance == currentdistance)
- returnclient = i;
- }
- return returnclient;
- }
- public void OnEntityCreated(int entity, const char[] classname)
- {
- if(StrEqual(classname, "hegrenade_projectile"))
- SDKHook(entity, SDKHook_SpawnPost, OnGrenadeSpawn);
- }
- public Action OnGrenadeSpawn(int entity)
- {
- int thrower = GetEntPropEnt(entity, Prop_Data, "m_hOwnerEntity");
- if(!IsValidClient(thrower))
- return Plugin_Continue;
- if(!ma_klase[thrower])
- return Plugin_Continue;
- RequestFrame(SetNextThink, EntIndexToEntRef(entity));
- CreateTimer(g_PenguinTimeToSeek.FloatValue, Timer_StartSeek, EntIndexToEntRef(entity));
- return Plugin_Continue;
- }
- public void SetNextThink(any data)
- {
- int grenade = EntRefToEntIndex(data);
- SetEntProp(grenade, Prop_Data, "m_nNextThinkTick", -1);
- SetEntPropFloat(grenade, Prop_Data, "m_flElasticity", 5.0);
- SetEntPropFloat(grenade, Prop_Data, "m_flGroundSpeed", 100.0);
- }
- public Action Timer_StartSeek(Handle timer, any data)
- {
- int grenade = EntRefToEntIndex(data);
- if(grenade == INVALID_ENT_REFERENCE)
- return Plugin_Stop;
- int client = GetEntPropEnt(grenade, Prop_Data, "m_hOwnerEntity");
- if(!IsValidClient(client))
- return Plugin_Stop;
- if(!ma_klase[client])
- return Plugin_Stop;
- SetEntProp(grenade, Prop_Data, "m_takedamage", 2);
- SetEntProp(grenade, Prop_Data, "m_iHealth", 1);
- SetEntProp(grenade, Prop_Data, "m_CollisionGroup", 1);
- CreateTimer(g_PenguinFuse.FloatValue, Timer_Detonate, data);
- DataPack pack = CreateDataPack();
- CreateDataTimer(PENGUIN_REFRESH_RATE, Timer_Seek, pack, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
- pack.WriteCell(EntIndexToEntRef(grenade));
- pack.WriteCell(GetClientUserId(client));
- int target = FindClosestTarget(client);
- if(target != INVALID_ENT_REFERENCE)
- pack.WriteCell(GetClientOfUserId(target));
- else
- pack.WriteCell(target);
- return Plugin_Continue;
- }
- public Action Timer_Detonate(Handle timer, any data)
- {
- int grenade = EntRefToEntIndex(data);
- if(grenade == INVALID_ENT_REFERENCE)
- return Plugin_Stop;
- SetEntProp(grenade, Prop_Data, "m_nNextThinkTick", 1);
- SDKHooks_TakeDamage(grenade, grenade, grenade, 1.0);
- return Plugin_Continue;
- }
- public Action Timer_Seek(Handle timer, DataPack pack)
- {
- pack.Reset();
- int grenade = EntRefToEntIndex(pack.ReadCell());
- int thrower = GetClientOfUserId(pack.ReadCell());
- int target = pack.ReadCell();
- if(target == INVALID_ENT_REFERENCE)
- return Plugin_Stop;
- else
- target = GetClientOfUserId(target);
- if(grenade == INVALID_ENT_REFERENCE)
- return Plugin_Stop;
- if(!IsValidClient(target) || !IsPlayerAlive(target))
- {
- target = FindClosestTarget(thrower);
- if(!IsValidClient(target))
- return Plugin_Stop;
- }
- float targetPos[3];
- float nadePos[3];
- float direction[3];
- GetEntPropVector(grenade, Prop_Send, "m_vecOrigin", nadePos);
- GetClientAbsOrigin(target, targetPos);
- targetPos[2] += 40.0;
- SubtractVectors(targetPos, nadePos, direction);
- NormalizeVector(direction, direction);
- ScaleVector(direction, g_PenguinSpeed.FloatValue);
- TeleportEntity(grenade, NULL_VECTOR, NULL_VECTOR, direction);
- if(GetVectorDistance(targetPos, nadePos) <= 30.0)
- {
- SetEntProp(grenade, Prop_Data, "m_nNextThinkTick", 1);
- SDKHooks_TakeDamage(grenade, grenade, grenade, 1.0);
- return Plugin_Stop;
- }
- return Plugin_Continue;
- }
- public Action:WybuchGranata(Handle:event, const String:name[], bool:dontBroadcast)
- {
- new client = GetClientOfUserId(GetEventInt(event, "userid"));
- if(!IsValidClient(client) || !ma_klase[client])
- return Plugin_Continue;
- new Float:forigin[3], Float:iorigin[3];
- forigin[0] = GetEventFloat(event, "x");
- forigin[1] = GetEventFloat(event, "y");
- forigin[2] = GetEventFloat(event, "z");
- new obrazenia_gracza = 30+RoundFloat(cod_get_user_maks_intelligence(client)*0.9);
- for(new i = 1; i <= MaxClients; i++)
- {
- if(!IsClientInGame(i) || !IsPlayerAlive(i))
- continue;
- if(GetClientTeam(client) == GetClientTeam(i))
- continue;
- GetClientEyePosition(i, iorigin);
- if(GetVectorDistance(forigin, iorigin) <= 200.0)
- cod_inflict_damage(i, client, obrazenia_gracza);
- }
- TE_SetupBeamRingPoint(forigin, 20.0, 200.0, sprite_beam, sprite_halo, 0, 10, 0.6, 6.0, 0.0, {0, 255, 0, 128}, 10, 0);
- TE_SendToAll();
- return Plugin_Continue;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement