Advertisement
Guest User

Untitled

a guest
Jul 21st, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.50 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <sdkhooks>
  3. #include <sdktools>
  4. #include <codmod>
  5. #include <cstrike>
  6. #include <emitsoundany>
  7. #include <timor2>
  8. #pragma tabsize 0
  9.  
  10. new const String:nazwa[] = "[S-VIP] Ares";
  11. new const String:opis[] = "Pan zniszczenia";
  12. new const String:bronie[] = "#weapon_m4a1#weapon_elite";
  13. new const inteligencja = 0;
  14. new const zdrowie = 30;
  15. new const obrazenia = 10;
  16. new const wytrzymalosc = 10;
  17. new const kondycja = 0;
  18.  
  19. #define WEAPON "weapon_knife" // weapon to replace
  20. #define PREFIX "\x01\x0B \x02[cs-placzabaw.pl]\x01"
  21. #define HOOK_REFRESH_TIME 0.1
  22. #define MODEL_BEAM "materials/sprites/purplelaser1.vmt"
  23. #define HOOK_SOUND "surf_dzwieki/ropesound.mp3"
  24. #define MODEL_BEAM "materials/sprites/purplelaser1.vmt"
  25.  
  26. ConVar g_PredkoscPrzyciaganie;
  27. ConVar g_PredkoscPrzyciaganieInt;
  28. ConVar g_CzasObrazenia;
  29. ConVar g_CzasObrazeniaInt;
  30. ConVar g_Obrazenia;
  31. ConVar g_ObrazeniaInt;
  32.  
  33. new bool:ma_klase[65];
  34.  
  35. int ladunek[65];
  36.  
  37. int g_iPlayerTime[MAXPLAYERS];
  38. ////
  39. int g_iSprite;
  40. int cel;
  41. int uzycie[MAXPLAYERS + 1];
  42. new zablokowane[MAXPLAYERS + 1];
  43. int g_iHooked[MAXPLAYERS + 1];
  44. int g_iHook[MAXPLAYERS + 1] = { INVALID_ENT_REFERENCE, ... };
  45. int g_iHookProp[MAXPLAYERS + 1] = { INVALID_ENT_REFERENCE, ... };
  46. bool g_bHooked[MAXPLAYERS + 1];
  47. Handle g_hTimerHook[MAXPLAYERS + 1] = { INVALID_HANDLE, ... };
  48. Handle timer_handler[MAXPLAYERS+1];
  49. Handle liczenie_handler[MAXPLAYERS+1];
  50. Handle obrazenia_handler[MAXPLAYERS+1];
  51.  
  52. public bool:TraceRayFilter(ent, contents)
  53. {
  54. return false;
  55. }
  56. public Plugin:myinfo =
  57. {
  58. name = nazwa,
  59. author = "Linux`",
  60. description = "Cod Item",
  61. version = "1.0",
  62. url = "http://steamcommunity.com/id/linux2006"
  63. };
  64.  
  65.  
  66. public OnPluginStart()
  67. {
  68. CreateTimer(0.01, RegisterStart, 0);
  69. HookEvent("player_spawn", OdrodzenieGracza);
  70. HookEvent("player_death", SmiercGracza);
  71.  
  72. g_PredkoscPrzyciaganie = CreateConVar("ares_predkoscprzyciaganie", "0.5", "0.5+(cod_get_user_maks_intelligence(hooker)/30.0)");
  73. g_PredkoscPrzyciaganieInt = CreateConVar("ares_predkoscprzyciaganieint", "30.0", "jak wyzej");
  74. g_CzasObrazenia = CreateConVar("ares_czasobrazenia", "0.8", "0.8-(cod_get_user_maks_intelligence(client)/100.0)");
  75. g_CzasObrazeniaInt = CreateConVar("ares_czasobrazeniaint", "100", "jak wyzej");
  76. g_Obrazenia = CreateConVar("ares_obrazenia", "5", "5+(cod_get_user_maks_intelligence(client)/10)");
  77. g_ObrazeniaInt = CreateConVar("ares_obrazeniaint", "10", "jak wyzej");
  78. AutoExecConfig(true, "ares", "sourcemod/surfklasy");
  79. }
  80. public void OnMapStart()
  81. {
  82. AddFileToDownloadsTable("sound/surf_dzwieki/ropesound.mp3");
  83. PrecacheSoundAny(HOOK_SOUND, true);
  84. g_iSprite = PrecacheModel(MODEL_BEAM);
  85. }
  86. public Action:RegisterStart(Handle:timer)
  87. {
  88. cod_register_class(nazwa, opis, bronie, inteligencja, zdrowie, obrazenia, wytrzymalosc, kondycja);
  89. }
  90. public cod_class_enabled(client)
  91. {
  92. if(GetUserFlagBits(client) & ADMFLAG_CUSTOM1)
  93. {
  94. ma_klase[client] = true;
  95. PrintToChat(client, "%s ARES", PREFIX);
  96. PrintToChat(client, "%s Wyceluj w przeciwnika i użyj mocy, aby się do niego przyciągnąć i zadawać mu regularnie obrażenia!", PREFIX);
  97. PrintToChat(client, "%s Prędkość przyciągania, częstotliwość zadawanych obrażeń i ich siłę determinuje inteligencja.", PREFIX);
  98. PrintToChat(client, "%s Użyj mocy będąc przyczepionym, aby się odczepić.", PREFIX);
  99. PrintToChat(client, "%s Miłej gry! Odwiedź czasem nasze forum i zostaw po sobie ślad! :)", PREFIX);
  100. ladunek[client] = 0;
  101. g_bHooked[client] = false;
  102. timer_handler[client] = CreateTimer(0.1, HudTextTimer, client, TIMER_REPEAT);
  103. return COD_CONTINUE;
  104. }
  105. PrintToChat(client, "%s Klasa dostępna tylko dla posiadaczy S-VIP", PREFIX);
  106. return COD_STOP;
  107. }
  108. public Action:HudTextTimer(Handle:timer, any:client)
  109. {
  110. if(IsPlayerAlive(client))
  111. {
  112. SetHudTextParams(-1.0, 0.75, 0.2, 255, 0, 0, 160);
  113. ShowHudText(client, -1, "ŁADUNKI : %i", ladunek[client]);
  114. }
  115. }
  116. public cod_class_disabled(client)
  117. {
  118. ma_klase[client] = false;
  119. ClearTimer(timer_handler[client]);
  120. }
  121. public cod_class_skill_used(client)
  122. {
  123. if(IsFreezeTime() || !IsPlayerAlive(client))
  124. return COD_CONTINUE;
  125.  
  126.  
  127.  
  128. if(!zablokowane[client])
  129. {
  130. if(g_iPlayerTime[client]>=GetTime())
  131. PrintToChat(client, "%s Musisz poczekać, żeby się odczepić!", PREFIX);
  132. else
  133. {
  134.  
  135. if (!g_bHooked[client])
  136. {
  137. if(ladunek[client] >= 1)
  138. {
  139. ScorpionHookOn(client)
  140. uzycie[client]++;
  141. return COD_CONTINUE;
  142. }
  143. }
  144. if(g_bHooked[client])
  145. {
  146. ScorpionHookOff(client);
  147. uzycie[client]++;
  148. return COD_CONTINUE;
  149. }
  150. }
  151. }
  152. else
  153. PrintToChat(client, "%s Kolego, wyłącz te macro albo przestań pić kawę!", PREFIX)
  154. return COD_CONTINUE;
  155. }
  156. public Action:SmiercGracza(Handle:event, String:name[], bool:dontBroadcast)
  157. {
  158. new client = GetClientOfUserId(GetEventInt(event, "userid"));
  159. new killer = GetClientOfUserId(GetEventInt(event, "attacker"));
  160. if(!IsValidClient(killer) || !ma_klase[killer])
  161. return Plugin_Continue;
  162.  
  163. if(!IsValidClient(client) || !IsPlayerAlive(killer))
  164. return Plugin_Continue;
  165.  
  166. if(GetClientTeam(client) == GetClientTeam(killer))
  167. return Plugin_Continue;
  168. ClearTimer(liczenie_handler[client])
  169. ladunek[killer]++;
  170. PrintToChat(killer, "%s Otrzymałeś ładunek. Ilość posiadanych ładunków : %i", PREFIX, ladunek[killer]);
  171.  
  172. return Plugin_Continue;
  173. }
  174. public Action:OdrodzenieGracza(Handle:event, String:name[], bool:dontBroadcast)
  175. {
  176. new client = GetClientOfUserId(GetEventInt(event, "userid"));
  177. if(!IsValidClient(client) || !ma_klase[client])
  178. return Plugin_Continue;
  179. g_iPlayerTime[client] = 0;
  180. g_bHooked[client] = false;
  181. g_iPlayerTime[client] = GetTime()+8;
  182. liczenie_handler[client] = CreateTimer(1.0, Liczenie, client, TIMER_REPEAT);
  183. return Plugin_Continue;
  184. }
  185. public Action:Liczenie(Handle timer, any client)
  186. {
  187. if (uzycie[client] >= 10)
  188. {
  189. uzycie[client] = 0;
  190. CreateTimer(1.0, Odblokuj, client);
  191. zablokowane[client] = true;
  192. }
  193. uzycie[client] = 0;
  194. }
  195. public Action:Odblokuj(Handle timer, any client)
  196. {
  197. zablokowane[client] = false;
  198. }
  199. public void OnGameFrame()
  200. {
  201. //This is to make the player run smoothly off the ground, csgo make u stick to the ground unless u get high enough force of the ground
  202. for (int i = 1; i <= MaxClients; i++)
  203. {
  204. if(IsValidClient(i))
  205. {
  206. int victim = GetClientOfUserId(g_iHooked[i]);
  207. if (IsValidClient(victim))
  208. SetEntPropEnt(victim, Prop_Data, "m_hGroundEntity", -1);
  209. }
  210. }
  211. }
  212.  
  213. public Action Timer_Hook(Handle timer, any data)
  214. {
  215. // Drags player to you
  216. int hooker = GetClientOfUserId(data);
  217. int victim = GetClientOfUserId(g_iHooked[hooker]);
  218.  
  219. if (!IsPlayerAlive(victim) || !IsPlayerAlive(hooker))
  220. {
  221. ScorpionHookOff(hooker);
  222. g_hTimerHook[hooker] = INVALID_HANDLE;
  223. return Plugin_Stop;
  224. }
  225.  
  226. float victimVel[3];
  227. float hookerPos[3], victimPos[3], eyePos[3];
  228.  
  229. GetClientAbsOrigin(hooker, victimPos);
  230. GetClientAbsOrigin(victim, hookerPos);
  231. GetClientEyePosition(victim, eyePos);
  232. eyePos[2] -= 40.0;
  233. int color[4] = { 255, 0, 0, 255 };
  234.  
  235. float x = GetRandomFloat(-1.0, 1.0);
  236.  
  237. float dir[3];
  238. dir[0] = x;
  239. dir[1] = x;
  240. dir[2] = x;
  241. TE_SetupBloodSprite(eyePos, dir, color, 500, g_iSprite, g_iSprite);
  242. TE_SendToAll();
  243.  
  244. float distance = GetVectorDistance(hookerPos, victimPos);
  245.  
  246. if ( distance > 5 )
  247. {
  248. float fl_Time = distance / 1000.0;
  249.  
  250. victimVel[0] = (hookerPos[0] - victimPos[0]) / fl_Time;
  251. victimVel[1] = (hookerPos[1] - victimPos[1]) / fl_Time;
  252. victimVel[2] = (hookerPos[2] - victimPos[2]) / fl_Time;
  253. }
  254. else
  255. {
  256. victimVel[0] = 0.0;
  257. victimVel[1] = 0.0;
  258. victimVel[2] = 0.0;
  259. }
  260. new Float:szybkosc = g_PredkoscPrzyciaganie.IntValue+(cod_get_user_maks_intelligence(hooker)/g_PredkoscPrzyciaganieInt.FloatValue);
  261. ScaleVector(victimVel, szybkosc);
  262. TeleportEntity(hooker, NULL_VECTOR, NULL_VECTOR, victimVel);
  263. return Plugin_Continue;
  264. }
  265.  
  266. stock void CreateHookBeam(int client, int victim)
  267. {
  268. //BEAM
  269. int beam = CreateEntityByName("env_beam");
  270.  
  271. char color[16];
  272. Format(color, sizeof(color), "255 255 25 255");
  273.  
  274. SetEntityModel(beam, MODEL_BEAM); // This is where you would put the texture, ie "sprites/laser.vmt" or whatever.
  275. DispatchKeyValue(beam, "rendercolor", color );
  276. DispatchKeyValue(beam, "renderamt", "200");
  277. DispatchKeyValue(beam, "decalname", "Bigshot");
  278. DispatchKeyValue(beam, "life", "0");
  279. DispatchKeyValue(beam, "TouchType", "0");
  280. DispatchSpawn(beam);
  281.  
  282. SetEntPropEnt(beam, Prop_Send, "m_hAttachEntity", client);
  283. SetEntPropEnt(beam, Prop_Send, "m_hAttachEntity", victim, 1);
  284. SetEntProp(beam, Prop_Send, "m_nNumBeamEnts", 2);
  285. SetEntProp(beam, Prop_Send, "m_nBeamType", 2);
  286.  
  287. SetEntPropFloat(beam, Prop_Data, "m_fWidth", 5.0);
  288. SetEntPropFloat(beam, Prop_Data, "m_fEndWidth", 5.0);
  289. ActivateEntity(beam);
  290. AcceptEntityInput(beam, "TurnOn");
  291.  
  292. g_iHook[client] = EntIndexToEntRef(beam);
  293. }
  294.  
  295. stock void CreateEmptyHook(int client)
  296. {
  297. float startPos[3];
  298. GetClientAbsOrigin(client, startPos);
  299. startPos[2] += 40.0;
  300.  
  301. float eyeAngles[3];
  302. GetClientEyeAngles(client, eyeAngles);
  303. float endPos[3];
  304. Handle trace = TR_TraceRayFilterEx(startPos, eyeAngles, MASK_ALL, RayType_Infinite, TraceFilterNotSelf, client);
  305. if(TR_DidHit(trace))
  306. TR_GetEndPosition(endPos, trace);
  307. CloseHandle(trace);
  308.  
  309. //BEAM
  310. int beam = CreateEntityByName("env_beam");
  311.  
  312. char color[16];
  313. Format(color, sizeof(color), "255 255 25 255");
  314.  
  315. SetEntityModel(beam, MODEL_BEAM); // This is where you would put the texture, ie "sprites/laser.vmt" or whatever.
  316. DispatchKeyValue(beam, "rendercolor", color );
  317. DispatchKeyValue(beam, "renderamt", "200");
  318. DispatchKeyValue(beam, "decalname", "Bigshot");
  319. DispatchKeyValue(beam, "life", "0");
  320. DispatchKeyValue(beam, "TouchType", "0");
  321. DispatchSpawn(beam);
  322. TeleportEntity(beam, startPos, NULL_VECTOR, NULL_VECTOR);
  323.  
  324. //PROP
  325. int prop = CreateEntityByName("info_target");
  326. DispatchSpawn(prop);
  327. TeleportEntity(prop, endPos, NULL_VECTOR, NULL_VECTOR);
  328. //PROP END
  329.  
  330. SetEntPropEnt(beam, Prop_Send, "m_hAttachEntity", beam);
  331. SetEntPropEnt(beam, Prop_Send, "m_hAttachEntity", prop, 1);
  332. SetEntProp(beam, Prop_Send, "m_nNumBeamEnts", 2);
  333. SetEntProp(beam, Prop_Send, "m_nBeamType", 2);
  334.  
  335. SetEntPropFloat(beam, Prop_Data, "m_fWidth", 5.0);
  336. SetEntPropFloat(beam, Prop_Data, "m_fEndWidth", 5.0);
  337. ActivateEntity(beam);
  338. AcceptEntityInput(beam, "TurnOn");
  339.  
  340. SetVariantString("!activator");
  341. AcceptEntityInput(beam, "SetParent", client);
  342.  
  343. g_iHookProp[client] = EntIndexToEntRef(prop);
  344. g_iHook[client] = EntIndexToEntRef(beam);
  345. }
  346.  
  347. public void ScorpionHookOff(int client)
  348. {
  349. g_bHooked[client] = false;
  350. int hook = EntRefToEntIndex(g_iHook[client]);
  351. if(hook != INVALID_ENT_REFERENCE)
  352. AcceptEntityInput(hook, "Kill");
  353. g_iHook[client] = INVALID_ENT_REFERENCE;
  354.  
  355. int prop = EntRefToEntIndex(g_iHookProp[client]);
  356. if(prop != INVALID_ENT_REFERENCE)
  357. AcceptEntityInput(prop, "Kill");
  358. g_iHookProp[client] = INVALID_ENT_REFERENCE;
  359. ClearTimer(obrazenia_handler[client]);
  360. g_iHooked[client] = INVALID_ENT_REFERENCE;
  361. }
  362.  
  363. public bool TraceFilterNotSelf(int entityhit, int mask, any entity)
  364. {
  365. if(entity == 0 && entityhit != entity)
  366. return true;
  367.  
  368. return false;
  369. }
  370.  
  371. stock void ScorpionHookOn(int client)
  372. {
  373. int target = GetClientAimTarget(client, true);
  374. cel = target;
  375. if (IsValidClient(target))
  376. {
  377. if(!IsPlayerAlive(target))
  378. return;
  379.  
  380. if(GetClientTeam(client) == GetClientTeam(target))
  381. return;
  382.  
  383. g_iPlayerTime[client]=GetTime()+2;
  384.  
  385. ladunek[client]--;
  386. float pos[3], victimPos[3];
  387. GetClientEyePosition(target, victimPos);
  388. GetClientEyePosition(client, pos);
  389. new Float:CzasObrazenia = g_CzasObrazenia.FloatValue-(cod_get_user_maks_intelligence(client)/g_CzasObrazeniaInt.IntValue);
  390.  
  391. obrazenia_handler[client] = CreateTimer(CzasObrazenia, ZadawajObrazenia, client, TIMER_REPEAT);
  392.  
  393. EmitAmbientSoundAny(HOOK_SOUND, pos,_,_,_,6.0);
  394. EmitSoundToClientAny(target, HOOK_SOUND);
  395. CreateHookBeam(client, target);
  396. g_iHooked[client] = GetClientUserId(target);
  397. g_bHooked[client] = true;
  398.  
  399. g_hTimerHook[client] = CreateTimer(HOOK_REFRESH_TIME, Timer_Hook, GetClientUserId(client), TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
  400. }
  401. else
  402. {
  403. CreateEmptyHook(client);
  404. g_bHooked[client] = true;
  405. }
  406. }
  407. public Action:ZadawajObrazenia(Handle timer, any client)
  408. {
  409. new obrazeniauderzenie = g_Obrazenia.IntValue+(cod_get_user_maks_intelligence(client)/g_ObrazeniaInt.IntValue);
  410. cod_inflict_damage(cel, client, obrazeniauderzenie);
  411. }
  412. stock ClearTimer(&Handle:timer)
  413. {
  414. if (timer != INVALID_HANDLE)
  415. {
  416. KillTimer(timer);
  417. timer = INVALID_HANDLE;
  418. }
  419. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement