Raised This Month: $ Target: $400
 0% 

Any help for fixing code?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
oxygen935
Veteran Member
Join Date: Jun 2012
Location: Athens, Greece
Old 02-21-2013 , 07:28   Any help for fixing code?
Reply With Quote #1

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")

__________________
Quote:
Originally Posted by quark View Post
You're a genius
Stopped any pawn work cause of university for computer science
oxygen935 is offline
Send a message via Skype™ to oxygen935
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 02-21-2013 , 07:32   Re: Any help for fixing code?
Reply With Quote #2

What is the error?

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

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Kard1nal
Senior Member
Join Date: Dec 2012
Location: Russia
Old 02-21-2013 , 07:32   Re: Any help for fixing code?
Reply With Quote #3

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

__________________
Sorry for my English, I'm Russian.
Kard1nal is offline
Send a message via Skype™ to Kard1nal
oxygen935
Veteran Member
Join Date: Jun 2012
Location: Athens, Greece
Old 02-21-2013 , 07:34   Re: Any help for fixing code?
Reply With Quote #4

Quote:
Originally Posted by YamiKaitou View Post
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!
__________________
Quote:
Originally Posted by quark View Post
You're a genius
Stopped any pawn work cause of university for computer science

Last edited by oxygen935; 02-21-2013 at 07:35.
oxygen935 is offline
Send a message via Skype™ to oxygen935
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 02-21-2013 , 07:35   Re: Any help for fixing code?
Reply With Quote #5

Quote:
Originally Posted by oxygen935 View Post
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
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
oxygen935
Veteran Member
Join Date: Jun 2012
Location: Athens, Greece
Old 02-21-2013 , 07:37   Re: Any help for fixing code?
Reply With Quote #6

Quote:
Originally Posted by YamiKaitou View Post
You forgot to put the end quote when you defined AUTHOR on line 7
lol, i fixed it
__________________
Quote:
Originally Posted by quark View Post
You're a genius
Stopped any pawn work cause of university for computer science
oxygen935 is offline
Send a message via Skype™ to oxygen935
oxygen935
Veteran Member
Join Date: Jun 2012
Location: Athens, Greece
Old 02-21-2013 , 08:03   Re: Any help for fixing code?
Reply With Quote #7

kard1nal, hud doesn't appears... fix plz
__________________
Quote:
Originally Posted by quark View Post
You're a genius
Stopped any pawn work cause of university for computer science
oxygen935 is offline
Send a message via Skype™ to oxygen935
wickedd
Veteran Member
Join Date: Nov 2009
Old 02-21-2013 , 08:46   Re: Any help for fixing code?
Reply With Quote #8

Try to fix it yourself or go post in the request forum.
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu (France).
Old 02-21-2013 , 08:52   Re: Any help for fixing code?
Reply With Quote #9

By the way, you should check if the player is still connected when you are trying to display him the message.
__________________
micapat is offline
oxygen935
Veteran Member
Join Date: Jun 2012
Location: Athens, Greece
Old 02-21-2013 , 15:40   Re: Any help for fixing code?
Reply With Quote #10

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)

__________________
Quote:
Originally Posted by quark View Post
You're a genius
Stopped any pawn work cause of university for computer science

Last edited by oxygen935; 02-21-2013 at 15:41.
oxygen935 is offline
Send a message via Skype™ to oxygen935
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 21:38.


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