AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Owner Show (https://forums.alliedmods.net/showthread.php?t=347374)

bakugan 04-21-2024 07:37

Owner Show
 
Can you tell me where my mistake is?

https://i.ibb.co/Pjgtd7d/Screenshot-1.png

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()
    }


tedaimlocks 04-21-2024 07:53

Re: Owner Show
 
HTML Code:

#include <amxmodx>
#include <colorchat>

#define PLUGIN "Show Owner"
#define VERSION "1.0"
#define AUTHOR "tedaimlocks"

public plugin_init() {
        register_plugin(PLUGIN, VERSION, AUTHOR)
        register_logevent("logevent_RoundStart", 2, "1=Round_Start");
        register_clcmd("say /owner", "ShowOwner")
        register_clcmd("say_team /owner", "ShowOwner")
}

public logevent_RoundStart()
        set_task(1.0, "ShowOwner");

public ShowOwner() {
    ColorChat(0, GREEN, "^x04Server Owners are: ^x03nFL // BaKuGan. [c], fOrest")
}


bakugan 04-21-2024 07:59

Re: Owner Show
 
Quote:

Originally Posted by tedaimlocks (Post 2821325)
HTML Code:

#include <amxmodx>
#include <colorchat>

#define PLUGIN "Show Owner"
#define VERSION "1.0"
#define AUTHOR "tedaimlocks"

public plugin_init() {
        register_plugin(PLUGIN, VERSION, AUTHOR)
        register_logevent("logevent_RoundStart", 2, "1=Round_Start");
        register_clcmd("say /owner", "ShowOwner")
        register_clcmd("say_team /owner", "ShowOwner")
}

public logevent_RoundStart()
        set_task(1.0, "ShowOwner");

public ShowOwner(id) {
    ColorChat(0, GREEN, "^x04Server Owners are: ^x03nFL // BaKuGan. [c], fOrest")
}


Why on earth does everything have to be calculated since I have a custom made plugin? Just to fix the error from the side, I don't need a new plugin

tedaimlocks 04-21-2024 08:05

Re: Owner Show
 
Because ur plugin is coded messy af and you can make it in just 5 lines not 100 lines

tedaimlocks 04-21-2024 08:07

Re: Owner Show
 
HTML Code:

#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()
    }
}


bakugan 04-21-2024 08:36

Re: Owner Show
 
Quote:

Originally Posted by tedaimlocks (Post 2821328)
HTML Code:

#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()
    }
}





Now as you gave the code it works but here is my result
HTML 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>


#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()
    }
}



All times are GMT -4. The time now is 10:00.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.