Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- הגדרת הפקודה /painter:
- הפקודה /painter מפעילה או מכבה את מצב הציור.
- השחקן יקבל הודעה שמצב הציור הופעל והוא יכול להשתמש בכוונת ובמקש E (ברירת המחדל של +use) כדי לצייר.
- */
- #include <amxmodx>
- #include <amxmisc>
- #include <fun>
- #define MAX_POINTS 100
- new g_painting[33]; // Array to check if a player is painting
- new Float:g_paintPoints[33][MAX_POINTS][3]; // Array to store the points
- new g_paintCount[33]; // Array to store the number of points per player
- // Plugin details
- public plugin_init() {
- register_plugin("Painter System", "1.0", "CheezPuff");
- register_clcmd("say /painter", "CmdPainter");
- register_clcmd("say_team /painter", "CmdPainter");
- register_clcmd("+use", "StartPaint"); // Bind to start painting
- register_clcmd("-use", "StopPaint"); // Bind to stop painting
- }
- public plugin_cfg() {
- log_amx("Painter System plugin loaded!");
- }
- // Command to toggle painting mode
- public CmdPainter(id) {
- if (!is_user_connected(id)) return PLUGIN_HANDLED;
- if (!is_user_alive(id)) return PLUGIN_HANDLED;
- if (get_user_team(id) != 2) { // Check if the player is a CT
- client_print(id, print_chat, "Only CTs can use this command.");
- return PLUGIN_HANDLED;
- }
- if (g_painting[id]) {
- g_painting[id] = 0;
- client_print(id, print_chat, "Painting mode disabled. You can no longer paint.");
- } else {
- g_painting[id] = 1;
- g_paintCount[id] = 0;
- client_print(id, print_chat, "Painting mode enabled. Use your crosshair to paint on the floor.");
- client_print(id, print_chat, "Press and hold +use (E) to start painting.");
- }
- return PLUGIN_HANDLED;
- }
- // Command to start painting
- public StartPaint(id) {
- if (!is_user_connected(id)) return PLUGIN_HANDLED;
- if (!is_user_alive(id)) return PLUGIN_HANDLED;
- if (get_user_team(id) != 2) return PLUGIN_HANDLED; // Only CTs can paint
- if (g_painting[id]) {
- set_task(0.1, "PaintTask", id);
- }
- return PLUGIN_HANDLED;
- }
- // Command to stop painting
- public StopPaint(id) {
- remove_task(id);
- return PLUGIN_HANDLED;
- }
- // Task to paint
- public PaintTask(id) {
- if (!g_painting[id] || !is_user_alive(id)) return PLUGIN_HANDLED;
- if (g_paintCount[id] < MAX_POINTS) {
- new Float:origin[3];
- get_user_origin(id, origin, 0);
- origin[2] -= 50.0; // Lower the point to be on the floor
- g_paintPoints[id][g_paintCount[id]][0] = origin[0];
- g_paintPoints[id][g_paintCount[id]][1] = origin[1];
- g_paintPoints[id][g_paintCount[id]][2] = origin[2];
- g_paintCount[id]++;
- draw_point(id, origin);
- }
- set_task(0.1, "PaintTask", id);
- return PLUGIN_HANDLED;
- }
- // Function to draw a point
- draw_point(id, Float:origin[3]) {
- message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
- write_byte(TE_SPRITE);
- write_coord(floatround(origin[0]));
- write_coord(floatround(origin[1]));
- write_coord(floatround(origin[2]));
- write_short(sprite_index("sprites/white.spr")); // You need to have a white sprite
- write_byte(5); // Scale
- write_byte(255); // Brightness
- message_end();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement