Advertisement
Guest User

Untitled

a guest
Dec 1st, 2020
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <sdktools>
  3. #include <cstrike>
  4. #include <csgo_colors>
  5. #include <morecolors>
  6. #include <sdkhooks>
  7. #include <smlib>
  8.  
  9. #pragma semicolon 1
  10. #pragma newdecls required
  11.  
  12.  
  13. #define PLUGIN_NAME "Auto-Pistol"
  14. #define PLUGIN_DESCRIPTION "Auto-Pistol for Spawn"
  15. #define PLUGIN_VERSION "1.0"
  16. #define PLUGIN_AUTHOR "wwww333"
  17. #define PLUGIN_URL "https://alliedmodders.com"
  18.  
  19. public Plugin myinfo =
  20. {
  21. name = PLUGIN_NAME,
  22. author = PLUGIN_AUTHOR,
  23. description = PLUGIN_DESCRIPTION,
  24. version = PLUGIN_VERSION,
  25. url = PLUGIN_URL
  26. };
  27.  
  28. ConVar g_cEnabled;
  29.  
  30. public void OnPluginStart()
  31. {
  32. RegAdminCmd("sm_ap", Command_AutoPistol, ADMFLAG_ROOT, "This Activates Auto-Pistol Plugin");
  33.  
  34. g_cEnabled = CreateConVar("sm_autopistol", "0", "Enables/Disables Pistol Plugin");
  35.  
  36. HookEvent("player_spawn", Event_PlayerSpawn);
  37. }
  38.  
  39. public Action Command_AutoPistol(int client, int args)
  40. {
  41. if(!g_cEnabled.BoolValue)
  42. {
  43. g_cEnabled.SetBool(true);
  44. PrintToChatAll("Auto-Pistol enabled");
  45. }
  46. else
  47. {
  48. g_cEnabled.SetBool(false);
  49. PrintToChatAll("Auto-Pistol disabled");
  50. }
  51.  
  52. return Plugin_Handled;
  53. }
  54.  
  55. public Action Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast)
  56. {
  57. int client = GetClientOfUserId(event.GetInt("userid"));
  58.  
  59. if(g_cEnabled.BoolValue)
  60. {
  61. GiveUsp(client);
  62. }
  63. }
  64.  
  65. public void GiveUsp(int client)
  66. {
  67. GivePlayerItem(client, "weapon_usp");
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement