AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   [REQ] "M" (https://forums.alliedmods.net/showthread.php?t=286341)

blanko 08-15-2016 00:02

[REQ] "M"
 
I need the "M" key to be pressed just once automaticaly everytime you close the motd.

fysiks 08-15-2016 01:34

Re: [REQ] "M"
 
It is not possible to "press a key" via a plugin. Please explain what you are actually wanting to achieve.

blanko 08-15-2016 02:45

Re: [REQ] "M"
 
Quote:

Originally Posted by fysiks (Post 2444988)
It is not possible to "press a key" via a plugin. Please explain what you are actually wanting to achieve.

I need this script: "mp3 play mp3\musica.mp3" to run once for each player everytime a new map starts(everytime the motd shows up)

fysiks 08-15-2016 09:25

Re: [REQ] "M"
 
When the map starts and when the MOTD shows up are two very different things. The MOTD shows up every time a player joins your server. When the map starts, there is technically nobody in the server (the first players will join shortly after it starts).

If you want to base it on the MOTD, you can use client_putinserver() (might want to consider using a set_task to ensure that they will hear it). This will play the sound for each player every time they join the server.

pupdebox 08-15-2016 14:26

Re: [REQ] "M"
 
Quote:

Originally Posted by blanko (Post 2445000)
I need this script: "mp3 play mp3\musica.mp3" to run once for each player everytime a new map starts(everytime the motd shows up)

This code might help you to catch the event
Code:

#include <amxmodx>

#define MOTD_FLAG_ARG 1
#define MOTD_FLAG_END 1

new bool:g_bSawMotd[33];

public plugin_init()
{
    register_plugin("Block First MOTD", "0.1", "Exolent");
    register_message(get_user_msgid("MOTD"), "message_MOTD");
}

public client_connect(id)
{
    g_bSawMotd[id] = false;
}

public message_MOTD(msgid, dest, id)
{
    if(!g_bSawMotd[id])
    {
        if(get_msg_arg_int(MOTD_FLAG_ARG) == MOTD_FLAG_END)
        {
            g_bSawMotd[id] = true;
        }
        return PLUGIN_HANDLED;
    }
    return PLUGIN_CONTINUE;
}


blanko 08-15-2016 19:23

Re: [REQ] "M"
 
Quote:

Originally Posted by fysiks (Post 2445058)
When the map starts and when the MOTD shows up are two very different things. The MOTD shows up every time a player joins your server. When the map starts, there is technically nobody in the server (the first players will join shortly after it starts).

If you want to base it on the MOTD, you can use client_putinserver() (might want to consider using a set_task to ensure that they will hear it). This will play the sound for each player every time they join the server.

Man I just need THIS EXACT CODE "mp3 play mp3\musica.mp3" to run once at the beggining of each map for each player (WHEN PLAYER CONNECTS and on mapchange too, that's when the MOTD show up).

pupdebox 08-15-2016 21:00

Re: [REQ] "M"
 
Code:

#include <amxmodx>

public client_putinserver(id){
set_task(0.3,"play",id)
}

public play(id)
{
if(is_user_connected(id)){
client_cmd(id,"mp3 play mp3\musica.mp3")
}
}

enjoy, you wanted to run this code "mp3 play mp3\musica.mp3". Therefore, i didnt add the precache part.
edit: i always forget to check if user is connected

fysiks 08-15-2016 21:32

Re: [REQ] "M"
 
Quote:

Originally Posted by pupdebox (Post 2445164)
Code:

#include <amxmodx>

public client_putinserver(id){
set_task(0.3,"play",id)
}

public play(id)
{
client_cmd(id,"mp3 play mp3\musica.mp3")
}

enjoy, you wanted to run this code "mp3 play mp3\musica.mp3". Therefore, i didnt add the precache part.

You should check if the user is connected before calling client_cmd().

Dr Zayd 08-15-2016 22:59

Re: [REQ] "M"
 
USE chooseteam command .

blanko 08-16-2016 00:34

Re: [REQ] "M"
 
Quote:

Originally Posted by Dr Zayd (Post 2445174)
USE chooseteam command .

(SLAP YOU IN THE FACE) You didn't even read the fucking topic, for the love of the gods!


All times are GMT -4. The time now is 02:01.

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