Thread: Owner Show
View Single Post
Author Message
bakugan
Member
Join Date: Dec 2023
Location: Bulgaria
Old 04-21-2024 , 07:37   Owner Show
Reply With Quote #1

Can you tell me where my mistake is?



Code:
Code:
//
// AMX Mod X, based on AMX Mod by Harvey Williams ("HarveyWNvm").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
//    http://gameservers.rf.gd/forum/viewtopic.php?f=13&t=23&sid=f118bd9f95bcae808616ce98ebea4e20


#include <amxmodx>
#include <fun>
#include <engine>
#include <cstrike>


#define PLUGIN  "Show Owner"
#define VERSION  "2.1"
#define AUTHOR  "HarveyWNvm LLC."


new g_maxplayers

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)    
    register_clcmd( "say /owner", "ClientCommand" );
    register_clcmd( "say_team /owner", "ClientCommand" );
    
    register_event("HLTV", "event_round_start", "l", "1=0", "2=0")
 g_maxplayers = get_maxplayers()
    
}

public ClientCommand(id)
{
colored_print(id, "^x04 Owner Server List: ^x03 by nFL // BaKuGan. [c], fOrest,")        //<-- Replace OWNER_NAME with the Whatever the owners name is.
}

public event_round_start()
{
colored_print(0, "^x04Type ^x03 ^"/owner^" ^x04 to see who is the owner :)")
}

// Colored print by HarveyWNvm
colored_print(target, const message[], any:...)
{
    static buffer[512], i, argscount, g_msgSayText
    argscount = numargs()
    g_msgSayText = get_user_msgid("SayText")
    
    // Send to everyone
    if (!target)
    {
        static player
        for (player = 1; player <= g_maxplayers; player++)
        {
            // Not connected
            if (!is_user_connected(player))
                continue;
            
            // Remember changed arguments
            static changed[5], changedcount // [5] = max LANG_PLAYER occurencies
            changedcount = 0
            
            // Replace LANG_PLAYER with player id
            for (i = 2; i < argscount; i++)
            {
                if (getarg(i) == LANG_PLAYER)
                {
                    setarg(i, 0, player)
                    changed[changedcount] = i
                    changedcount++
                }
            }
            
            // Format message for player
            vformat(buffer, charsmax(buffer), message, 3)
            
            // Send it
            message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, player)
            write_byte(player)
            write_string(buffer)
            message_end()
            
            // Replace back player id's with LANG_PLAYER
            for (i = 0; i < changedcount; i++)
                setarg(changed[i], 0, LANG_PLAYER)
        }
    }
    // Send to specific target
    else
    {
        // Format message for player
        vformat(buffer, charsmax(buffer), message, 3)
        
        // Send it
        message_begin(MSG_ONE, g_msgSayText, _, target)
        write_byte(target)
        write_string(buffer)
        message_end()
    }
__________________
WebSite
bakugan is offline