Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.21 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <smlib>
  3.  
  4. ConVar g_cvEnablePlugin;
  5. ConVar g_cvDeleteMapWeapons;
  6. ConVar g_cvKnifeOnlyWarmup
  7.  
  8. public Plugin myinfo =
  9. {
  10. name = "AWP Only",
  11. author = "xSLOW",
  12. description = "Disable weapons placed on the map & give AWP + KNIFE to the players",
  13. version = "1.1"
  14. };
  15.  
  16.  
  17. public OnPluginStart()
  18. {
  19. HookEvent("player_spawn", Event_PlayerSpawn);
  20.  
  21. g_cvEnablePlugin = CreateConVar("sm_awponly_enableplugin", "1", "1 = Plugin enabled, 0 = Plugin disabled", FCVAR_NOTIFY);
  22. g_cvKnifeOnlyWarmup = CreateConVar("sm_awponly_warmupknifeonly", "1", "1 = Knife only in warmup, 0 = AWP + Knife in warmup", FCVAR_NOTIFY);
  23. g_cvDeleteMapWeapons = CreateConVar("sm_awponly_deletemapweapons", "1", "1 = Delete weapons placed on the map, 0 = Don't delete weapons placed on the map");
  24.  
  25. AutoExecConfig(true, "OnlyGUN");
  26. }
  27.  
  28.  
  29. public void Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast)
  30. {
  31. if(g_cvEnablePlugin.BoolValue)
  32. RequestFrame(SetWeapons, GetClientOfUserId(GetEventInt(event, "userid")));
  33. }
  34.  
  35.  
  36. public void OnMapStart()
  37. {
  38. if(g_cvEnablePlugin.BoolValue && g_cvDeleteMapWeapons.BoolValue)
  39. ServerCommand("sm_cvar mp_weapons_allow_map_placed 0")
  40. }
  41.  
  42.  
  43. stock bool IsClientValid(int client)
  44. {
  45. if (client >= 1 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client) && !IsFakeClient(client))
  46. return true;
  47. return false;
  48. }
  49.  
  50.  
  51. public void SetWeapons(int client)
  52. {
  53. if(IsClientValid(client) && IsPlayerAlive(client))
  54. {
  55. if(g_cvKnifeOnlyWarmup.BoolValue)
  56. {
  57. if(GameRules_GetProp("m_bWarmupPeriod") == 1)
  58. {
  59. Client_RemoveAllWeapons(client, "", true);
  60. GivePlayerItem(client, "weapon_shield");
  61. }
  62. else
  63. {
  64. Client_RemoveAllWeapons(client, "", true);
  65. GivePlayerItem(client, "weapon_awp");
  66. GivePlayerItem(client, "weapon_knife");
  67. }
  68. }
  69. else
  70. {
  71. Client_RemoveAllWeapons(client, "", true);
  72. GivePlayerItem(client, "weapon_awp");
  73. GivePlayerItem(client, "weapon_knife");
  74. }
  75. }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement