Guest User

Untitled

a guest
May 17th, 2018
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <sdktools>
  3.  
  4. public Plugin:myinfo =
  5. {
  6. name = "SourceRPG: Slap Tutorial Plugin",
  7. author = "Rorschach",
  8. description = "Plugin for SourceRPG",
  9. version = "alpha",
  10. url = "no url"
  11. };
  12.  
  13. public OnPluginStart()
  14. {
  15. LoadTranslations ("common.phrases")
  16. RegAdminCmd("sm_myslap", Command_MySlap, ADMFLAG_SLAY)
  17.  
  18. sm_myslap_damage = CreateConVar("sm_myslap_damage", "5", "Default slap damage")
  19. AutoExecConfig(true, "plugin_myslap")
  20.  
  21. }
  22.  
  23. public Action:Command_MySlap(client, args)
  24. {
  25. new String:arg1[32], String:arg2[32]
  26. new damage = GetConVarInt (sm_myslap_damage)
  27.  
  28. /* Get the first argument */
  29. GetCmdArg(1, arg1, sizeof(arg1))
  30.  
  31. /* If there are 2 or more arguments, and the second argument fetch
  32. * is successful, convert it to an integer.
  33. */
  34. if (args >= 2 && GetCmdArg(2, arg2, sizeof(arg2)))
  35. {
  36. damage = StringToInt(arg2)
  37. }
  38.  
  39. /**
  40. * target_name - stores the noun identifying the target(s)
  41. * target_list - array to store clients
  42. * target_count - variable to store number of clients
  43. * tn_is_ml - stores whether the noun must be translated
  44. */
  45. new String:target_name[MAX_TARGET_LENGTH]
  46. new target_list[MAXPLAYERS], target_count
  47. new bool:tn_is_ml
  48.  
  49. if ((target_count = ProcessTargetString(
  50. arg1,
  51. client,
  52. target_list,
  53. MAXPLAYERS,
  54. COMMAND_FILTER_ALIVE, /* Only allow alive players */
  55. target_name,
  56. sizeof(target_name),
  57. tn_is_ml)) <= 0)
  58. {
  59. /* This function replies to the admin with a failure message */
  60. ReplyToTargetError(client, target_count);
  61. return Plugin_Handled;
  62. }
  63.  
  64. for (new i = 0; i < target_count; i++)
  65. {
  66. SlapPlayer(target_list[i], damage)
  67. LogAction(client, target_list[i], "\"%L\" slapped \"%L\" (damage %d)", client, target_list[i], damage)
  68. }
  69.  
  70. if (tn_is_ml)
  71. {
  72. ShowActivity2(client, "[SM] ", "Slapped %t for %d damage!", target_name, damage)
  73. }
  74. else
  75. {
  76. ShowActivity2(client, "[SM] ", "Slapped %s for %d damage!", target_name, damage)
  77. }
  78.  
  79. return Plugin_Handled;
  80. }
Add Comment
Please, Sign In to add comment