AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   MP3 play console command (https://forums.alliedmods.net/showthread.php?t=309885)

blAck. 08-10-2018 14:47

MP3 play console command
 
I know it's client-side command but I'll still ask.
Can I somehow set a flag for console command "mp3 play ..."?

Ghosted 08-10-2018 14:52

Re: MP3 play console command
 
Code:

client_cmd(PlayerID, "mp3 play *");

blAck. 08-10-2018 14:58

Re: MP3 play console command
 
Quote:

Originally Posted by Ghosted (Post 2609510)
Code:

client_cmd(PlayerID, "mp3 play *");

yes but how do I check if what player type in the console contains "mp3 play"?

CrAzY MaN 08-10-2018 15:00

Re: MP3 play console command
 
What are you trying to do?
Post the code.

blAck. 08-10-2018 15:03

Re: MP3 play console command
 
Quote:

Originally Posted by CrAzY MaN (Post 2609512)
What are you trying to do?
Post the code.

I'm trying to prevent a player from playing a mp3 file with "mp3 play" console command.
I would like to set a flag for that command if it's possible. :-)

Ghosted 08-10-2018 15:27

Re: MP3 play console command
 
Quote:

Originally Posted by blAck. (Post 2609513)
I'm trying to prevent a player from playing a mp3 file with "mp3 play" console command.
I would like to set a flag for that command if it's possible. :-)

I think its impossible. But mp3 is only called when client launchs game, not in-game.

D4rkSiD3Rs 08-10-2018 16:04

Re: MP3 play console command
 
PHP Code:

#include <amxmodx>

#define PLUGIN    "MP3 PLAY"
#define VERSION    "1.0"
#define AUTHOR    "~D4rkSiD3Rs~"

#define MP3_ACCESS ADMIN_BAN    // change the access here

new g_cmdLine1[512], g_cmdLine2[512]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
}

public 
client_command(id)
{
    
read_argv(0g_cmdLine1511)
    
read_argv(1g_cmdLine2511)

    if(
equali(g_cmdLine1"mp3") && equali(g_cmdLine2"play"))
    {
        if(!(
get_user_flags(id) & MP3_ACCESS))
        {
            
client_cmd(id"mp3 stop");
        }
    }



blAck. 08-10-2018 16:50

Re: MP3 play console command
 
Quote:

Originally Posted by D4rkSiD3Rs (Post 2609521)
PHP Code:

#include <amxmodx>

#define PLUGIN    "MP3 PLAY"
#define VERSION    "1.0"
#define AUTHOR    "~D4rkSiD3Rs~"

#define MP3_ACCESS ADMIN_BAN    // change the access here

new g_cmdLine1[512], g_cmdLine2[512]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
}

public 
client_command(id)
{
    
read_argv(0g_cmdLine1511)
    
read_argv(1g_cmdLine2511)

    if(
equali(g_cmdLine1"mp3") && equali(g_cmdLine2"play"))
    {
        if(!(
get_user_flags(id) & MP3_ACCESS))
        {
            
client_cmd(id"mp3 stop");
        }
    }



It only stops the song when I type "mp3 play". But when I type "mp3 play sound/radio/..." it still plays the song... :/

D4rkSiD3Rs 08-10-2018 17:19

Re: MP3 play console command
 
Quote:

Originally Posted by blAck. (Post 2609529)
It only stops the song when I type "mp3 play". But when I type "mp3 play sound/radio/..." it still plays the song... :/

You've tested it?

blAck. 08-10-2018 17:20

Re: MP3 play console command
 
Quote:

Originally Posted by D4rkSiD3Rs (Post 2609533)
You've tested it?

Yes I did.


All times are GMT -4. The time now is 08:18.

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