Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <msharedutil/misc>
- #include <sourcecolors>
- #include <clientprefs>
- #include <sdktools_functions>
- #include <fpvm_interface>
- #pragma tabsize 0
- #include <sdktools>
- #include <weapons>
- #include <sdkhooks>
- #define WEAPON "weapon_knife"
- Handle g_hMyCookie;
- int g_ClientSkin[MAXPLAYERS + 1];
- public Plugin myinfo =
- {
- author = "Shaggy",
- name = "VIP Menu",
- description = "Displays a vip menu with custom knives."
- };
- int numarSkinuri = 14;
- int num = 0;
- 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"};
- char skinPaths[14][300] = {"",
- "models/weapons/eminem/csgo_knives/v_axe.mdl",
- "models/weapons/eminem/csgo_knives/v_hammer.mdl",
- "models/weapons/eminem/csgo_knives/v_golden_knife_ct.mdl",
- "models/weapons/eminem/sharpened_volcano_fragment/v_sharpened_volcano_fragment.mdl",
- "models/weapons/eminem/drive_hammer/v_drive_hammer.mdl",
- "models/weapons/eminem/pipe_axe/v_pipe_axe.mdl",
- "models/weapons/eminem/pipe_wrench/v_pipe_wrench.mdl",
- "models/weapons/eminem/plunger/v_plunger.mdl",
- "models/weapons/eminem/old_cleaver/v_old_cleaver.mdl",
- "models/weapons/eminem/shining_axe/v_shining_axe.mdl",
- "models/weapons/eminem/mad_can/v_mad_can.mdl",
- "models/weapons/eminem/wooden_jutte/v_wooden_jutte.mdl",
- ""};
- char skinPathsWorld[14][300] = {"",
- "models/weapons/eminem/csgo_knives/v_axe.mdl",
- "models/weapons/eminem/csgo_knives/v_hammer.mdl",
- "models/weapons/eminem/csgo_knives/w_golden_knife_ct.mdl",
- "models/weapons/eminem/sharpened_volcano_fragment/w_sharpened_volcano_fragment.mdl",
- "models/weapons/eminem/drive_hammer/w_drive_hammer.mdl",
- "models/weapons/eminem/pipe_axe/w_pipe_axe.mdl",
- "models/weapons/eminem/pipe_wrench/w_pipe_wrench.mdl",
- "models/weapons/eminem/plunger/w_plunger.mdl",
- "models/weapons/eminem/old_cleaver/w_old_cleaver.mdl",
- "models/weapons/eminem/shining_axe/w_shining_axe.mdl",
- "models/weapons/eminem/mad_can/w_mad_can.mdl",
- "models/weapons/eminem/wooden_jutte/w_wooden_jutte.mdl",
- ""};
- char skinPathsDropped[14][300] = {"",
- "models/weapons/eminem/csgo_knives/v_axe.mdl",
- "models/weapons/eminem/csgo_knives/v_hammer.mdl",
- "models/weapons/eminem/csgo_knives/w_golden_knife_ct_dropped.mdl",
- "models/weapons/eminem/sharpened_volcano_fragment/w_sharpened_volcano_fragment_dropped.mdl",
- "models/weapons/eminem/drive_hammer/w_drive_hammer_dropped.mdl",
- "models/weapons/eminem/pipe_axe/w_pipe_axe_dropped.mdl",
- "models/weapons/eminem/pipe_wrench/w_pipe_wrench_dropped.mdl",
- "models/weapons/eminem/plunger/w_plunger_dropped.mdl",
- "models/weapons/eminem/old_cleaver/w_old_cleaver_dropped.mdl",
- "models/weapons/eminem/shining_axe/w_shining_axe_dropped.mdl",
- "models/weapons/eminem/mad_can/w_mad_can_dropped.mdl",
- "models/weapons/eminem/wooden_jutte/w_wooden_jutte_dropped.mdl",
- ""};
- int g_Models[14], g_ModelsWorld[14], g_ModelsDropped[14];
- Menu menu2;
- char sCookieValue[12];
- public void OnPluginStart()
- {
- g_hMyCookie = RegClientCookie("myplugin_mycookie", "MyPlugin MyCookie", CookieAccess_Protected);
- HookEvent("player_spawn", AssignSkins);
- RegAdminCmd( "sm_vipknife", Cmd_Vipmenu, ADMFLAG_CUSTOM6 );
- }
- public Action:AssignSkins(Handle:event,const String:name[],bool:dontBroadcast)
- {
- new client_id = GetEventInt(event, "userid");
- new client = GetClientOfUserId(client_id);
- if (client >= 1 && IsClientInGame( client ) )
- {
- CreateTimer(0.1, AssignActualSkins, client, TIMER_FLAG_NO_MAPCHANGE);
- }
- }
- public Action:AssignActualSkins(Handle:timer, any:client)
- {
- if (CheckCommandAccess(client, "CheckVIP", ADMFLAG_CUSTOM6, true) && g_ClientSkin[client] != 13)
- {
- FPVMI_RemoveViewModelToClient(client, "weapon_knife");
- FPVMI_AddViewModelToClient(client, WEAPON, g_Models[g_ClientSkin[client]]); // add custom view model to the player
- FPVMI_AddWorldModelToClient(client, WEAPON, g_ModelsWorld[g_ClientSkin[client]]); // add custom world model to the player
- FPVMI_AddDropModelToClient(client, WEAPON, skinPathsDropped[g_ClientSkin[client]]); // add custom drop model
- }
- else if (CheckCommandAccess(client, "CheckVIP", ADMFLAG_CUSTOM6, true) && g_ClientSkin[client] == 13) {
- PrintToChat(client, "You are using Bayonet");
- int weapon = GetPlayerWeaponSlot(client, 2);
- if (weapon != -1)
- {
- RemovePlayerItem(client, weapon);
- AcceptEntityInput(weapon, "KillHierarchy");
- }
- PrintToChat(client, "balbla");
- int bayonet = GivePlayerItem(client, "weapon_bayonet");
- EquipPlayerWeapon(client, bayonet);
- FakeClientCommand (client, "use weapon_knife");
- PrintToChat(client, "blabla");
- }
- }
- public Action Cmd_Vipmenu( int client, int args )
- {
- if ( !client ) return Plugin_Handled;
- Show( client );
- return Plugin_Handled;
- }
- public OnMapStart()
- {
- g_Models[0] = -1;
- int i;
- for (i = 1; i < numarSkinuri - 1; i ++)
- {
- g_Models[i] = PrecacheModel(skinPaths[i], true);
- g_ModelsWorld[i] = PrecacheModel(skinPathsWorld[i], true);
- g_ModelsDropped[i] = PrecacheModel(skinPathsDropped[i], true);
- }
- }
- public void Show( int client )
- {
- if ( client < 1 || !IsClientInGame( client ) )
- {
- return;
- }
- char sir[500] = "VIP Menu\n";
- menu2 = new Menu( Hndlr_Vipmenu );
- menu2.SetTitle( sir );
- num = 0;
- while (num < numarSkinuri)
- {
- char szBoi[256];
- if (g_ClientSkin[client] != num)
- {
- FormatEx(szBoi, sizeof(szBoi), "%s", skinuri[num]);
- menu2.AddItem( "", szBoi, ITEMDRAW_DEFAULT );
- }
- else
- {
- FormatEx(szBoi, sizeof(szBoi), "%s", skinuri[num]);
- menu2.AddItem( "", szBoi, ITEMDRAW_DISABLED );
- }
- num ++;
- }
- menu2.Display( client, MENU_TIME_FOREVER );
- }
- public int Hndlr_Vipmenu( Menu menu, MenuAction action, int client, int index )
- {
- switch (action)
- {
- case MenuAction_End:
- {
- delete menu;
- }
- case MenuAction_Select:
- {
- g_ClientSkin[client] = index;
- if (CheckCommandAccess(client, "CheckVIP", ADMFLAG_CUSTOM6, true) && g_ClientSkin[client] != 13)
- {
- FPVMI_RemoveViewModelToClient(client, "weapon_knife");
- FPVMI_AddViewModelToClient(client, WEAPON, g_Models[g_ClientSkin[client]]); // add custom view model to the player
- FPVMI_AddWorldModelToClient(client, WEAPON, g_ModelsWorld[g_ClientSkin[client]]); // add custom world model to the player
- FPVMI_AddDropModelToClient(client, WEAPON, skinPathsDropped[g_ClientSkin[client]]); // add custom drop model
- }
- else if (CheckCommandAccess(client, "CheckVIP", ADMFLAG_CUSTOM6, true) && g_ClientSkin[client] == 13) {
- PrintToChat(client, "You are using Bayonet2");
- FPVMI_RemoveViewModelToClient(client, "weapon_knife");
- FPVMI_RemoveWorldModelToClient(client, "weapon_knife");
- FPVMI_RemoveDropModelToClient(client, "weapon_knife");
- int weapon = GetPlayerWeaponSlot(client, 2);
- if (weapon != -1)
- {
- RemovePlayerItem(client, weapon);
- AcceptEntityInput(weapon, "KillHierarchy");
- }
- int bayonet = GivePlayerItem(client, "weapon_bayonet");
- EquipPlayerWeapon(client, bayonet);
- FakeClientCommand (client, "use weapon_knife");
- }
- }
- }
- }
- public void OnClientDisconnect( int client )
- {
- char ceva[50];
- IntToString(g_ClientSkin[client], ceva, 50);
- SetClientCookie(client, g_hMyCookie, ceva);
- }
- public void OnClientPutInServer( int client )
- {
- GetClientCookie(client, g_hMyCookie, sCookieValue, sizeof(sCookieValue))
- int theSkin = StringToInt(sCookieValue);
- g_ClientSkin[client] = theSkin;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement