Advertisement
Guest User

Untitled

a guest
Jun 20th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.86 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <sdkhooks>
  3. #include <sdktools>
  4. #include <codmod>
  5. #include <cstrike>
  6. #include <emitsoundany>
  7. #pragma tabsize 0
  8.  
  9.  
  10. new const String:nazwa[] = "Loki";
  11. new const String:opis[] = "Pan podstępu";
  12. new const String:bronie[] = "#weapon_p250";
  13. new const inteligencja = 0;
  14. new const zdrowie = 0;
  15. new const obrazenia = 0;
  16. new const wytrzymalosc = 0;
  17. new const kondycja = 15;
  18.  
  19. #define PREFIX "\x01\x0B \x02[cs-placzabaw.pl]\x01"
  20.  
  21. new bool:ma_klase[65],
  22. ladunek[65];
  23.  
  24. int g_iPlayerTime[MAXPLAYERS];
  25.  
  26.  
  27. stock bool IsFreezeTime()
  28. {
  29. if(GameRules_GetProp("m_bFreezePeriod"))
  30. return true;
  31. return false;
  32. }
  33. public bool:TraceRayFilter(ent, contents)
  34. {
  35. return false;
  36. }
  37. public Plugin:myinfo =
  38. {
  39. name = nazwa,
  40. author = "Linux`",
  41. description = "Cod Item",
  42. version = "1.0",
  43. url = "http://steamcommunity.com/id/linux2006"
  44. };
  45.  
  46.  
  47. public OnPluginStart()
  48. {
  49. CreateTimer(0.1, RegisterStart, 0);
  50. // HookEvent("player_spawn", OdrodzenieGracza);
  51. HookEvent("player_death", SmiercGracza);
  52. }
  53. public OnMapStart()
  54. {
  55. }
  56. public Action:RegisterStart(Handle:timer)
  57. {
  58. cod_register_class(nazwa, opis, bronie, inteligencja, zdrowie, obrazenia, wytrzymalosc, kondycja);
  59. }
  60. public cod_class_enabled(client)
  61. {
  62. ma_klase[client] = true;
  63. PrintToChat(client, "%s Loki", PREFIX);
  64. PrintToChat(client, "%s Po zabiciu przeciwnika dostajesz ładunek. Użyj ładunku, aby teleportować się we wskazane kursorem miejsce.!", PREFIX);
  65. PrintToChat(client, "%s Rozwinięcie inteligencji pozwoli Ci na zwiększenie zasięgu teleportacji.!", PREFIX);
  66. PrintToChat(client, "%s Miłej gry! Odwiedź czasem nasze forum i zostaw po sobie ślad! :)", PREFIX);
  67. ladunek[client] = 0;
  68. }
  69. public cod_class_disabled(client)
  70. {
  71. ma_klase[client] = false;
  72. }
  73. public cod_class_skill_used(client)
  74. {
  75. if(ladunek[client] >= 1 && IsFreezeTime)
  76. {
  77. CmdTeleport(client);
  78. if (ladunek[client] == 1)
  79. PrintToChat(client, "%s Został Ci jeden ładunek!", PREFIX, ladunek[client]);
  80. else if (ladunek[client] == 2 || ladunek[client] == 3 || ladunek[client] == 4)
  81. PrintToChat(client, "%s Zostały Ci %i ładunki!", PREFIX, ladunek[client]);
  82. else if (ladunek[client] >= 5)
  83. PrintToChat(client, "%s Zostało Ci %i ładunków!", PREFIX, ladunek[client]);
  84. }
  85. else
  86. {
  87. PrintToChat(client, "%s Nie masz ładunków. Zabij kogoś, aby je zdobyć!", PREFIX);
  88. }
  89. }
  90. public Action:SmiercGracza(Handle:event, String:name[], bool:dontBroadcast)
  91. {
  92. new client = GetClientOfUserId(GetEventInt(event, "userid"));
  93. new killer = GetClientOfUserId(GetEventInt(event, "attacker"));
  94. if(!IsValidClient(killer) || !ma_klase[killer])
  95. return Plugin_Continue;
  96.  
  97. if(!IsValidClient(client) || !IsPlayerAlive(killer))
  98. return Plugin_Continue;
  99.  
  100. if(GetClientTeam(client) == GetClientTeam(killer))
  101. return Plugin_Continue;
  102.  
  103. ladunek[killer] ++;
  104. PrintToChat(killer, "%s Otrzymałeś ładunek. Ilość posiadanych ładunków : %i", PREFIX, ladunek[killer]);
  105.  
  106. return Plugin_Continue;
  107. }
  108.  
  109. public Action CmdTeleport(int client)
  110. {
  111. if(g_iPlayerTime[client]>=GetTime())
  112. PrintToChat(client, "%s Musisz poczekać, zanim użyjesz mocy Lokiego!", PREFIX);
  113. else
  114. {
  115. if (0 < client <= MaxClients && IsClientInGame(client) && IsPlayerAlive(client))
  116. {
  117. float fPos[3], fBackwards[3];
  118. float fOrigin[3]; GetClientEyePosition(client, fOrigin);
  119. float fAngles[3]; GetClientEyeAngles(client, fAngles);
  120.  
  121. Handle trace = TR_TraceRayFilterEx(fOrigin, fAngles, MASK_PLAYERSOLID, RayType_Infinite, TraceRayDontHitPlayers, client);
  122.  
  123. bool failed;
  124.  
  125. int loopLimit = 100;
  126.  
  127. GetAngleVectors(fAngles, fBackwards, NULL_VECTOR, NULL_VECTOR);
  128. NormalizeVector(fBackwards, fBackwards);
  129. ScaleVector(fBackwards, 10.0);
  130.  
  131. if (TR_DidHit(trace))
  132. {
  133. TR_GetEndPosition(fPos, trace);
  134.  
  135. while (IsPlayerStuck(fPos, client) && !failed)
  136. {
  137. SubtractVectors(fPos, fBackwards, fPos);
  138.  
  139. if (GetVectorDistance(fPos, fOrigin) < 10 || loopLimit-- < 1)
  140. {
  141. failed = true;
  142. fPos = fOrigin;
  143. }
  144. }
  145. }
  146. delete trace;
  147.  
  148. TeleportEntity(client, fPos, NULL_VECTOR, NULL_VECTOR);
  149. PrintToChat(client, "%s Zużyłeś ładunek. Ilość posiadanych ładunków : %i", PREFIX, ladunek[client]);
  150. }
  151. return Plugin_Handled;
  152. }
  153. return Plugin_Continue;
  154. }
  155. bool IsPlayerStuck(float pos[3], int client)
  156. {
  157. float mins[3]; GetClientMins(client, mins);
  158. float maxs[3]; GetClientMaxs(client, maxs);
  159.  
  160. for (int i = 0; i < 3; ++i)
  161. {
  162. mins[i] -= 3;
  163. maxs[i] += 3;
  164. }
  165.  
  166. TR_TraceHullFilter(pos, pos, mins, maxs, MASK_SOLID, TraceRayDontHitPlayers, client);
  167. return TR_DidHit();
  168. }
  169.  
  170. public bool TraceRayDontHitPlayers(int iEntity, int iMask, any iData)
  171. {
  172. if (0 < iEntity <= MaxClients)
  173. return false;
  174. return true;
  175. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement