Advertisement
Guest User

Untitled

a guest
Aug 1st, 2020
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.84 KB | None | 0 0
  1. #include <sourcemod>
  2.  
  3. #include <msharedutil/misc>
  4.  
  5. #include <sourcecolors>
  6. #include <clientprefs>
  7. #include <sdktools_functions>
  8. #include <fpvm_interface>
  9.  
  10. #pragma tabsize 0
  11. #include <sdktools>
  12. #include <weapons>
  13. #include <sdkhooks>
  14.  
  15. #define WEAPON "weapon_knife"
  16.  
  17. Handle g_hMyCookie;
  18. int g_ClientSkin[MAXPLAYERS + 1];
  19.  
  20. public Plugin myinfo =
  21. {
  22. author = "Shaggy",
  23. name = "VIP Menu",
  24. description = "Displays a vip menu with custom knives."
  25. };
  26.  
  27. int numarSkinuri = 14;
  28. int num = 0;
  29. char skinuri[14][32] = {"Cutit normal", "Topor", "Ciocan", "Cutit de Aur", "Topor Volcano", "Ciocan de fier", "Ustensila ascutita", "Cheie tubulara", "Pompa de toaleta", "Satar", "Topor stralucitor", "Buzdugan", "Baston de jandarm", "Bayonet"};
  30. char skinPaths[14][300] = {"",
  31. "models/weapons/eminem/csgo_knives/v_axe.mdl",
  32. "models/weapons/eminem/csgo_knives/v_hammer.mdl",
  33. "models/weapons/eminem/csgo_knives/v_golden_knife_ct.mdl",
  34. "models/weapons/eminem/sharpened_volcano_fragment/v_sharpened_volcano_fragment.mdl",
  35. "models/weapons/eminem/drive_hammer/v_drive_hammer.mdl",
  36. "models/weapons/eminem/pipe_axe/v_pipe_axe.mdl",
  37. "models/weapons/eminem/pipe_wrench/v_pipe_wrench.mdl",
  38. "models/weapons/eminem/plunger/v_plunger.mdl",
  39. "models/weapons/eminem/old_cleaver/v_old_cleaver.mdl",
  40. "models/weapons/eminem/shining_axe/v_shining_axe.mdl",
  41. "models/weapons/eminem/mad_can/v_mad_can.mdl",
  42. "models/weapons/eminem/wooden_jutte/v_wooden_jutte.mdl",
  43. ""};
  44. char skinPathsWorld[14][300] = {"",
  45. "models/weapons/eminem/csgo_knives/v_axe.mdl",
  46. "models/weapons/eminem/csgo_knives/v_hammer.mdl",
  47. "models/weapons/eminem/csgo_knives/w_golden_knife_ct.mdl",
  48. "models/weapons/eminem/sharpened_volcano_fragment/w_sharpened_volcano_fragment.mdl",
  49. "models/weapons/eminem/drive_hammer/w_drive_hammer.mdl",
  50. "models/weapons/eminem/pipe_axe/w_pipe_axe.mdl",
  51. "models/weapons/eminem/pipe_wrench/w_pipe_wrench.mdl",
  52. "models/weapons/eminem/plunger/w_plunger.mdl",
  53. "models/weapons/eminem/old_cleaver/w_old_cleaver.mdl",
  54. "models/weapons/eminem/shining_axe/w_shining_axe.mdl",
  55. "models/weapons/eminem/mad_can/w_mad_can.mdl",
  56. "models/weapons/eminem/wooden_jutte/w_wooden_jutte.mdl",
  57. ""};
  58. char skinPathsDropped[14][300] = {"",
  59. "models/weapons/eminem/csgo_knives/v_axe.mdl",
  60. "models/weapons/eminem/csgo_knives/v_hammer.mdl",
  61. "models/weapons/eminem/csgo_knives/w_golden_knife_ct_dropped.mdl",
  62. "models/weapons/eminem/sharpened_volcano_fragment/w_sharpened_volcano_fragment_dropped.mdl",
  63. "models/weapons/eminem/drive_hammer/w_drive_hammer_dropped.mdl",
  64. "models/weapons/eminem/pipe_axe/w_pipe_axe_dropped.mdl",
  65. "models/weapons/eminem/pipe_wrench/w_pipe_wrench_dropped.mdl",
  66. "models/weapons/eminem/plunger/w_plunger_dropped.mdl",
  67. "models/weapons/eminem/old_cleaver/w_old_cleaver_dropped.mdl",
  68. "models/weapons/eminem/shining_axe/w_shining_axe_dropped.mdl",
  69. "models/weapons/eminem/mad_can/w_mad_can_dropped.mdl",
  70. "models/weapons/eminem/wooden_jutte/w_wooden_jutte_dropped.mdl",
  71. ""};
  72. int g_Models[14], g_ModelsWorld[14], g_ModelsDropped[14];
  73.  
  74. Menu menu2;
  75. char sCookieValue[12];
  76.  
  77. public void OnPluginStart()
  78. {
  79.  
  80.  
  81. g_hMyCookie = RegClientCookie("myplugin_mycookie", "MyPlugin MyCookie", CookieAccess_Protected);
  82.  
  83. HookEvent("player_spawn", AssignSkins);
  84.  
  85. RegAdminCmd( "sm_vipknife", Cmd_Vipmenu, ADMFLAG_CUSTOM6 );
  86. }
  87.  
  88. public Action:AssignSkins(Handle:event,const String:name[],bool:dontBroadcast)
  89. {
  90. new client_id = GetEventInt(event, "userid");
  91. new client = GetClientOfUserId(client_id);
  92.  
  93. if (client >= 1 && IsClientInGame( client ) )
  94. {
  95. CreateTimer(0.1, AssignActualSkins, client, TIMER_FLAG_NO_MAPCHANGE);
  96. }
  97. }
  98.  
  99. public Action:AssignActualSkins(Handle:timer, any:client)
  100. {
  101. if (CheckCommandAccess(client, "CheckVIP", ADMFLAG_CUSTOM6, true) && g_ClientSkin[client] != 13)
  102. {
  103. FPVMI_RemoveViewModelToClient(client, "weapon_knife");
  104. FPVMI_AddViewModelToClient(client, WEAPON, g_Models[g_ClientSkin[client]]); // add custom view model to the player
  105. FPVMI_AddWorldModelToClient(client, WEAPON, g_ModelsWorld[g_ClientSkin[client]]); // add custom world model to the player
  106. FPVMI_AddDropModelToClient(client, WEAPON, skinPathsDropped[g_ClientSkin[client]]); // add custom drop model
  107.  
  108. }
  109. else if (CheckCommandAccess(client, "CheckVIP", ADMFLAG_CUSTOM6, true) && g_ClientSkin[client] == 13) {
  110. PrintToChat(client, "You are using Bayonet");
  111.  
  112.  
  113. int weapon = GetPlayerWeaponSlot(client, 2);
  114. if (weapon != -1)
  115. {
  116. RemovePlayerItem(client, weapon);
  117. AcceptEntityInput(weapon, "KillHierarchy");
  118. }
  119. PrintToChat(client, "balbla");
  120. int bayonet = GivePlayerItem(client, "weapon_bayonet");
  121. EquipPlayerWeapon(client, bayonet);
  122. FakeClientCommand (client, "use weapon_knife");
  123. PrintToChat(client, "blabla");
  124. }
  125. }
  126.  
  127. public Action Cmd_Vipmenu( int client, int args )
  128. {
  129. if ( !client ) return Plugin_Handled;
  130. Show( client );
  131.  
  132. return Plugin_Handled;
  133. }
  134.  
  135.  
  136. public OnMapStart()
  137. {
  138. g_Models[0] = -1;
  139. int i;
  140. for (i = 1; i < numarSkinuri - 1; i ++)
  141. {
  142. g_Models[i] = PrecacheModel(skinPaths[i], true);
  143. g_ModelsWorld[i] = PrecacheModel(skinPathsWorld[i], true);
  144. g_ModelsDropped[i] = PrecacheModel(skinPathsDropped[i], true);
  145. }
  146. }
  147.  
  148. public void Show( int client )
  149. {
  150. if ( client < 1 || !IsClientInGame( client ) )
  151. {
  152. return;
  153. }
  154. char sir[500] = "VIP Menu\n";
  155. menu2 = new Menu( Hndlr_Vipmenu );
  156. menu2.SetTitle( sir );
  157. num = 0;
  158. while (num < numarSkinuri)
  159. {
  160. char szBoi[256];
  161. if (g_ClientSkin[client] != num)
  162. {
  163. FormatEx(szBoi, sizeof(szBoi), "%s", skinuri[num]);
  164. menu2.AddItem( "", szBoi, ITEMDRAW_DEFAULT );
  165. }
  166. else
  167. {
  168. FormatEx(szBoi, sizeof(szBoi), "%s", skinuri[num]);
  169. menu2.AddItem( "", szBoi, ITEMDRAW_DISABLED );
  170. }
  171. num ++;
  172. }
  173.  
  174.  
  175. menu2.Display( client, MENU_TIME_FOREVER );
  176. }
  177.  
  178. public int Hndlr_Vipmenu( Menu menu, MenuAction action, int client, int index )
  179. {
  180. switch (action)
  181. {
  182. case MenuAction_End:
  183. {
  184. delete menu;
  185. }
  186. case MenuAction_Select:
  187. {
  188. g_ClientSkin[client] = index;
  189. if (CheckCommandAccess(client, "CheckVIP", ADMFLAG_CUSTOM6, true) && g_ClientSkin[client] != 13)
  190. {
  191. FPVMI_RemoveViewModelToClient(client, "weapon_knife");
  192. FPVMI_AddViewModelToClient(client, WEAPON, g_Models[g_ClientSkin[client]]); // add custom view model to the player
  193. FPVMI_AddWorldModelToClient(client, WEAPON, g_ModelsWorld[g_ClientSkin[client]]); // add custom world model to the player
  194. FPVMI_AddDropModelToClient(client, WEAPON, skinPathsDropped[g_ClientSkin[client]]); // add custom drop model
  195.  
  196. }
  197. else if (CheckCommandAccess(client, "CheckVIP", ADMFLAG_CUSTOM6, true) && g_ClientSkin[client] == 13) {
  198. PrintToChat(client, "You are using Bayonet2");
  199. FPVMI_RemoveViewModelToClient(client, "weapon_knife");
  200. FPVMI_RemoveWorldModelToClient(client, "weapon_knife");
  201. FPVMI_RemoveDropModelToClient(client, "weapon_knife");
  202.  
  203. int weapon = GetPlayerWeaponSlot(client, 2);
  204. if (weapon != -1)
  205. {
  206. RemovePlayerItem(client, weapon);
  207. AcceptEntityInput(weapon, "KillHierarchy");
  208. }
  209.  
  210. int bayonet = GivePlayerItem(client, "weapon_bayonet");
  211. EquipPlayerWeapon(client, bayonet);
  212. FakeClientCommand (client, "use weapon_knife");
  213. }
  214. }
  215. }
  216. }
  217.  
  218. public void OnClientDisconnect( int client )
  219. {
  220. char ceva[50];
  221. IntToString(g_ClientSkin[client], ceva, 50);
  222. SetClientCookie(client, g_hMyCookie, ceva);
  223. }
  224.  
  225. public void OnClientPutInServer( int client )
  226. {
  227. GetClientCookie(client, g_hMyCookie, sCookieValue, sizeof(sCookieValue))
  228. int theSkin = StringToInt(sCookieValue);
  229. g_ClientSkin[client] = theSkin;
  230. }
  231.  
  232.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement