AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Client_Connect Message (https://forums.alliedmods.net/showthread.php?t=185430)

Waleed 05-17-2012 11:37

Client_Connect Message
 
Code:

public plugin_init() {
        register_plugin("PLUGIN1", "1.0", "Waleed")
        }

public client_putinserver(playerid){

if(is_user_connected(playerid)){
new string[100];
new name[32]
        get_user_name(playerid, name, charsmax(name))
        format(string, sizeof(string), "%s has joined the server!", name);
        set_hudmessage(0, 255, 0, -1.0, -1.0, 0, 6.0, 30.0, 1.0, 10)
        show_hudmessage(playerid, "Welcome To My Server", string)
                return 1;}}

I want to display New Connected Players name in Middle HUD,But its not working,Any suggestions.

<VeCo> 05-17-2012 11:46

Re: Client_Connect Message
 
Make a task to display the hud message after some seconds (because you can't show a message to a player, that has just joined the server).
You don't need to return anything in client_putinserver.
fadeoutout (last parameter in your set_hudmessage) is a float.

Liverwiz 05-17-2012 11:52

Re: Client_Connect Message
 
PHP Code:

new g_SyncObj
public plugin_init() { 
    
register_plugin("PLUGIN1""1.0""Waleed")
        
g_syncObj CreateHudSyncObj()
    }

public 
client_putinserver(playerid){

if(
is_user_connected(playerid)){
new 
string[100];
new 
name[32]
    
get_user_name(playeridnamecharsmax(name))
    
format(stringsizeof(string), "%s has joined the server!"name);
    
set_hudmessage(0255033.031.006.030.01.010.0)
    
ShowSyncHudMsg(playeridg_SyncObj"Welcome to my server")
        return 
1;}} 

Change your hud message to a sync hud, changed your hud placement (using AMXX-Studio's HUD generator) to be just above the crossahair (-1 -1 hasn't worked for me in the past)

And put it on a task. VeCo is right.

I also suppose you'd like string[] to be displayed to everyone else. You'll have to loop through all clients and desplay it to them individually.

<VeCo> 05-17-2012 11:52

Re: Client_Connect Message
 
-1.0 should work fine, it's centered.

Liverwiz 05-17-2012 11:57

Re: Client_Connect Message
 
Quote:

Originally Posted by Liverwiz (Post 1710672)
set_hudmessage(0, 255, 0, 33.0, 31.0, 0, 6.0, 30.0, 1.0, 10.0)

That should be 0.33 and 0.31

My mistake.


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

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