Raised This Month: $ Target: $400
 0% 

[REQ] "M"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
blanko
Senior Member
Join Date: Aug 2008
Old 08-15-2016 , 00:02   [REQ] "M"
Reply With Quote #1

I need the "M" key to be pressed just once automaticaly everytime you close the motd.
__________________
blanko is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-15-2016 , 01:34   Re: [REQ] "M"
Reply With Quote #2

It is not possible to "press a key" via a plugin. Please explain what you are actually wanting to achieve.
__________________
fysiks is offline
blanko
Senior Member
Join Date: Aug 2008
Old 08-15-2016 , 02:45   Re: [REQ] "M"
Reply With Quote #3

Quote:
Originally Posted by fysiks View Post
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)
__________________

Last edited by blanko; 08-15-2016 at 02:47.
blanko is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-15-2016 , 09:25   Re: [REQ] "M"
Reply With Quote #4

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.
__________________

Last edited by fysiks; 08-15-2016 at 09:26.
fysiks is offline
blanko
Senior Member
Join Date: Aug 2008
Old 08-15-2016 , 19:23   Re: [REQ] "M"
Reply With Quote #5

Quote:
Originally Posted by fysiks View Post
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).
__________________
blanko is offline
pupdebox
Senior Member
Join Date: Feb 2016
Location: Wakanda
Old 08-15-2016 , 14:26   Re: [REQ] "M"
Reply With Quote #6

Quote:
Originally Posted by blanko View Post
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;
}

Last edited by pupdebox; 08-15-2016 at 14:31.
pupdebox is offline
pupdebox
Senior Member
Join Date: Feb 2016
Location: Wakanda
Old 08-15-2016 , 21:00   Re: [REQ] "M"
Reply With Quote #7

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

Last edited by pupdebox; 08-15-2016 at 21:39.
pupdebox is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-15-2016 , 21:32   Re: [REQ] "M"
Reply With Quote #8

Quote:
Originally Posted by pupdebox View Post
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().
__________________
fysiks is offline
blanko
Senior Member
Join Date: Aug 2008
Old 08-16-2016 , 00:35   Re: [REQ] "M"
Reply With Quote #9

Quote:
Originally Posted by fysiks View Post
You should check if the user is connected before calling client_cmd().
Then what would it be the correct and working entire code for this, sir?
__________________
blanko is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-16-2016 , 09:33   Re: [REQ] "M"
Reply With Quote #10

Quote:
Originally Posted by fysiks View Post
You should check if the user is connected before calling client_cmd().
__________________
fysiks is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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