Raised This Month: $12 Target: $400
 3% 

HELP !! get_user_name problem


Post New Thread Closed Thread   
 
Thread Tools Display Modes
Author Message
thEsp
BANNED
Join Date: Aug 2017
Old 07-02-2018 , 09:37   HELP !! get_user_name problem
#1

Im making an plugin and I have some problems with it
The code is correctly but it doesnt work as needed

Insted of showing player/user name it shows server name
The code below

p.s : dir = filename and directory



Code:
public hudmessage(id)
{	
	if(!file_exists(dir))
	{
		write_file(dir,"%s Welcome to our Server ! GL & HF",_)	
	}
	
	new szText[64], len	
	format(szText, 63, dir)
	read_file(dir,0,szText,63,len)
	
	new szName[32]
	get_user_name(id,szName,charsmax(szName))
	
	replace(szText,64,"%s",szName)

	set_hudmessage(0, 255, 0, 0.38, 0.56, 0, 6.0, 12.0)
	show_hudmessage(id, "%s" ,szText)
}
Any way to solve this problem
thEsp is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 07-02-2018 , 09:44   Re: HELP !! get_user_name problem
#2

Your code doesn't make any sense to me... what you're trying to do?
__________________








CrazY. is offline
thEsp
BANNED
Join Date: Aug 2017
Old 07-02-2018 , 09:47   Re: HELP !! get_user_name problem
#3

Quote:
Originally Posted by CrazY. View Post
Your code doesn't make any sense to me... what you're trying to do?
Sense or not I didnt asked ,code is writed all. I never saw anyone else asking whats use of this code
thEsp is offline
shauli
Member
Join Date: Jun 2018
Old 07-02-2018 , 09:50   Re: HELP !! get_user_name problem
#4

Quote:
Originally Posted by thEsp View Post
Sense or not I didnt asked ,code is writed all. I never saw anyone else asking whats use of this code
You won't progress with that attitude.
If you want to get help you'll have to explain what are you trying to do and what exactly doesn't work. When people ask questions (to help you!) you should answer.

Your code doesn't make sense and you are not telling us what it should do, so how can we help you?
shauli is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 07-02-2018 , 09:50   Re: HELP !! get_user_name problem
#5

You're crazy dude? I'm just asking to help you. Solve with yourself... I will not lose my time.
__________________








CrazY. is offline
thEsp
BANNED
Join Date: Aug 2017
Old 07-02-2018 , 09:55   Re: HELP !! get_user_name problem
#6

Quote:
Originally Posted by shauli View Post
You won't progress with that attitude.
If you want to get help you'll have to explain what are you trying to do and what exactly doesn't work. When people ask questions (to help you!) you should answer.

Your code doesn't make sense and you are not telling us what it should do, so how can we help you?
Bro code is shared .
BTW im updating my last plugin (https://forums.alliedmods.net/showthread.php?t=302577)
thEsp is offline
thEsp
BANNED
Join Date: Aug 2017
Old 07-02-2018 , 09:55   Re: HELP !! get_user_name problem
#7

Quote:
Originally Posted by CrazY. View Post
You're crazy dude? I'm just asking to help you. Solve with yourself... I will not lose my time.
Bro code is shared .
BTW im updating my last plugin (https://forums.alliedmods.net/showthread.php?t=302577)
thEsp is offline
shauli
Member
Join Date: Jun 2018
Old 07-02-2018 , 09:58   Re: HELP !! get_user_name problem
#8

Quote:
Originally Posted by thEsp View Post
Bro code is shared .
BTW im updating my last plugin (https://forums.alliedmods.net/showthread.php?t=302577)
You think that with 15 lines of code we can understand and solve all your problems?
Just tell us what you're trying to do.

What is 'dir'? What's its purpose? When does this function gets called? Why even bother reading from a file when you don't even use the data? Does it compile? Do you get errors during execution?
Help us to help you.

Last edited by shauli; 07-02-2018 at 10:01. Reason: typo
shauli is offline
thEsp
BANNED
Join Date: Aug 2017
Old 07-02-2018 , 10:00   Re: HELP !! get_user_name problem
#9

Quote:
Originally Posted by shauli View Post
You think that with 15 lines of code we can understand and solve all your problems?
Just tell us what you're trying to do.

What is 'dir'? What's it's purpose? When does this function gets called? Why even bother reading from a file when you don't even use the data? Does it compile? Do you get errors during execution?
Help us to help you.
Read post carefuly
Its main event so has no more code

#define dir "addons/amxmodx/configs/welcome.ini"

Last edited by thEsp; 07-02-2018 at 10:03.
thEsp is offline
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 07-02-2018 , 12:18   Re: HELP !! get_user_name problem
#10

Code:
public hudmessage(id){         if(!file_exists(dir))         write_file(dir,"Welcome to our Server ! GL & HF");         new szText[64+32];     static szName[32];         read_file(dir, 0, szText, charsmax(szText));     get_user_name(id,szName,charsmax(szName));         formatex(szText, charsmax(szText), "sup bro %s^nWelcome to our Server ! GL & HF", szName);     set_hudmessage(0, 255, 0, 0.38, 0.56, 0, 6.0, 12.0)     show_hudmessage(id, "%s" ,szText) }
It reads what's inside "dir" file and saves into an array. Then, gets user name and use formatex() to fit it all together in previous array.
__________________

Last edited by Relaxing; 07-02-2018 at 12:20.
Relaxing is offline
Closed Thread



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 20:43.


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