AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   HELP !! get_user_name problem (https://forums.alliedmods.net/showthread.php?t=308754)

thEsp 07-02-2018 09:37

HELP !! get_user_name problem
 
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 :? :(

CrazY. 07-02-2018 09:44

Re: HELP !! get_user_name problem
 
Your code doesn't make any sense to me... what you're trying to do?

thEsp 07-02-2018 09:47

Re: HELP !! get_user_name problem
 
Quote:

Originally Posted by CrazY. (Post 2600543)
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 :nono: :down:

shauli 07-02-2018 09:50

Re: HELP !! get_user_name problem
 
Quote:

Originally Posted by thEsp (Post 2600545)
Sense or not I didnt asked ,code is writed all. I never saw anyone else asking whats use of this code :nono: :down:

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?

CrazY. 07-02-2018 09:50

Re: HELP !! get_user_name problem
 
You're crazy dude? I'm just asking to help you. Solve with yourself... I will not lose my time.

thEsp 07-02-2018 09:55

Re: HELP !! get_user_name problem
 
Quote:

Originally Posted by shauli (Post 2600546)
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 07-02-2018 09:55

Re: HELP !! get_user_name problem
 
Quote:

Originally Posted by CrazY. (Post 2600547)
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)

shauli 07-02-2018 09:58

Re: HELP !! get_user_name problem
 
Quote:

Originally Posted by thEsp (Post 2600548)
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.

thEsp 07-02-2018 10:00

Re: HELP !! get_user_name problem
 
Quote:

Originally Posted by shauli (Post 2600550)
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"

Relaxing 07-02-2018 12:18

Re: HELP !! get_user_name problem
 
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.


All times are GMT -4. The time now is 12:20.

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