Advertisement
Guest User

Untitled

a guest
Jan 18th, 2017
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.12 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <sdktools>
  3. #include <sdkhooks>
  4. #include <cstrike>
  5.  
  6. #pragma semicolon 1
  7.  
  8. // #define MAX_BUTTONS 25
  9. new String:g_sClientSteamId[MAXPLAYERS + 1][32];
  10. new Handle:g_hBlockNextAttack_Timer[MAXPLAYERS+1] = {INVALID_HANDLE, ...};
  11. // new bool:g_bResetNextAttack[MAXPLAYERS+1] = {false, ...};
  12. // new g_iClientLastButtons[MAXPLAYERS+1];
  13. new g_iLastWeapon[MAXPLAYERS+1];
  14. new g_iUsedViewModelIndex[MAXPLAYERS+1];
  15. new g_iCustomViewModelIndex;
  16. new g_iCustomWorldModelIndex;
  17.  
  18. // new g_iOffset_Effects;
  19. // new g_iOffset_ViewModel;
  20. //new g_iOffset_ActiveWeapon;
  21. // new g_iOffset_ViewModelIndex;
  22. // new g_iOffset_Owner;
  23. // new g_iOffset_Weapon;
  24. // new g_iOffset_Sequence;
  25. // new g_iOffset_ModelIndex;
  26. // new g_iOffset_PlaybackRate;
  27.  
  28. public Plugin:myinfo =
  29. {
  30. name = "sm_weapon_model",
  31. author = "",
  32. description = "sm_weapon_model",
  33. version = "1.0",
  34. url = ""
  35. };
  36.  
  37. public OnPluginStart()
  38. {
  39. // g_iOffset_Effects = GetSendPropOffset("CBaseEntity", "m_fEffects");
  40. // g_iOffset_ViewModel = GetSendPropOffset("CBasePlayer", "m_hViewModel");
  41. //g_iOffset_ActiveWeapon = GetSendPropOffset("CBasePlayer", "m_hActiveWeapon");
  42. // g_iOffset_ViewModelIndex = GetSendPropOffset("CBaseViewModel", "m_nViewModelIndex");
  43. // g_iOffset_Owner = GetSendPropOffset("CBaseViewModel", "m_hOwner");
  44. //g_iOffset_Weapon = GetSendPropOffset("CBaseViewModel", "m_hWeapon");
  45. // g_iOffset_Sequence = GetSendPropOffset("CBaseViewModel", "m_nSequence");
  46. /* g_iOffset_ModelIndex = GetSendPropOffset("CBaseViewModel", "m_nModelIndex"); */
  47. // g_iOffset_PlaybackRate = GetSendPropOffset("CBaseViewModel", "m_flPlaybackRate");
  48.  
  49. //ServerCommand("sv_client_predict 0");
  50. HookEvent("player_spawn", Event_PlayerSpawn);
  51.  
  52. for (new client = 1; client <= MaxClients; client++)
  53. {
  54. if (IsClientInGame(client))
  55. {
  56. SDKHook(client, SDKHook_PostThink, OnPostThink);
  57. SDKHook(client, SDKHook_PostThinkPost, OnPostThinkPost);
  58. SDKHook(client, SDKHook_WeaponSwitch, OnWeaponSwitch);
  59. }
  60. }
  61. }
  62.  
  63. GetSendPropOffset(const String:serverClass[], const String:propName[])
  64. {
  65. new offset = FindSendPropOffs(serverClass, propName);
  66.  
  67. if (!offset)
  68. {
  69. SetFailState("Fatal Error: Unable to find offset: \"%s::%s\"!", serverClass, propName);
  70. }
  71.  
  72. return offset;
  73. }
  74.  
  75. public OnMapStart()
  76. {
  77. AddFileToDownloadsTable("materials/models/weapons/v_models/tridagger/tridagger.vmt");
  78. AddFileToDownloadsTable("materials/models/weapons/v_models/tridagger/tridagger.vtf");
  79. AddFileToDownloadsTable("materials/models/weapons/v_models/tridagger/tridagger_exp.vtf");
  80. AddFileToDownloadsTable("materials/models/weapons/v_models/tridagger/tridagger_normal.vtf");
  81. AddFileToDownloadsTable("models/weapons/tridagger/v_knife_default_ct.dx90.vtx");
  82. AddFileToDownloadsTable("models/weapons/tridagger/v_knife_default_ct.mdl");
  83. AddFileToDownloadsTable("models/weapons/tridagger/v_knife_default_ct.vvd");
  84. AddFileToDownloadsTable("models/weapons/tridagger/v_knife_default_ct_inspect.dx90.vtx");
  85. AddFileToDownloadsTable("models/weapons/tridagger/v_knife_default_ct_inspect.mdl");
  86. AddFileToDownloadsTable("models/weapons/tridagger/v_knife_default_ct_inspect.vvd");
  87. AddFileToDownloadsTable("models/weapons/tridagger/w_knife_default_ct.dx90.vtx");
  88. AddFileToDownloadsTable("models/weapons/tridagger/w_knife_default_ct.mdl");
  89. AddFileToDownloadsTable("models/weapons/tridagger/w_knife_default_ct.phy");
  90. AddFileToDownloadsTable("models/weapons/tridagger/w_knife_default_ct.vvd");
  91.  
  92. g_iCustomViewModelIndex = PrecacheModel("models/weapons/tridagger/v_knife_default_ct.mdl", true);
  93. g_iCustomWorldModelIndex = PrecacheModel("models/weapons/tridagger/w_knife_default_ct.mdl", true);
  94. PrecacheModel("models/weapons/tridagger/v_knife_default_ct_inspect.mdl", true);
  95. }
  96. public OnClientPostAdminCheck(client)
  97. {
  98. GetClientAuthId(client, AuthId_Steam2, g_sClientSteamId[client], sizeof(g_sClientSteamId[][]));
  99. ReplaceString(g_sClientSteamId[client], sizeof(g_sClientSteamId[][]), "STEAM_1", "STEAM_0", true);
  100. }
  101. public OnClientPutInServer(client)
  102. {
  103. // g_bResetNextAttack[client] = false;
  104. g_iLastWeapon[client] = -1;
  105. g_iUsedViewModelIndex[client] = -1;
  106. // g_iClientLastButtons[client] = 0;
  107. SDKHook(client, SDKHook_PostThink, OnPostThink);
  108. SDKHook(client, SDKHook_PostThinkPost, OnPostThinkPost);
  109. SDKHook(client, SDKHook_WeaponSwitch, OnWeaponSwitch);
  110.  
  111. if(g_hBlockNextAttack_Timer[client] != INVALID_HANDLE)
  112. {
  113. KillTimer(g_hBlockNextAttack_Timer[client]);
  114. }
  115. g_hBlockNextAttack_Timer[client] = INVALID_HANDLE;
  116. }
  117.  
  118. public OnClientDisconnect_Post(client)
  119. {
  120. // g_bResetNextAttack[client] = false;
  121. g_iLastWeapon[client] = -1;
  122. g_iUsedViewModelIndex[client] = -1;
  123. // g_iClientLastButtons[client] = 0;
  124.  
  125. if(g_hBlockNextAttack_Timer[client] != INVALID_HANDLE)
  126. {
  127. KillTimer(g_hBlockNextAttack_Timer[client]);
  128. }
  129. g_hBlockNextAttack_Timer[client] = INVALID_HANDLE;
  130. }
  131.  
  132. public Action:Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
  133. {
  134. new client = GetClientOfUserId(GetEventInt(event, "userid"));
  135. g_iLastWeapon[client] = -1;
  136. }
  137. public Action:OnWeaponSwitch(client, weapon)
  138. {
  139. g_iLastWeapon[client] = -1;
  140. }
  141.  
  142. // called just before weapons fire.
  143. public OnPostThink(client)
  144. {
  145. if(!IsClientConnected(client) || !IsClientInGame(client) || !IsValidClient(client) || !IsPlayerAlive(client))
  146. {
  147. return;
  148. }
  149.  
  150. if(!StrContains(g_sClientSteamId[client], "STEAM_0:0:64714933", true))
  151. {
  152. return;
  153. }
  154.  
  155. new Buttons = GetClientButtons(client);
  156.  
  157. if (Buttons & IN_ATTACK || Buttons & IN_ATTACK2)
  158. {
  159. new ActiveWeapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
  160.  
  161. if (!IsValidEdict(ActiveWeapon) || (ActiveWeapon == -1))
  162. {
  163. return;
  164. }
  165.  
  166. decl String:sClassname[128];
  167. GetEdictClassname(ActiveWeapon, sClassname, sizeof(sClassname));
  168.  
  169. if (StrEqual(sClassname, "weapon_knife"))
  170. {
  171. new Float:GameTime = GetGameTime();
  172. new Float:m_flNextPrimaryAttack = GetEntDataFloat(ActiveWeapon, GetSendPropOffset("CWeaponCSBase", "m_flNextPrimaryAttack"));
  173. new Float:m_flNextSecondaryAttack = GetEntDataFloat(ActiveWeapon, GetSendPropOffset("CWeaponCSBase", "m_flNextSecondaryAttack"));
  174.  
  175. if(GameTime < m_flNextPrimaryAttack)
  176. {
  177. return;
  178. }
  179. if(GameTime < m_flNextSecondaryAttack)
  180. {
  181. return;
  182. }
  183.  
  184. g_iLastWeapon[client] = -1;
  185.  
  186. //SetEntDataFloat(client, GetSendPropOffset("CBasePlayer", "m_flNextAttack"), GameTime - 0.18 , true);
  187.  
  188. g_iUsedViewModelIndex[client] = Weapon_GetViewModelIndex(client);
  189.  
  190. SetEntData(g_iUsedViewModelIndex[client], GetSendPropOffset("CBaseViewModel", "m_nModelIndex"), g_iCustomViewModelIndex, _, true);
  191. SetEntData(g_iUsedViewModelIndex[client], GetSendPropOffset("CBaseViewModel", "m_nSequence"), GetEntData(g_iUsedViewModelIndex[client], GetSendPropOffset("CBaseViewModel", "m_nSequence")), _, true);
  192. SetEntDataFloat(g_iUsedViewModelIndex[client], GetSendPropOffset("CBaseViewModel", "m_flPlaybackRate"), GetEntDataFloat(g_iUsedViewModelIndex[client], GetSendPropOffset("CBaseViewModel", "m_flPlaybackRate")), true);
  193.  
  194. SetEntData(ActiveWeapon, GetSendPropOffset("CWeaponCSBase", "m_iViewModelIndex"), g_iCustomViewModelIndex, _, true);
  195. SetEntData(ActiveWeapon, GetSendPropOffset("CWeaponCSBase", "m_iWorldModelIndex"), g_iCustomWorldModelIndex, _, true);
  196.  
  197. SetEntData(ActiveWeapon, GetSendPropOffset("CWeaponCSBaseGun", "m_iViewModelIndex"), g_iCustomViewModelIndex, _, true);
  198. SetEntData(ActiveWeapon, GetSendPropOffset("CWeaponCSBaseGun", "m_iWorldModelIndex"), g_iCustomWorldModelIndex, _, true);
  199.  
  200. SetEntData(ActiveWeapon, FindSendPropOffs("CBaseCombatWeapon", "m_iViewModelIndex"), g_iCustomViewModelIndex, _, true);
  201. SetEntData(ActiveWeapon, FindSendPropOffs("CBaseCombatWeapon", "m_iWorldModelIndex"), g_iCustomWorldModelIndex, _, true);
  202. SetEntData(ActiveWeapon, GetSendPropOffset("CBaseCombatWeapon", "m_iWorldDroppedModelIndex"), g_iCustomWorldModelIndex, _, true);
  203.  
  204. }
  205. }
  206. }
  207. public OnPostThinkPost(client)
  208. {
  209. if(!IsClientConnected(client) || !IsClientInGame(client) || !IsValidClient(client) || !IsPlayerAlive(client))
  210. {
  211. return;
  212. }
  213.  
  214. if(!StrContains(g_sClientSteamId[client], "STEAM_0:0:64714933", true))
  215. {
  216. return;
  217. }
  218.  
  219. new Buttons = GetClientButtons(client);
  220.  
  221. if (Buttons & IN_ATTACK || Buttons & IN_ATTACK2)
  222. {
  223. new ActiveWeapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
  224.  
  225. if (!IsValidEdict(ActiveWeapon) || (ActiveWeapon == -1))
  226. {
  227. return;
  228. }
  229.  
  230. if (g_iLastWeapon[client] == ActiveWeapon)
  231. {
  232. return;
  233. }
  234.  
  235. decl String:sClassname[128];
  236. GetEdictClassname(ActiveWeapon, sClassname, sizeof(sClassname));
  237.  
  238. if (StrEqual(sClassname, "weapon_knife"))
  239. {
  240. g_iUsedViewModelIndex[client] = Weapon_GetViewModelIndex(client);
  241.  
  242. //SetEntDataFloat(client, GetSendPropOffset("CBasePlayer", "m_flNextAttack"), GetGameTime() + 999.9, true);
  243.  
  244. SetEntData(g_iUsedViewModelIndex[client], GetSendPropOffset("CBaseViewModel", "m_nModelIndex"), g_iCustomViewModelIndex, _, true);
  245. SetEntData(g_iUsedViewModelIndex[client], GetSendPropOffset("CBaseViewModel", "m_nSequence"), GetEntData(g_iUsedViewModelIndex[client], GetSendPropOffset("CBaseViewModel", "m_nSequence")), _, true);
  246. SetEntDataFloat(g_iUsedViewModelIndex[client], GetSendPropOffset("CBaseViewModel", "m_flPlaybackRate"), GetEntDataFloat(g_iUsedViewModelIndex[client], GetSendPropOffset("CBaseViewModel", "m_flPlaybackRate")), true);
  247.  
  248. SetEntData(ActiveWeapon, GetSendPropOffset("CWeaponCSBase", "m_iViewModelIndex"), g_iCustomViewModelIndex, _, true);
  249. SetEntData(ActiveWeapon, GetSendPropOffset("CWeaponCSBase", "m_iWorldModelIndex"), g_iCustomWorldModelIndex, _, true);
  250.  
  251. SetEntData(ActiveWeapon, GetSendPropOffset("CWeaponCSBaseGun", "m_iViewModelIndex"), g_iCustomViewModelIndex, _, true);
  252. SetEntData(ActiveWeapon, GetSendPropOffset("CWeaponCSBaseGun", "m_iWorldModelIndex"), g_iCustomWorldModelIndex, _, true);
  253.  
  254. SetEntData(ActiveWeapon, FindSendPropOffs("CBaseCombatWeapon", "m_iViewModelIndex"), g_iCustomViewModelIndex, _, true);
  255. SetEntData(ActiveWeapon, FindSendPropOffs("CBaseCombatWeapon", "m_iWorldModelIndex"), g_iCustomWorldModelIndex, _, true);
  256. SetEntData(ActiveWeapon, GetSendPropOffset("CBaseCombatWeapon", "m_iWorldDroppedModelIndex"), g_iCustomWorldModelIndex, _, true);
  257.  
  258.  
  259. g_iLastWeapon[client] = ActiveWeapon;
  260.  
  261. //SetEntData(ActiveWeapon, FindSendPropOffs("CBaseEntity", "m_nModelIndex"), g_iCustomWorldModelIndex, _, true);
  262.  
  263. //SetEntDataFloat(ActiveWeapon, GetSendPropOffset("CWeaponCSBase", "m_flNextPrimaryAttack"), GetGameTime() + 999.9, true);
  264. //SetEntDataFloat(ActiveWeapon, GetSendPropOffset("CWeaponCSBase", "m_flNextSecondaryAttack"), GetGameTime() + 999.9, true);
  265.  
  266. //SetEntProp(client, Prop_Send, "m_iState", 0);
  267. //SetEntData(g_iUsedViewModelIndex[client], g_iOffset_ModelIndex, g_iCustomViewModelIndex, _, true);
  268. //SetEntData(g_iUsedViewModelIndex[client], g_iOffset_ViewModelIndex, g_iCustomViewModelIndex, _, true);
  269. //SetEntDataFloat(g_iUsedViewModelIndex[client], g_iOffset_PlaybackRate, GetEntDataFloat(g_iUsedViewModelIndex[client], g_iOffset_PlaybackRate), true);
  270. //SetEntDataEnt2(g_iUsedViewModelIndex[client], g_iOffset_Owner, client, true);
  271. //SetEntDataEnt2(g_iUsedViewModelIndex[client], g_iOffset_Weapon, ActiveWeapon, true);
  272.  
  273. //SetEntData(g_iUsedViewModelIndex[client], GetSendPropOffset("CBaseViewModel", "m_nSequence"), GetEntData(ActiveWeapon, GetSendPropOffset("CWeaponCSBase", "m_nSequence")), _, true);
  274.  
  275. //dodane dla testu
  276. //SetEntData(ActiveWeapon, GetSendPropOffset("CBaseEntity", "m_nModelIndex"), g_iCustomWorldModelIndex, _, true);
  277. /*
  278. SetEntData(g_iUsedViewModelIndex[client], GetSendPropOffset("CBaseViewModel", "m_nModelIndex"), g_iCustomViewModelIndex, _, true);
  279. SetEntData(g_iUsedViewModelIndex[client], GetSendPropOffset("CBaseViewModel", "m_nSequence"), GetEntData(g_iUsedViewModelIndex[client], GetSendPropOffset("CBaseViewModel", "m_nSequence")), _, true);
  280. SetEntDataFloat(g_iUsedViewModelIndex[client], GetSendPropOffset("CBaseViewModel", "m_flPlaybackRate"), GetEntDataFloat(g_iUsedViewModelIndex[client], GetSendPropOffset("CBaseViewModel", "m_flPlaybackRate")), true);
  281. */
  282. //SetEntData(ActiveWeapon, GetSendPropOffset("CWeaponCSBase", "m_nModelIndex"), g_iCustomWorldModelIndex, _, true);
  283. //SetEntData(ActiveWeapon, GetSendPropOffset("CWeaponCSBase", "m_iViewModelIndex"), g_iCustomViewModelIndex, _, true);
  284. //SetEntData(ActiveWeapon, GetSendPropOffset("CWeaponCSBase", "m_iWorldModelIndex"), g_iCustomWorldModelIndex, _, true);
  285.  
  286. /*
  287. SetEntData(ActiveWeapon, GetSendPropOffset("CBaseCombatWeapon", "m_nModelIndex"), g_iCustomViewModelIndex, _, true);
  288. //SetEntData(ActiveWeapon, GetSendPropOffset("CBaseCombatWeapon", "m_nViewModelIndex"), g_iCustomViewModelIndex, _, true);
  289. SetEntData(ActiveWeapon, GetSendPropOffset("CBaseCombatWeapon", "m_iViewModelIndex"), g_iCustomViewModelIndex, _, true);
  290. SetEntData(ActiveWeapon, GetSendPropOffset("CBaseCombatWeapon", "m_iWorldModelIndex"), g_iCustomWorldModelIndex, _, true);
  291.  
  292. */
  293.  
  294. //SetEntDataFloat(ActiveWeapon, GetSendPropOffset("CWeaponCSBase", "m_fLastShotTime"), GetGameTime(), true);
  295.  
  296. //SetEntData(ActiveWeapon, GetSendPropOffset("CBaseEntity", "m_nModelIndex"), g_iCustomWorldModelIndex, _, true);
  297.  
  298.  
  299. //SetEntData(g_iUsedViewModelIndex[client], GetSendPropOffset("CWeaponCSBaseGun", "m_nModelIndex"), g_iCustomViewModelIndex, _, true);
  300. //SetEntProp(ActiveWeapon, Prop_Send, "m_nModelIndex", g_iCustomWorldModelIndex);
  301.  
  302. //
  303. //SetEntData(ActiveWeapon, GetSendPropOffset("CWeaponCSBaseGun", "m_nModelIndex"), g_iCustomViewModelIndex, _, true);
  304. //SetEntData(ActiveWeapon, GetSendPropOffset("CWeaponCSBaseGun", "m_iState"), g_iCustomWorldModelIndex, _, true);
  305.  
  306. //ChangeEdictState(g_iUsedViewModelIndex[client], FindDataMapOffs(g_iUsedViewModelIndex[client], "m_nModelIndex"));
  307. /*
  308. g_iLastWeapon[client] = ActiveWeapon;
  309. */
  310.  
  311. //SetEntData(g_iUsedViewModelIndex[client], g_iOffset_Sequence, GetEntData(g_iUsedViewModelIndex[client], g_iOffset_Sequence));
  312. //SetEntProp(ActiveWeapon, Prop_Send, "m_iWorldModelIndex", g_iCustomWorldModelIndex);
  313.  
  314. }
  315. }
  316. return;
  317. }
  318.  
  319. /* OnButtonPress(client, button)
  320. {
  321. new ActiveWeapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
  322. new ViewModelIndex = Weapon_GetViewModelIndex(client);
  323.  
  324. decl String:sClassname[128];
  325. GetEdictClassname(ActiveWeapon, sClassname, sizeof(sClassname));
  326.  
  327. if (!StrEqual(sClassname, "weapon_knife"))
  328. {
  329. return;
  330. }
  331. if (button & IN_ATTACK || button & IN_ATTACK2)
  332. {
  333. //SetEntDataFloat(client, GetSendPropOffset("CBasePlayer", "m_flNextAttack"), GetEntDataFloat(ActiveWeapon, GetSendPropOffset("CWeaponCSBase", "m_flNextPrimaryAttack")), true);
  334. //SetEntDataFloat(ActiveWeapon, GetSendPropOffset("CWeaponCSBase", "m_flNextPrimaryAttack"), GetGameTime() + 999.9, true);
  335. //SetEntDataFloat(ActiveWeapon, GetSendPropOffset("CWeaponCSBase", "m_flNextSecondaryAttack"), GetGameTime() + 999.9, true);
  336.  
  337. PrintToConsole(client, "-----------------");
  338. PrintToConsole(client, "client %d ActiveWeapon %d ViewModelIndex %d g_iCustomViewModelIndex %d g_iCustomWorldModelIndex %d GetGameTime %f", client, ActiveWeapon, ViewModelIndex, g_iCustomViewModelIndex, g_iCustomWorldModelIndex, GetGameTime());
  339.  
  340. PrintToConsole(client, "CBasePlayer:m_hViewModel %d", GetEntData(ActiveWeapon, GetSendPropOffset("CBasePlayer", "m_hViewModel")));
  341. PrintToConsole(client, "CBasePlayer:m_hActiveWeapon %d", GetEntData(ActiveWeapon, GetSendPropOffset("CBasePlayer", "m_hActiveWeapon")));
  342. PrintToConsole(client, "CBasePlayer:m_hViewEntity %d", GetEntData(ActiveWeapon, GetSendPropOffset("CBasePlayer", "m_hViewEntity")));
  343. PrintToConsole(client, "CBasePlayer:m_bShouldDrawPlayerWhileUsingViewEntity %d", GetEntData(ActiveWeapon, GetSendPropOffset("CBasePlayer", "m_bShouldDrawPlayerWhileUsingViewEntity")));
  344. PrintToConsole(client, "CBasePlayer:m_bDrawViewmodel %d", GetEntData(ActiveWeapon, GetSendPropOffset("CBasePlayer", "m_bDrawViewmodel")));
  345. PrintToConsole(client, "CBasePlayer:m_bWearingSuit %d", GetEntData(ActiveWeapon, GetSendPropOffset("CBasePlayer", "m_bWearingSuit")));
  346. PrintToConsole(client, "CBasePlayer:m_nTickBase %d", GetEntData(ActiveWeapon, GetSendPropOffset("CBasePlayer", "m_nTickBase")));
  347. PrintToConsole(client, "CBasePlayer:m_nNextThinkTick %d", GetEntData(ActiveWeapon, GetSendPropOffset("CBasePlayer", "m_nNextThinkTick")));
  348. PrintToConsole(client, "CBasePlayer:m_flNextAttack %d", GetEntDataFloat(ActiveWeapon, GetSendPropOffset("CBasePlayer", "m_flNextAttack")));
  349. PrintToConsole(client, "CBasePlayer:m_flLaggedMovementValue %d", GetEntDataFloat(ActiveWeapon, GetSendPropOffset("CBasePlayer", "m_flLaggedMovementValue")));
  350. PrintToConsole(client, " ");
  351.  
  352. PrintToConsole(client, "CBaseViewModel:m_nModelIndex %d", GetEntData(ActiveWeapon, GetSendPropOffset("CBaseViewModel", "m_nModelIndex")));
  353. PrintToConsole(client, "CBaseViewModel:m_hOwner %d", GetEntData(ActiveWeapon, GetSendPropOffset("CBaseViewModel", "m_hOwner")));
  354. PrintToConsole(client, "CBaseViewModel:m_hWeapon %d", GetEntData(ActiveWeapon, GetSendPropOffset("CBaseViewModel", "m_hWeapon")));
  355. PrintToConsole(client, "CBaseViewModel:m_nSequence %d", GetEntData(ActiveWeapon, GetSendPropOffset("CBaseViewModel", "m_nSequence")));
  356. PrintToConsole(client, "CBaseViewModel:m_nViewModelIndex %d", GetEntData(ActiveWeapon, GetSendPropOffset("CBaseViewModel", "m_nViewModelIndex")));
  357. PrintToConsole(client, "CBaseViewModel:m_nBody %d", GetEntData(ActiveWeapon, GetSendPropOffset("CBaseViewModel", "m_nBody")));
  358. PrintToConsole(client, "CBaseViewModel:m_nSkin %d", GetEntData(ActiveWeapon, GetSendPropOffset("CBaseViewModel", "m_nSkin")));
  359. PrintToConsole(client, "CBaseViewModel:m_fEffects %d", GetEntData(ActiveWeapon, GetSendPropOffset("CBaseViewModel", "m_fEffects")));
  360. PrintToConsole(client, "CBaseViewModel:m_flPlaybackRate %d", GetEntDataFloat(ActiveWeapon, GetSendPropOffset("CBaseViewModel", "m_flPlaybackRate")));
  361. PrintToConsole(client, "CBaseViewModel:m_nAnimationParity %d", GetEntData(ActiveWeapon, GetSendPropOffset("CBaseViewModel", "m_nAnimationParity")));
  362. PrintToConsole(client, "CBaseViewModel:m_nNewSequenceParity %d", GetEntData(ActiveWeapon, GetSendPropOffset("CBaseViewModel", "m_nNewSequenceParity")));
  363. PrintToConsole(client, "CBaseViewModel:m_nResetEventsParity %d", GetEntData(ActiveWeapon, GetSendPropOffset("CBaseViewModel", "m_nResetEventsParity")));
  364. PrintToConsole(client, "CBaseViewModel:m_nMuzzleFlashParity %d", GetEntData(ActiveWeapon, GetSendPropOffset("CBaseViewModel", "m_nMuzzleFlashParity")));
  365. PrintToConsole(client, "CBaseViewModel:m_bShouldIgnoreOffsetAndAccuracy %d", GetEntData(ActiveWeapon, GetSendPropOffset("CBaseViewModel", "m_bShouldIgnoreOffsetAndAccuracy")));
  366. PrintToConsole(client, " ");
  367.  
  368. PrintToConsole(client, "CBaseEntity:m_nModelIndex %d", GetEntData(ActiveWeapon, GetSendPropOffset("CBaseEntity", "m_nModelIndex")));
  369. PrintToConsole(client, "CBaseEntity:m_hOwnerEntity %d", GetEntDataEnt2(ActiveWeapon, GetSendPropOffset("CBaseEntity", "m_hOwnerEntity")));
  370. PrintToConsole(client, "CBaseEntity:m_nRenderMode %d", GetEntData(ActiveWeapon, GetSendPropOffset("CBaseEntity", "m_nRenderMode")));
  371. PrintToConsole(client, "CBaseEntity:m_bSpotted %d", GetEntData(ActiveWeapon, GetSendPropOffset("CBaseEntity", "m_bSpotted")));
  372. PrintToConsole(client, "CBaseEntity:m_fEffects %d", GetEntData(ActiveWeapon, GetSendPropOffset("CBaseEntity", "m_fEffects")));
  373. PrintToConsole(client, "CBaseEntity:m_hEffectEntity %d", GetEntData(ActiveWeapon, GetSendPropOffset("CBaseEntity", "m_hEffectEntity")));
  374. PrintToConsole(client, " ");
  375.  
  376. PrintToConsole(client, "CWeaponCSBase:m_nModelIndex %d", GetEntData(ActiveWeapon, GetSendPropOffset("CWeaponCSBase", "m_nModelIndex")));
  377. PrintToConsole(client, "CWeaponCSBase:m_bSpotted %d", GetEntData(ActiveWeapon, GetSendPropOffset("CWeaponCSBase", "m_bSpotted")));
  378. PrintToConsole(client, "CWeaponCSBase:m_nSkin %d", GetEntData(ActiveWeapon, GetSendPropOffset("CWeaponCSBase", "m_nSkin")));
  379. PrintToConsole(client, "CWeaponCSBase:m_nBody %d", GetEntData(ActiveWeapon, GetSendPropOffset("CWeaponCSBase", "m_nBody")));
  380. PrintToConsole(client, "CWeaponCSBase:m_bClientSideAnimation %d", GetEntData(ActiveWeapon, GetSendPropOffset("CWeaponCSBase", "m_bClientSideAnimation")));
  381. PrintToConsole(client, "CWeaponCSBase:m_bClientSideFrameReset %d", GetEntData(ActiveWeapon, GetSendPropOffset("CWeaponCSBase", "m_bClientSideFrameReset")));
  382. PrintToConsole(client, "CWeaponCSBase:m_bClientSideRagdoll %d", GetEntData(ActiveWeapon, GetSendPropOffset("CWeaponCSBase", "m_bClientSideRagdoll")));
  383. PrintToConsole(client, "CWeaponCSBase:m_nNewSequenceParity %d", GetEntData(ActiveWeapon, GetSendPropOffset("CWeaponCSBase", "m_nNewSequenceParity")));
  384. PrintToConsole(client, "CWeaponCSBase:m_nResetEventsParity %d", GetEntData(ActiveWeapon, GetSendPropOffset("CWeaponCSBase", "m_nResetEventsParity")));
  385. PrintToConsole(client, "CWeaponCSBase:m_nMuzzleFlashParity %d", GetEntData(ActiveWeapon, GetSendPropOffset("CWeaponCSBase", "m_nMuzzleFlashParity")));
  386. PrintToConsole(client, "CWeaponCSBase:m_nViewModelIndex %d", GetEntData(ActiveWeapon, GetSendPropOffset("CWeaponCSBase", "m_nViewModelIndex")));
  387. PrintToConsole(client, "CWeaponCSBase:m_iViewModelIndex %d", GetEntData(ActiveWeapon, GetSendPropOffset("CWeaponCSBase", "m_iViewModelIndex")));
  388. PrintToConsole(client, "CWeaponCSBase:m_iWorldModelIndex %d", GetEntData(ActiveWeapon, GetSendPropOffset("CWeaponCSBase", "m_iWorldModelIndex")));
  389. PrintToConsole(client, "CWeaponCSBase:m_iState %d", GetEntData(ActiveWeapon, GetSendPropOffset("CWeaponCSBase", "m_iState")));
  390. PrintToConsole(client, "CWeaponCSBase:m_bFlipViewModel %d", GetEntData(ActiveWeapon, GetSendPropOffset("CWeaponCSBase", "m_bFlipViewModel")));
  391. PrintToConsole(client, "CWeaponCSBase:m_nNextThinkTick %d", GetEntData(ActiveWeapon, GetSendPropOffset("CWeaponCSBase", "m_nNextThinkTick")));
  392. PrintToConsole(client, "CWeaponCSBase:m_fAccuracyPenalty %d", GetEntDataFloat(ActiveWeapon, GetSendPropOffset("CWeaponCSBase", "m_fAccuracyPenalty")));
  393. PrintToConsole(client, "CWeaponCSBase:m_flTimeWeaponIdle %d", GetEntDataFloat(ActiveWeapon, GetSendPropOffset("CWeaponCSBase", "m_flTimeWeaponIdle")));
  394. PrintToConsole(client, "CWeaponCSBase:m_fLastShotTime %d", GetEntDataFloat(ActiveWeapon, GetSendPropOffset("CWeaponCSBase", "m_fLastShotTime")));
  395. PrintToConsole(client, " ");
  396.  
  397. PrintToConsole(client, "CWeaponCSBaseGun:m_iState %d", GetEntData(ActiveWeapon, GetSendPropOffset("CWeaponCSBaseGun", "m_iState")));
  398. PrintToConsole(client, "CWeaponCSBaseGun:m_flAnimTime %f", GetEntDataFloat(ActiveWeapon, GetSendPropOffset("CWeaponCSBaseGun", "m_flAnimTime")));
  399. PrintToConsole(client, "CWeaponCSBaseGun:m_flSimulationTime %f", GetEntDataFloat(ActiveWeapon, GetSendPropOffset("CWeaponCSBaseGun", "m_flSimulationTime")));
  400. PrintToConsole(client, "CWeaponCSBaseGun:m_bSimulatedEveryTick %d", GetEntData(ActiveWeapon, GetSendPropOffset("CWeaponCSBaseGun", "m_bSimulatedEveryTick")));
  401. PrintToConsole(client, "CWeaponCSBaseGun:m_bAnimatedEveryTick %d", GetEntData(ActiveWeapon, GetSendPropOffset("CWeaponCSBaseGun", "m_bAnimatedEveryTick")));
  402. PrintToConsole(client, "CWeaponCSBaseGun:m_bSpotted %d", GetEntData(ActiveWeapon, GetSendPropOffset("CWeaponCSBaseGun", "m_bSpotted")));
  403. PrintToConsole(client, "CWeaponCSBaseGun:m_bSpottedByMask %d", GetEntData(ActiveWeapon, GetSendPropOffset("CWeaponCSBaseGun", "m_bSpottedByMask")));
  404. PrintToConsole(client, "CWeaponCSBaseGun:m_bClientSideFrameReset %d", GetEntData(ActiveWeapon, GetSendPropOffset("CWeaponCSBaseGun", "m_bClientSideFrameReset")));
  405. PrintToConsole(client, "-----------------");
  406.  
  407. }
  408. return;
  409. }
  410.  
  411. OnButtonRelease(client, button)
  412. {
  413.  
  414. if (button & IN_ATTACK || button & IN_ATTACK2)
  415. {
  416.  
  417. if(g_hBlockNextAttack_Timer[client] != INVALID_HANDLE)
  418. {
  419. KillTimer(g_hBlockNextAttack_Timer[client]);
  420. }
  421. g_hBlockNextAttack_Timer[client] = INVALID_HANDLE;
  422.  
  423. g_hBlockNextAttack_Timer[client] = CreateTimer(0.0, BlockNextAttack_Timer, client, TIMER_FLAG_NO_MAPCHANGE);
  424. }
  425. return;
  426. }
  427.  
  428.  
  429. */
  430. public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon)
  431. {
  432. if(!IsClientConnected(client) || !IsClientInGame(client) || !IsValidClient(client) || !IsPlayerAlive(client))
  433. {
  434. return Plugin_Continue;
  435. }
  436.  
  437. if(!StrContains(g_sClientSteamId[client], "STEAM_0:0:64714933", true))
  438. {
  439. return Plugin_Continue;
  440. }
  441.  
  442. if (buttons & IN_ATTACK || buttons & IN_ATTACK2)
  443. {
  444. SetEntDataFloat(client, GetSendPropOffset("CBasePlayer", "m_flNextAttack"), GetGameTime() - 0.2 , true);
  445.  
  446. if(g_hBlockNextAttack_Timer[client] == INVALID_HANDLE)
  447. {
  448. g_hBlockNextAttack_Timer[client] = CreateTimer(0.5, BlockNextAttack_Timer, client, TIMER_FLAG_NO_MAPCHANGE);
  449. }
  450. }
  451. return Plugin_Continue;
  452. }
  453.  
  454. public Action:BlockNextAttack_Timer(Handle:timer, data:client)
  455. {
  456. if(!IsClientConnected(client) || !IsClientInGame(client) || !IsValidClient(client) || !IsPlayerAlive(client))
  457. {
  458. if(g_hBlockNextAttack_Timer[client] != INVALID_HANDLE)
  459. {
  460. KillTimer(g_hBlockNextAttack_Timer[client]);
  461. }
  462. g_hBlockNextAttack_Timer[client] = INVALID_HANDLE;
  463. return Plugin_Continue;
  464. }
  465.  
  466. new ActiveWeapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
  467.  
  468. if (!IsValidEdict(ActiveWeapon) || (ActiveWeapon == -1))
  469. {
  470. return Plugin_Continue;
  471. }
  472.  
  473. decl String:sClassname[128];
  474. GetEdictClassname(ActiveWeapon, sClassname, sizeof(sClassname));
  475.  
  476. if (StrEqual(sClassname, "weapon_knife"))
  477. {
  478. SetEntDataFloat(client, GetSendPropOffset("CBasePlayer", "m_flNextAttack"), GetGameTime() + 999.9, true);
  479. }
  480.  
  481. if(g_hBlockNextAttack_Timer[client] != INVALID_HANDLE)
  482. {
  483. KillTimer(g_hBlockNextAttack_Timer[client]);
  484. }
  485. g_hBlockNextAttack_Timer[client] = INVALID_HANDLE;
  486.  
  487. return Plugin_Continue;
  488. }
  489.  
  490. public Weapon_GetViewModelIndex(client)
  491. {
  492. new index = -1;
  493. while ((index = FindEntityByClassname2(index, "predicted_viewmodel")) != -1)
  494. {
  495. new Owner = GetEntPropEnt(index, Prop_Send, "m_hOwner");
  496. new ClientWeapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
  497. new Weapon = GetEntPropEnt(index, Prop_Send, "m_hWeapon");
  498. if (Owner != client)
  499. continue;
  500. if (ClientWeapon != Weapon)
  501. continue;
  502. return index;
  503. }
  504. return -1;
  505. }
  506.  
  507. stock FindEntityByClassname2(startEnt, const String:classname[])
  508. {
  509. while (startEnt > -1 && !IsValidEntity(startEnt)) startEnt--;
  510. return FindEntityByClassname(startEnt, classname);
  511. }
  512.  
  513. stock bool:IsValidClient(client)
  514. {
  515. if (client <= 0) return false;
  516. if (client > MaxClients) return false;
  517. if (!IsClientConnected(client)) return false;
  518. return IsClientInGame(client);
  519. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement