Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <sdkhooks>
- #include <sdktools>
- #include <codmod>
- #include <cstrike>
- #include <emitsoundany>
- #pragma tabsize 0
- new const String:nazwa[] = "Loki";
- new const String:opis[] = "Pan podstępu";
- new const String:bronie[] = "#weapon_p250";
- new const inteligencja = 0;
- new const zdrowie = 0;
- new const obrazenia = 0;
- new const wytrzymalosc = 0;
- new const kondycja = 15;
- #define PREFIX "\x01\x0B \x02[cs-placzabaw.pl]\x01"
- new bool:ma_klase[65],
- ladunek[65];
- int g_iPlayerTime[MAXPLAYERS];
- stock bool IsFreezeTime()
- {
- if(GameRules_GetProp("m_bFreezePeriod"))
- return true;
- return false;
- }
- public bool:TraceRayFilter(ent, contents)
- {
- return false;
- }
- public Plugin:myinfo =
- {
- name = nazwa,
- author = "Linux`",
- description = "Cod Item",
- version = "1.0",
- url = "http://steamcommunity.com/id/linux2006"
- };
- public OnPluginStart()
- {
- CreateTimer(0.1, RegisterStart, 0);
- // HookEvent("player_spawn", OdrodzenieGracza);
- HookEvent("player_death", SmiercGracza);
- }
- public OnMapStart()
- {
- }
- public Action:RegisterStart(Handle:timer)
- {
- cod_register_class(nazwa, opis, bronie, inteligencja, zdrowie, obrazenia, wytrzymalosc, kondycja);
- }
- public cod_class_enabled(client)
- {
- ma_klase[client] = true;
- PrintToChat(client, "%s Loki", PREFIX);
- PrintToChat(client, "%s Po zabiciu przeciwnika dostajesz ładunek. Użyj ładunku, aby teleportować się we wskazane kursorem miejsce.!", PREFIX);
- PrintToChat(client, "%s Rozwinięcie inteligencji pozwoli Ci na zwiększenie zasięgu teleportacji.!", PREFIX);
- PrintToChat(client, "%s Miłej gry! Odwiedź czasem nasze forum i zostaw po sobie ślad! :)", PREFIX);
- ladunek[client] = 0;
- }
- public cod_class_disabled(client)
- {
- ma_klase[client] = false;
- }
- public cod_class_skill_used(client)
- {
- if(ladunek[client] >= 1 && IsFreezeTime)
- {
- CmdTeleport(client);
- if (ladunek[client] == 1)
- PrintToChat(client, "%s Został Ci jeden ładunek!", PREFIX, ladunek[client]);
- else if (ladunek[client] == 2 || ladunek[client] == 3 || ladunek[client] == 4)
- PrintToChat(client, "%s Zostały Ci %i ładunki!", PREFIX, ladunek[client]);
- else if (ladunek[client] >= 5)
- PrintToChat(client, "%s Zostało Ci %i ładunków!", PREFIX, ladunek[client]);
- }
- else
- {
- PrintToChat(client, "%s Nie masz ładunków. Zabij kogoś, aby je zdobyć!", PREFIX);
- }
- }
- public Action:SmiercGracza(Handle:event, String:name[], bool:dontBroadcast)
- {
- new client = GetClientOfUserId(GetEventInt(event, "userid"));
- new killer = GetClientOfUserId(GetEventInt(event, "attacker"));
- if(!IsValidClient(killer) || !ma_klase[killer])
- return Plugin_Continue;
- if(!IsValidClient(client) || !IsPlayerAlive(killer))
- return Plugin_Continue;
- if(GetClientTeam(client) == GetClientTeam(killer))
- return Plugin_Continue;
- ladunek[killer] ++;
- PrintToChat(killer, "%s Otrzymałeś ładunek. Ilość posiadanych ładunków : %i", PREFIX, ladunek[killer]);
- return Plugin_Continue;
- }
- public Action CmdTeleport(int client)
- {
- if(g_iPlayerTime[client]>=GetTime())
- PrintToChat(client, "%s Musisz poczekać, zanim użyjesz mocy Lokiego!", PREFIX);
- else
- {
- if (0 < client <= MaxClients && IsClientInGame(client) && IsPlayerAlive(client))
- {
- float fPos[3], fBackwards[3];
- float fOrigin[3]; GetClientEyePosition(client, fOrigin);
- float fAngles[3]; GetClientEyeAngles(client, fAngles);
- Handle trace = TR_TraceRayFilterEx(fOrigin, fAngles, MASK_PLAYERSOLID, RayType_Infinite, TraceRayDontHitPlayers, client);
- bool failed;
- int loopLimit = 100;
- GetAngleVectors(fAngles, fBackwards, NULL_VECTOR, NULL_VECTOR);
- NormalizeVector(fBackwards, fBackwards);
- ScaleVector(fBackwards, 10.0);
- if (TR_DidHit(trace))
- {
- TR_GetEndPosition(fPos, trace);
- while (IsPlayerStuck(fPos, client) && !failed)
- {
- SubtractVectors(fPos, fBackwards, fPos);
- if (GetVectorDistance(fPos, fOrigin) < 10 || loopLimit-- < 1)
- {
- failed = true;
- fPos = fOrigin;
- }
- }
- }
- delete trace;
- TeleportEntity(client, fPos, NULL_VECTOR, NULL_VECTOR);
- PrintToChat(client, "%s Zużyłeś ładunek. Ilość posiadanych ładunków : %i", PREFIX, ladunek[client]);
- }
- return Plugin_Handled;
- }
- return Plugin_Continue;
- }
- bool IsPlayerStuck(float pos[3], int client)
- {
- float mins[3]; GetClientMins(client, mins);
- float maxs[3]; GetClientMaxs(client, maxs);
- for (int i = 0; i < 3; ++i)
- {
- mins[i] -= 3;
- maxs[i] += 3;
- }
- TR_TraceHullFilter(pos, pos, mins, maxs, MASK_SOLID, TraceRayDontHitPlayers, client);
- return TR_DidHit();
- }
- public bool TraceRayDontHitPlayers(int iEntity, int iMask, any iData)
- {
- if (0 < iEntity <= MaxClients)
- return false;
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement