Advertisement
Guest User

Untitled

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