AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   how can i get input like hud message? (https://forums.alliedmods.net/showthread.php?t=189387)

mi1s0n 07-06-2012 14:54

how can i get input like hud message?
 
hi guys
Im a beginner in amxmodx scripting can u help me with this 3 questions?
1 - how can I get user input like username and password in a manner like hud message at the left of the screen?
I think I have to detect user's pressed keys and print them on screen while ENTER key has not been pressed
2 - how can I get the winner team after round ends?is there any functions?
3 - how can I show a hud message when a user connects?

sorry if my questions are stupid,i have searched a lot but found nothing help please

pokemonmaster 07-06-2012 16:17

Re: how can i get input like hud message?
 
Quote:

Originally Posted by mi1s0n (Post 1744838)
3 - how can I show a hud message when a user connects?

In the amxmodx.inc you will find client_putinserver() which is called when the player joins the game, declare it as a public function, then use the natives set_hudmessage() and show_hudmessage() to set and show the hud colors with the wanted colors\positions.
That's all.

mi1s0n 07-06-2012 16:45

Re: how can i get input like hud message?
 
I've test this but its not working
can u tell me whats wrong pokemonmaster?
Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "mi1s0n"
#define VERSION "1.0"
#define AUTHOR "Milad Doorbash"



public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)   
}
public client_putinserver(id)
{
    set_hudmessage(255, 255, 42, 0.02, 0.47, 0, 6.0, 12.0)
    show_hudmessage(id, "your id is  : %d",id)
}


YamiKaitou 07-06-2012 16:53

Re: how can i get input like hud message?
 
you will have to set a timer, you are not "in" the server and able to read the HUD message

mi1s0n 07-06-2012 17:21

Re: how can i get input like hud message?
 
YamiKaitou do you mean something like this?
this is good but has a problem : shows message to everyone!! again and again
i used "a" flag with repeat = 1 but no messages appeared on scrren

Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "mi1s0n"
#define VERSION "1.0"
#define AUTHOR "Milad Doorbash"



public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    set_task( 3, "myfunction", 0, "", 0,"b")
   
}
public myfunction(){
    new id
    for(id = 1; id <= get_maxplayers(); id++)
    {
        if(is_user_connected(id))
        {
            set_hudmessage(255, 255, 42, 0.25, 0.22, 0, 6.0, 12.0)
            show_hudmessage(id, "HIIIIIII HOW ARE U???")
           
        }
       
    }
}

anyone has an idea about my first and 2nd questions?

YamiKaitou 07-06-2012 17:25

Re: how can i get input like hud message?
 
Quote:

Originally Posted by mi1s0n (Post 1744838)
1 - how can I get user input like username and password in a manner like hud message at the left of the screen?

Use messagemode to take user input or a console command

Quote:

I think I have to detect user's pressed keys and print them on screen while ENTER key has not been pressed
Not possible

Quote:

2 - how can I get the winner team after round ends?is there any functions?
Search

Quote:

3 - how can I show a hud message when a user connects?
PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "mi1s0n"
#define VERSION "1.0"
#define AUTHOR "Milad Doorbash"



public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)    
}

public 
client_putinserver(id)
{
    
set_task(10.0"showHud"id)
}

public 
showHud(id)
{
    
set_hudmessage(255255420.020.4706.012.0)
    
show_hudmessage(id"your id is  : %d",id)



mi1s0n 07-06-2012 17:38

Re: how can i get input like hud message?
 
thanx a lot YamiKaitou :wink:

Santaaa 07-06-2012 17:42

Re: how can i get input like hud message?
 
Quote:

Originally Posted by YamiKaitou (Post 1744927)
Not possible

Yes it is?

YamiKaitou 07-06-2012 17:43

Re: how can i get input like hud message?
 
Quote:

Originally Posted by Santaaa (Post 1744934)
Yes it is?

No it is not. You can only detect certain actions, but not specific keys.

Santaaa 07-06-2012 17:46

Re: how can i get input like hud message?
 
Yeah, he asked if it is possible to check for the winning team, yes you can. But there isnt a spececfic function for that.


All times are GMT -4. The time now is 15:19.

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