Advertisement
CheezPuff

Painter CT v0.9 [Not tested]

Jun 8th, 2024 (edited)
719
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.27 KB | None | 0 0
  1. /*
  2. הגדרת הפקודה /painter:
  3.  
  4. הפקודה /painter מפעילה או מכבה את מצב הציור.
  5. השחקן יקבל הודעה שמצב הציור הופעל והוא יכול להשתמש בכוונת ובמקש E (ברירת המחדל של +use) כדי לצייר.
  6. */
  7. #include <amxmodx>
  8. #include <amxmisc>
  9. #include <fun>
  10.  
  11. #define MAX_POINTS 100
  12.  
  13. new g_painting[33]; // Array to check if a player is painting
  14. new Float:g_paintPoints[33][MAX_POINTS][3]; // Array to store the points
  15. new g_paintCount[33]; // Array to store the number of points per player
  16.  
  17. // Plugin details
  18. public plugin_init() {
  19.     register_plugin("Painter System", "1.0", "CheezPuff");
  20.     register_clcmd("say /painter", "CmdPainter");
  21.     register_clcmd("say_team /painter", "CmdPainter");
  22.  
  23.     register_clcmd("+use", "StartPaint"); // Bind to start painting
  24.     register_clcmd("-use", "StopPaint"); // Bind to stop painting
  25. }
  26.  
  27. public plugin_cfg() {
  28.     log_amx("Painter System plugin loaded!");
  29. }
  30.  
  31. // Command to toggle painting mode
  32. public CmdPainter(id) {
  33.     if (!is_user_connected(id)) return PLUGIN_HANDLED;
  34.     if (!is_user_alive(id)) return PLUGIN_HANDLED;
  35.     if (get_user_team(id) != 2) { // Check if the player is a CT
  36.         client_print(id, print_chat, "Only CTs can use this command.");
  37.         return PLUGIN_HANDLED;
  38.     }
  39.  
  40.     if (g_painting[id]) {
  41.         g_painting[id] = 0;
  42.         client_print(id, print_chat, "Painting mode disabled. You can no longer paint.");
  43.     } else {
  44.         g_painting[id] = 1;
  45.         g_paintCount[id] = 0;
  46.         client_print(id, print_chat, "Painting mode enabled. Use your crosshair to paint on the floor.");
  47.         client_print(id, print_chat, "Press and hold +use (E) to start painting.");
  48.     }
  49.     return PLUGIN_HANDLED;
  50. }
  51.  
  52. // Command to start painting
  53. public StartPaint(id) {
  54.     if (!is_user_connected(id)) return PLUGIN_HANDLED;
  55.     if (!is_user_alive(id)) return PLUGIN_HANDLED;
  56.     if (get_user_team(id) != 2) return PLUGIN_HANDLED; // Only CTs can paint
  57.  
  58.     if (g_painting[id]) {
  59.         set_task(0.1, "PaintTask", id);
  60.     }
  61.     return PLUGIN_HANDLED;
  62. }
  63.  
  64. // Command to stop painting
  65. public StopPaint(id) {
  66.     remove_task(id);
  67.     return PLUGIN_HANDLED;
  68. }
  69.  
  70. // Task to paint
  71. public PaintTask(id) {
  72.     if (!g_painting[id] || !is_user_alive(id)) return PLUGIN_HANDLED;
  73.  
  74.     if (g_paintCount[id] < MAX_POINTS) {
  75.         new Float:origin[3];
  76.         get_user_origin(id, origin, 0);
  77.         origin[2] -= 50.0; // Lower the point to be on the floor
  78.  
  79.         g_paintPoints[id][g_paintCount[id]][0] = origin[0];
  80.         g_paintPoints[id][g_paintCount[id]][1] = origin[1];
  81.         g_paintPoints[id][g_paintCount[id]][2] = origin[2];
  82.         g_paintCount[id]++;
  83.        
  84.         draw_point(id, origin);
  85.     }
  86.  
  87.     set_task(0.1, "PaintTask", id);
  88.     return PLUGIN_HANDLED;
  89. }
  90.  
  91. // Function to draw a point
  92. draw_point(id, Float:origin[3]) {
  93.     message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
  94.     write_byte(TE_SPRITE);
  95.     write_coord(floatround(origin[0]));
  96.     write_coord(floatround(origin[1]));
  97.     write_coord(floatround(origin[2]));
  98.     write_short(sprite_index("sprites/white.spr")); // You need to have a white sprite
  99.     write_byte(5); // Scale
  100.     write_byte(255); // Brightness
  101.     message_end();
  102. }
  103.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement