Advertisement
Guest User

Untitled

a guest
Jun 24th, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.53 KB | None | 0 0
  1. #pragma semicolon 1
  2.  
  3. #define DEBUG
  4.  
  5. #define PLUGIN_AUTHOR "Rachnus"
  6. #define PLUGIN_VERSION "1.3"
  7.  
  8. #include <sourcemod>
  9. #include <sdktools>
  10. #include <cstrike>
  11. #include <sdkhooks>
  12. #include <emitsoundany>
  13. #include <ttt>
  14. #include <ttt_shop>
  15.  
  16. #pragma newdecls required
  17. #define EXPLOSION_VOLUME 5.0
  18.  
  19. #define PLUGIN_ITEM_SHORT "discom"
  20.  
  21. EngineVersion g_Game;
  22. int g_PVMid[MAXPLAYERS + 1]; // Predicted ViewModel ID's
  23.  
  24. bool g_bHasDiscombobulator[MAXPLAYERS+1];
  25.  
  26. int g_iViewModelIndex;
  27.  
  28. //GLOBAL
  29. ConVar g_cUseDecoyModel;
  30. ConVar g_cEnable;
  31. ConVar g_cFriendlyFire;
  32.  
  33. //FORCE EXPLOSION
  34. ConVar g_cExplosionParticleEffect;
  35. ConVar g_cExplosionMinimumDistance;
  36. ConVar g_cExplosionForce;
  37. ConVar g_cExplosionProps;
  38. ConVar g_cExplosionWeapons;
  39. ConVar g_cExplosionGrenades;
  40. ConVar g_cExplosionFlashbangs;
  41. ConVar g_cExplosionSmokes;
  42. ConVar g_cExplosionBounce;
  43. ConVar g_cExplosionBounceVelocity;
  44.  
  45. ConVar g_cExplosionPrice;
  46. ConVar g_cExplosionName;
  47. ConVar g_cDiscount = null;
  48.  
  49. public Plugin myinfo =
  50. {
  51. name = "Futuristic Grenades",
  52. author = PLUGIN_AUTHOR,
  53. description = "Adds more modes for decoys grenades",
  54. version = PLUGIN_VERSION,
  55. url = "https://github.com/Rachnus"
  56. };
  57.  
  58. public void OnPluginStart()
  59. {
  60. g_Game = GetEngineVersion();
  61. if(g_Game != Engine_CSGO)
  62. {
  63. SetFailState("This plugin is for CSGO only.");
  64. }
  65.  
  66. HookEvent("player_spawn", Event_PlayerSpawn);
  67.  
  68. //GENERAL CONVARS
  69. g_cUseDecoyModel = CreateConVar("fg_decoy_model", "0", "Whether or not to use custom model for decoy", FCVAR_NOTIFY);
  70. g_cEnable = CreateConVar("fg_cEnabled", "1", "Enable/Disable plugin", FCVAR_NOTIFY);
  71. g_cFriendlyFire = CreateConVar("fg_cFriendlyFire", "1", "Enable/Disable friendly fire", FCVAR_NOTIFY);
  72.  
  73. //FORCE EXPLOSION CONVARS
  74. g_cExplosionParticleEffect = CreateConVar("fg_explosion_particle_effect", "explosion", "Name of the particle effect you want to use for force explosions", FCVAR_NOTIFY);
  75. g_cExplosionMinimumDistance = CreateConVar("fg_explosion_minimum_distance", "300", "Minimum distance to push player away from force explosions", FCVAR_NOTIFY);
  76. g_cExplosionForce = CreateConVar("fg_explosion_force", "800", "Force to push away from force explosions", FCVAR_NOTIFY);
  77. g_cExplosionProps = CreateConVar("fg_explosion_props", "1", "Push props away from force explosions", FCVAR_NOTIFY);
  78. g_cExplosionWeapons = CreateConVar("fg_explosion_weapons", "1", "Push dropped weapons away from force explosions", FCVAR_NOTIFY);
  79. g_cExplosionGrenades = CreateConVar("fg_explosion_hegrenades", "1", "Push active hand grenades away from force explosions", FCVAR_NOTIFY);
  80. g_cExplosionFlashbangs = CreateConVar("fg_explosion_flashbangs", "1", "Push active flashbangs away from force explosions", FCVAR_NOTIFY);
  81. g_cExplosionSmokes = CreateConVar("fg_explosion_smokes", "1", "Push active smoke grenades away from force explosions", FCVAR_NOTIFY);
  82. g_cExplosionBounce = CreateConVar("fg_explosion_bounce", "0", "Bounce the grenade before activating", FCVAR_NOTIFY);
  83. g_cExplosionBounceVelocity = CreateConVar("fg_explosion_bounce_velocity", "300", "Up/Down velocity to push the grenade on bounce (If fg_explosion_bounce enabled)", FCVAR_NOTIFY);
  84.  
  85. g_cExplosionPrice = CreateConVar("fg_explosion_ttt_price", "5000", "Price of the black hole decoy");
  86. g_cExplosionName = CreateConVar("fg_explosion_ttt_name", "Discombobulator", "The name of the black hole in the shop");
  87.  
  88. g_cDiscount = CreateConVar("ttt_discount", "1", "Should disco discountable?");
  89.  
  90. HookConVarChange(g_cUseDecoyModel, ConVar_DecoyModel);
  91.  
  92. for (int i = 1; i <= MaxClients;i++)
  93. {
  94. if(IsClientInGame(i) && !IsFakeClient(i))
  95. {
  96. SDKHook(i, SDKHook_WeaponSwitchPost, OnClientWeaponSwitchPost);
  97. g_PVMid[i] = Weapon_GetViewModelIndex(i, -1);
  98. }
  99. }
  100.  
  101. AutoExecConfig(true);
  102. }
  103.  
  104. public void OnConfigsExecuted()
  105. {
  106. if (TTT_IsLoaded())
  107. {
  108. char sName[64];
  109. g_cExplosionName.GetString(sName, sizeof(sName));
  110. int iPrice = g_cExplosionPrice.IntValue;
  111. TTT_RegisterCustomItem(PLUGIN_ITEM_SHORT, sName, iPrice, TTT_TEAM_TRAITOR, g_cDiscount.BoolValue);
  112. }
  113. }
  114.  
  115. public Action TTT_OnItemPurchased(int client, const char[] item)
  116. {
  117. if (TTT_IsClientValid(client) && IsPlayerAlive(client) && (strcmp(item, PLUGIN_ITEM_SHORT) == 0))
  118. {
  119. if (g_bHasDiscombobulator[client])
  120. return Plugin_Stop;
  121. GiveDecoy(client);
  122. g_bHasDiscombobulator[client] = true;
  123. }
  124. return Plugin_Continue;
  125. }
  126.  
  127.  
  128. public void ConVar_DecoyModel(ConVar convar, const char[] oldValue, const char[] newValue)
  129. {
  130. if(convar.IntValue > 0)
  131. {
  132. for (int i = 1; i <= MaxClients;i++)
  133. {
  134. if(IsClientInGame(i) && !IsFakeClient(i))
  135. {
  136. g_PVMid[i] = Weapon_GetViewModelIndex(i, -1);
  137. }
  138. }
  139. }
  140. }
  141.  
  142. void PushAwayFromExplosion(int entity, const char[] classname)
  143. {
  144.  
  145. int iEnt = MaxClients + 1;
  146. while((iEnt = FindEntityByClassname(iEnt, classname)) != -1)
  147. {
  148. float propPos[3], entityPos[3];
  149. GetEntPropVector(iEnt, Prop_Send, "m_vecOrigin", propPos);
  150. GetEntPropVector(entity, Prop_Send, "m_vecOrigin", entityPos);
  151. entityPos[2] -= 30.0;
  152. float distance = GetVectorDistance(propPos, entityPos);
  153. if(distance < g_cExplosionMinimumDistance.FloatValue)
  154. {
  155. float direction[3];
  156. SubtractVectors(propPos, entityPos, direction);
  157. NormalizeVector(direction, direction);
  158. if (distance <= 20.0)
  159. distance = 20.0;
  160. ScaleVector(direction, g_cExplosionForce.FloatValue);
  161.  
  162. float propVel[3];
  163. GetEntPropVector(iEnt, Prop_Data, "m_vecVelocity", propVel);
  164. AddVectors(propVel, direction, direction);
  165.  
  166. TeleportEntity(iEnt, NULL_VECTOR, NULL_VECTOR, direction);
  167. }
  168. }
  169. }
  170.  
  171. public void OnEntityCreated(int entity, const char[] classname)
  172. {
  173. if(!g_cEnable.BoolValue)
  174. return;
  175.  
  176. if(StrEqual(classname, "decoy_projectile", false))
  177. {
  178. SDKHook(entity, SDKHook_SpawnPost, DecoySpawned);
  179. }
  180. }
  181.  
  182. public Action DecoySpawned(int entity)
  183. {
  184. int client = GetEntPropEnt(entity, Prop_Send, "m_hOwnerEntity");
  185.  
  186. if(TTT_IsClientValid(client) && g_bHasDiscombobulator[client])
  187. {
  188. g_bHasDiscombobulator[client] = false;
  189. SetEntPropString(entity, Prop_Data, "m_iName", "explosion");
  190.  
  191. if(g_cUseDecoyModel.BoolValue)
  192. SetEntityModel(entity, "models/weapons/futuristicgrenades/w_eq_decoy.mdl");
  193.  
  194. SDKHook(entity, SDKHook_TouchPost, DecoyTouchPost);
  195. }
  196.  
  197. return Plugin_Continue;
  198. }
  199.  
  200. public Action DecoyTouchPost(int entity, int other)
  201. {
  202. char name[16];
  203. GetEntPropString(entity, Prop_Data, "m_iName", name, sizeof(name));
  204.  
  205. if(StrEqual(name, "explosion", false))
  206. {
  207. float vecPos[3], startPoint[3], endPoint[3], slopeAngle[3];
  208. GetEntPropVector(entity, Prop_Send, "m_vecOrigin", vecPos);
  209. endPoint = vecPos;
  210. startPoint = vecPos;
  211. endPoint[2] = vecPos[2] - 5.0;
  212.  
  213. Handle traceZ = TR_TraceRayFilterEx(startPoint, endPoint, MASK_PLAYERSOLID, RayType_EndPoint, TraceFilterNotSelf, entity);
  214. TR_GetPlaneNormal(traceZ, slopeAngle);
  215.  
  216. endPoint = vecPos;
  217. startPoint = vecPos;
  218. startPoint[1] = vecPos[1] + 1.0;
  219. endPoint[1] = vecPos[1] - 1.0;
  220.  
  221. Handle traceX = TR_TraceRayFilterEx(startPoint, endPoint, MASK_PLAYERSOLID, RayType_EndPoint, TraceFilterNotSelf, entity);
  222.  
  223. endPoint = vecPos;
  224. startPoint = vecPos;
  225. startPoint[0] = vecPos[0] + 1.0;
  226. endPoint[0] = vecPos[0] - 1.0;
  227.  
  228. Handle traceY = TR_TraceRayFilterEx(startPoint, endPoint, MASK_PLAYERSOLID, RayType_EndPoint, TraceFilterNotSelf, entity);
  229.  
  230. if((TR_DidHit(traceZ) && !TR_DidHit(traceX) && !TR_DidHit(traceY)) || slopeAngle[2] > 0.5)
  231. RequestFrame(FrameCallback, entity);
  232. }
  233. }
  234.  
  235. public void FrameCallback(any entity)
  236. {
  237. char entityName[16];
  238. GetEntPropString(entity, Prop_Data, "m_iName", entityName, sizeof(entityName));
  239.  
  240. float vel[3] = { 0.0, 0.0, 300.0 };
  241.  
  242. if(StrEqual(entityName, "explosion", false))
  243. {
  244. vel[2] = g_cExplosionBounceVelocity.FloatValue;
  245.  
  246. if(g_cExplosionBounce.BoolValue)
  247. {
  248. TeleportEntity(entity, NULL_VECTOR, NULL_VECTOR, vel);
  249. CreateTimer(0.5, Timer_Decoy, entity);
  250. }
  251. else
  252. SpawnExplosion(entity);
  253. }
  254.  
  255. SDKUnhook(entity, SDKHook_TouchPost, DecoyTouchPost);
  256. }
  257.  
  258. public Action Timer_Decoy(Handle timer, any entity)
  259. {
  260. SpawnExplosion(entity);
  261. }
  262.  
  263. void SpawnExplosion(int entity)
  264. {
  265. int owner = GetEntPropEnt(entity, Prop_Data, "m_hOwnerEntity");
  266. if(!TTT_IsClientValid(owner))
  267. return;
  268.  
  269. char particleEffect[PLATFORM_MAX_PATH];
  270. float nadeOrigin[3];
  271. GetEntPropVector(entity, Prop_Send, "m_vecOrigin", nadeOrigin);
  272. AcceptEntityInput(entity, "Kill");
  273.  
  274. int particle = CreateEntityByName("info_particle_system");
  275. g_cExplosionParticleEffect.GetString(particleEffect, sizeof(particleEffect));
  276.  
  277. DispatchKeyValue(particle , "start_active", "0");
  278. DispatchKeyValue(particle , "effect_name", particleEffect);
  279. DispatchSpawn(particle);
  280. TeleportEntity(particle, nadeOrigin, NULL_VECTOR,NULL_VECTOR);
  281. ActivateEntity(particle);
  282. AcceptEntityInput(particle, "Start");
  283. EmitAmbientSoundAny("misc/futuristicgrenades/explosion.mp3", nadeOrigin, particle,_,_, EXPLOSION_VOLUME);
  284. for (int client = 1; client <= MaxClients; client++)
  285. {
  286. if(IsClientInGame(client) && IsPlayerAlive(client))
  287. {
  288. if(!g_cFriendlyFire.BoolValue)
  289. {
  290. int ownerteam = GetClientTeam(owner);
  291. if((ownerteam != GetClientTeam(client)) || client == owner)
  292. {
  293. float clientPos[3], explosionPos[3];
  294. GetClientAbsOrigin(client, clientPos);
  295. GetEntPropVector(particle, Prop_Send, "m_vecOrigin", explosionPos);
  296. clientPos[2] += 30.0;
  297. float distance = GetVectorDistance(clientPos, explosionPos);
  298.  
  299. if(distance < g_cExplosionMinimumDistance.FloatValue)
  300. {
  301. SetEntPropEnt(client, Prop_Data, "m_hGroundEntity", -1);
  302. float direction[3];
  303. SubtractVectors(clientPos, explosionPos, direction);
  304. NormalizeVector(direction, direction);
  305. if (distance <= 20.0)
  306. distance = 20.0;
  307. ScaleVector(direction, g_cExplosionForce.FloatValue);
  308.  
  309. float playerVel[3];
  310. GetEntPropVector(client, Prop_Data, "m_vecVelocity", playerVel);
  311. AddVectors(playerVel, direction, direction);
  312.  
  313. TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, direction);
  314. }
  315. }
  316. }
  317. else
  318. {
  319. float clientPos[3], explosionPos[3];
  320. GetClientAbsOrigin(client, clientPos);
  321. GetEntPropVector(particle, Prop_Send, "m_vecOrigin", explosionPos);
  322. if(GetEntPropEnt(client, Prop_Data, "m_hGroundEntity") != -1)
  323. explosionPos[2] -= 30.0;
  324.  
  325. float distance = GetVectorDistance(clientPos, explosionPos);
  326.  
  327. if(distance < g_cExplosionMinimumDistance.FloatValue)
  328. {
  329. SetEntPropEnt(client, Prop_Data, "m_hGroundEntity", -1);
  330. float direction[3];
  331. SubtractVectors(clientPos, explosionPos, direction);
  332. NormalizeVector(direction, direction);
  333. if (distance <= 20.0)
  334. distance = 20.0;
  335. ScaleVector(direction, g_cExplosionForce.FloatValue);
  336.  
  337. float playerVel[3];
  338. GetEntPropVector(client, Prop_Data, "m_vecVelocity", playerVel);
  339. AddVectors(playerVel, direction, direction);
  340.  
  341. TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, direction);
  342. }
  343. }
  344. }
  345. }
  346.  
  347. if(g_cExplosionProps.BoolValue)
  348. PushAwayFromExplosion(particle, "prop_physics*");
  349.  
  350. if(g_cExplosionWeapons.BoolValue)
  351. PushAwayFromExplosion(particle, "weapon_*");
  352.  
  353. if(g_cExplosionGrenades.BoolValue)
  354. PushAwayFromExplosion(particle, "hegrenade_projectile");
  355.  
  356. if(g_cExplosionFlashbangs.BoolValue)
  357. PushAwayFromExplosion(particle, "flashbang_projectile");
  358.  
  359. if(g_cExplosionSmokes.BoolValue)
  360. PushAwayFromExplosion(particle, "smokegrenade_projectile");
  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. public Action Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast)
  372. {
  373. if(!g_cEnable.BoolValue)
  374. return Plugin_Continue;
  375.  
  376. if(!g_cUseDecoyModel.BoolValue)
  377. return Plugin_Continue;
  378.  
  379. int client = GetClientOfUserId(event.GetInt("userid"));
  380. g_PVMid[client] = Weapon_GetViewModelIndex(client, -1);
  381.  
  382. return Plugin_Continue;
  383. }
  384.  
  385. int Weapon_GetViewModelIndex(int client, int sIndex)
  386. {
  387. while ((sIndex = FindEntityByClassname2(sIndex, "predicted_viewmodel")) != -1)
  388. {
  389. int Owner = GetEntPropEnt(sIndex, Prop_Send, "m_hOwner");
  390.  
  391. if (Owner != client)
  392. continue;
  393.  
  394. return sIndex;
  395. }
  396. return -1;
  397. }
  398. // Get entity name
  399. int FindEntityByClassname2(int startEnt, char[] classname)
  400. {
  401. while (startEnt > -1 && !IsValidEntity(startEnt)) startEnt--;
  402. return FindEntityByClassname(startEnt, classname);
  403. }
  404.  
  405. stock void AddMaterialsFromFolder(char path[PLATFORM_MAX_PATH])
  406. {
  407. DirectoryListing dir = OpenDirectory(path, true);
  408. if(dir != INVALID_HANDLE)
  409. {
  410. char buffer[PLATFORM_MAX_PATH];
  411. FileType type;
  412.  
  413. while(dir.GetNext(buffer, PLATFORM_MAX_PATH, type))
  414. {
  415. if(type == FileType_File && ((StrContains(buffer, ".vmt", false) != -1) || (StrContains(buffer, ".vtf", false) != -1) && !(StrContains(buffer, ".ztmp", false) != -1)))
  416. {
  417. char fullPath[PLATFORM_MAX_PATH];
  418.  
  419. Format(fullPath, sizeof(fullPath), "%s%s", path, buffer);
  420. if(g_cUseDecoyModel.BoolValue)
  421. AddFileToDownloadsTable(fullPath);
  422.  
  423. if(!IsModelPrecached(fullPath))
  424. PrecacheModel(fullPath);
  425. }
  426. }
  427. }
  428. }
  429.  
  430. public void OnClientWeaponSwitchPost(int client, int weaponid)
  431. {
  432. if(!g_cEnable.BoolValue)
  433. return;
  434.  
  435. SetEntPropEnt(weaponid, Prop_Send, "m_hOwnerEntity", client);
  436. char weapon[64];
  437. GetEntityClassname(weaponid, weapon,sizeof(weapon));
  438. if(StrEqual(weapon, "weapon_decoy"))
  439. {
  440. if(!g_cUseDecoyModel.BoolValue)
  441. return;
  442.  
  443. SetEntProp(weaponid, Prop_Send, "m_nModelIndex", 0);
  444. SetEntProp(g_PVMid[client], Prop_Send, "m_nModelIndex", g_iViewModelIndex);
  445. }
  446. }
  447.  
  448. stock void PrecacheEffect(const char[] sEffectName)
  449. {
  450. static int table = INVALID_STRING_TABLE;
  451.  
  452. if (table == INVALID_STRING_TABLE)
  453. {
  454. table = FindStringTable("EffectDispatch");
  455. }
  456.  
  457. bool save = LockStringTables(false);
  458. AddToStringTable(table, sEffectName);
  459. LockStringTables(save);
  460. }
  461.  
  462. stock void PrecacheParticleEffect(const char[] sEffectName)
  463. {
  464. static int table = INVALID_STRING_TABLE;
  465.  
  466. if (table == INVALID_STRING_TABLE)
  467. {
  468. table = FindStringTable("ParticleEffectNames");
  469. }
  470.  
  471. bool save = LockStringTables(false);
  472. AddToStringTable(table, sEffectName);
  473. LockStringTables(save);
  474. }
  475.  
  476. public void OnClientPutInServer(int client)
  477. {
  478. SDKHook(client, SDKHook_WeaponSwitchPost, OnClientWeaponSwitchPost);
  479. }
  480.  
  481. public void OnClientDisconnect(int client)
  482. {
  483. SDKUnhook(client, SDKHook_WeaponSwitchPost, OnClientWeaponSwitchPost);
  484. }
  485.  
  486. public void OnMapStart()
  487. {
  488. //MATERIALS
  489.  
  490. AddFileToDownloadsTable("materials/futuristicgrenades/effects/electric1.vmt");
  491. AddFileToDownloadsTable("materials/futuristicgrenades/effects/electric1.vtf");
  492.  
  493. AddFileToDownloadsTable("materials/futuristicgrenades/effects/conc_warp.vmt");
  494. AddFileToDownloadsTable("materials/futuristicgrenades/effects/conc_normal.vtf");
  495. AddFileToDownloadsTable("materials/futuristicgrenades/effects/conc_tint.vtf");
  496.  
  497. AddFileToDownloadsTable("materials/futuristicgrenades/effects/star_noz.vmt");
  498. AddFileToDownloadsTable("materials/futuristicgrenades/effects/yellowflare_noz.vmt");
  499. AddFileToDownloadsTable("materials/futuristicgrenades/effects/yellowflare.vtf");
  500.  
  501. AddFileToDownloadsTable("materials/futuristicgrenades/particle/particle_decals/snow_crater_1.vmt");
  502. AddFileToDownloadsTable("materials/futuristicgrenades/particle/particle_decals/snow_crater_1.vtf");
  503.  
  504. AddFileToDownloadsTable("materials/futuristicgrenades/particle/particle_flares/aircraft_white.vmt");
  505. AddFileToDownloadsTable("materials/futuristicgrenades/particle/particle_flares/aircraft_white.vtf");
  506.  
  507. AddFileToDownloadsTable("materials/futuristicgrenades/particle/particle_flares/particle_flare_002.vtf");
  508. AddFileToDownloadsTable("materials/futuristicgrenades/particle/particle_flares/particle_flare_002_noz.vmt");
  509.  
  510. AddFileToDownloadsTable("materials/futuristicgrenades/particle/particle_flares/particle_flare_004_nodepth.vmt");
  511. AddFileToDownloadsTable("materials/futuristicgrenades/particle/particle_flares/particle_flare_004.vtf");
  512.  
  513. //PARTICLES
  514. AddFileToDownloadsTable("particles/futuristicgrenades/futuristicgrenades.pcf");
  515.  
  516. //SOUND
  517. AddFileToDownloadsTable("sound/misc/futuristicgrenades/explosion.mp3");
  518.  
  519. //Precaching
  520.  
  521. PrecacheGeneric("particles/futuristicgrenades/futuristicgrenades.pcf",true);
  522.  
  523. PrecacheModel("materials/futuristicgrenades/effects/electric1.vmt");
  524. PrecacheModel("materials/futuristicgrenades/effects/electric1.vtf");
  525.  
  526. PrecacheModel("materials/futuristicgrenades/effects/conc_warp.vmt");
  527. PrecacheModel("materials/futuristicgrenades/effects/conc_normal.vtf");
  528. PrecacheModel("materials/futuristicgrenades/effects/conc_tint.vtf");
  529.  
  530. PrecacheModel("materials/futuristicgrenades/effects/star_noz.vmt");
  531. PrecacheModel("materials/futuristicgrenades/effects/yellowflare_noz.vmt");
  532. PrecacheModel("materials/futuristicgrenades/effects/yellowflare.vtf");
  533.  
  534. PrecacheModel("materials/futuristicgrenades/particle/particle_decals/snow_crater_1.vmt");
  535. PrecacheModel("materials/futuristicgrenades/particle/particle_decals/snow_crater_1.vtf");
  536.  
  537. PrecacheModel("materials/futuristicgrenades/particle/particle_flares/aircraft_white.vmt");
  538. PrecacheModel("materials/futuristicgrenades/particle/particle_flares/aircraft_white.vtf");
  539.  
  540. PrecacheModel("materials/futuristicgrenades/particle/particle_flares/particle_flare_002.vtf");
  541. PrecacheModel("materials/futuristicgrenades/particle/particle_flares/particle_flare_002_noz.vmt");
  542.  
  543. PrecacheModel("materials/futuristicgrenades/particle/particle_flares/particle_flare_004_nodepth.vmt");
  544. PrecacheModel("materials/futuristicgrenades/particle/particle_flares/particle_flare_004.vtf");
  545.  
  546. PrecacheEffect("ParticleEffect");
  547. PrecacheParticleEffect("futuristicgrenades");
  548. PrecacheSoundAny("misc/futuristicgrenades/explosion.mp3", true);
  549. PrecacheSoundAny("buttons/button15.wav", true);
  550. }
  551.  
  552. void GiveDecoy(int client) {
  553. int AmmoReserve = GetEntProp(client, Prop_Send, "m_iAmmo", 4, 15);
  554.  
  555. if (!AmmoReserve)
  556. {
  557. GivePlayerItem(client, "weapon_decoy");
  558. }
  559.  
  560. if (AmmoReserve)
  561. {
  562. SetEntProp(client, Prop_Send, "m_iAmmo", ++AmmoReserve, 4, 15);
  563. }
  564. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement