AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Any help for fixing code? (https://forums.alliedmods.net/showthread.php?t=209103)

oxygen935 02-21-2013 07:28

Any help for fixing code?
 
i want to create a plugin that when a player joins to my server, a welcome message appears
i also have an error and i want to fix to show the player name on hud...
Code:
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <dhudmessage>

#define PLUGIN "Welcome_Message"
#define VERSION "1.0"
#define AUTHOR "OxYgEn


public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
}

public 
client_putinserver(id)
{
    
set_task(12.0"welcome"id)
}
public 
welcome(id)
{
    
set_dhudmessage(25516500.050.2426.01.0,0.0,0.1,false)
    
show_dhudmessage(id"Welcome Player^n %s to Our Server^nEnjoy and Have FUN!^nGaming-Power Greek Community")



YamiKaitou 02-21-2013 07:32

Re: Any help for fixing code?
 
What is the error?

Use get_user_name to get the players name and then simply use formating to display the name

Kard1nal 02-21-2013 07:32

Re: Any help for fixing code?
 
PHP Code:

#include <amxmodx> 
#include <dhudmessage> 

public client_putinserver(id

set_task(12.0"welcome"id__"a"1)

public 
welcome(id

    new 
player_name[32]
    
get_user_name(idplayer_name31)
    
set_dhudmessage(25516500.050.2426.01.0,0.0,0.1,false
    
show_dhudmessage(id"Welcome Player^n %s to Our Server^nEnjoy and Have FUN!^nGaming-Power Greek Community"player_name



oxygen935 02-21-2013 07:34

Re: Any help for fixing code?
 
Quote:

Originally Posted by YamiKaitou (Post 1898837)
What is the error?

Use get_user_name to get the players name and then simply use formating to display the name

the error is here:
PHP Code:

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)


Error: Invalid string (possibly non-terminated string) on line 12

edit: kardinal thanks!

YamiKaitou 02-21-2013 07:35

Re: Any help for fixing code?
 
Quote:

Originally Posted by oxygen935 (Post 1898843)
the error is here:
PHP Code:

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)


Error: Invalid string (possibly non-terminated string) on line 12

You forgot to put the end quote when you defined AUTHOR on line 7

oxygen935 02-21-2013 07:37

Re: Any help for fixing code?
 
Quote:

Originally Posted by YamiKaitou (Post 1898844)
You forgot to put the end quote when you defined AUTHOR on line 7

lol, i fixed it

oxygen935 02-21-2013 08:03

Re: Any help for fixing code?
 
kard1nal, hud doesn't appears... fix plz

wickedd 02-21-2013 08:46

Re: Any help for fixing code?
 
Try to fix it yourself or go post in the request forum.

micapat 02-21-2013 08:52

Re: Any help for fixing code?
 
By the way, you should check if the player is still connected when you are trying to display him the message.

oxygen935 02-21-2013 15:40

Re: Any help for fixing code?
 
i found a way to fix it, but when the hud appears in the middle of the message it disappers,
if you could help to hold this for 1 minute.....
the plugin isn't created by me so the copyright goes to the original holder
code:
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <dhudmessage>

#define PLUGIN    "New Plugin"
#define AUTHOR    "Unknown"
#define VERSION    "1.0"

new const ConnectMessage[] = "Welcome Player^n%s to Our Server^nEnjoy and Have FUN!^nGaming-Power Greek Community"
new player_name[32]
public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
}

public 
client_putinserver(id)

    
get_user_name(idplayer_name31
    
set_task(10.0"ShowTheHud"id)
}

public 
ShowTheHud(id)
{
    
set_dhudmessage(02552550.050.24212.020.00.10.1false)
    
show_dhudmessage(idConnectMessageplayer_name)




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

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