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

[REQ] show player info


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
XMaDNeSS
Member
Join Date: Oct 2016
Location: Palestine, Nablus.
Old 01-14-2017 , 05:50   [REQ] show player info
Reply With Quote #1

hello everyone. i want made plugin show player info like this "Your info: name: %S | Steam id: %S | IP: %S | Data: moth/day"

this is only and thanks
__________________
http://zombieonzone.com ForEver
Free Palestine.
[ZoZ].:Zombie Plague:.1000FPS FastDL NonSteam
91.134.234.190:27015
XMaDNeSS is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-14-2017 , 07:42   Re: [REQ] show player info
Reply With Quote #2

This should do the trick

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Show Player Info"
#define VERSION "1.0"
#define AUTHOR "NapoleoN#"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
}

public 
client_putinserver(id) {
    
set_task(1.0"ShowInfo"id)
}

public 
ShowInfo(id) {
    if(
is_user_connected(id)) {
        new 
szName[33]; get_user_name(idszNamecharsmax(szName))
        new 
szIP[40]; get_user_ip(idszIPcharsmax(szIP), 1)
        new 
szSteamID[35]; get_user_authid(idszSteamIDcharsmax(szSteamID))
        
        new 
szTime[6]; get_time("%m/%d"szTimecharsmax(szTime))
        
        
set_hudmessage(42170255, -1.00.0206.012.00.10.2, -1)
        
show_hudmessage(id"Your info: name: %s | Steam id: %s | IP: %s | Date: %s"szNameszSteamIDszIPszTime)
        
        
set_task(11.0"ShowInfo"id)
    }

__________________

Last edited by Napoleon_be; 01-15-2017 at 08:16.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
XMaDNeSS
Member
Join Date: Oct 2016
Location: Palestine, Nablus.
Old 01-14-2017 , 08:11   Re: [REQ] show player info
Reply With Quote #3

thank you
__________________
http://zombieonzone.com ForEver
Free Palestine.
[ZoZ].:Zombie Plague:.1000FPS FastDL NonSteam
91.134.234.190:27015
XMaDNeSS is offline
XMaDNeSS
Member
Join Date: Oct 2016
Location: Palestine, Nablus.
Old 01-14-2017 , 08:52   Re: [REQ] show player info
Reply With Quote #4

i want ask u how to make it not Disappears
__________________
http://zombieonzone.com ForEver
Free Palestine.
[ZoZ].:Zombie Plague:.1000FPS FastDL NonSteam
91.134.234.190:27015
XMaDNeSS is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-14-2017 , 10:03   Re: [REQ] show player info
Reply With Quote #5

PHP Code:
#include <amxmodx>

#define TASK_MESSAGE 398822

new g_iObject
new g_szAuthId[33][35]
new 
g_szIP[33][16]
new 
g_szDate[6]

public 
plugin_init()
{
    
register_plugin("Permanent HUD Message""1.0""OciXCrom")
    
get_time("%m/%d"g_szDatecharsmax(g_szDate))
    
g_iObject CreateHudSyncObj()
}

public 
client_putinserver(id)
{
    
get_user_authid(idg_szAuthId[id], charsmax(g_szAuthId[]))
    
get_user_ip(idg_szIP[id], charsmax(g_szIP[]))
    
set_task(1.0"DisplayMessage"id TASK_MESSAGE, .flags "b")
}

public 
client_disconnect(id)
    
remove_task(id TASK_MESSAGE)

public 
DisplayMessage(id)
{
    
id -= TASK_MESSAGE
    
    
new szName[32]
    
get_user_name(idszNamecharsmax(szName))
    
    
set_hudmessage(025500.020.200.11.00.10.1, -1)
    
ShowSyncHudMsg(idg_iObject"Your info: name: %s | Steam id: %s | IP: %s | Date: %s"szNameg_szAuthId[id], g_szIP[id], g_szDate)

__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-15-2017 , 08:19   Re: [REQ] show player info
Reply With Quote #6

Editted my previous code, should always be visible now.

@OciXCrom, can i ask you why you're using two dimensional arrays for ip & steam id? I'm just wondering.

Also is it nessecary to define a TASKID if there's only one task being used?
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-15-2017 , 10:13   Re: [REQ] show player info
Reply With Quote #7

Why are you getting the steamid and ip each second? Changing them during gameplay is impossible, so you need to get them only once and store them in a global variable. Same goes for the date. Also, you display the HUD message each second, and you set the hold time on 12 seconds, so you're overlapping the messages.

How am I supposed to save the steamid/ip in a global variable by using an one dimensional array? The first dimension is the player's id and the second one is the maximum length. It's not the same when you're creating a different array every time for every player each second like you did - it's incorrect.

Other plugins can still remove the task if they call remove_task(id, 1).
__________________

Last edited by OciXCrom; 01-15-2017 at 10:15.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-15-2017 , 11:12   Re: [REQ] show player info
Reply With Quote #8

Quote:
Originally Posted by OciXCrom View Post
Why are you getting the steamid and ip each second? Changing them during gameplay is impossible, so you need to get them only once and store them in a global variable. Same goes for the date. Also, you display the HUD message each second, and you set the hold time on 12 seconds, so you're overlapping the messages.

How am I supposed to save the steamid/ip in a global variable by using an one dimensional array? The first dimension is the player's id and the second one is the maximum length. It's not the same when you're creating a different array every time for every player each second like you did - it's incorrect.

Other plugins can still remove the task if they call remove_task(id, 1).
I'm not retrieving it every second but every 11 seconds, but i understand what you're saying, my mistake. Also, i'm not setting the message every second but every 11 seconds which overlaps the message just for 1 second.

Well you can just retrieve steam id and ip using just regular arrays? get_user_authid & get_user_ip their first parameter is the player index, so i don't see a reason why you should store the id of the player in that array aswell if you can just retrieve it using these natives?

I also understand the the task part you explained, you're right.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-15-2017 , 17:21   Re: [REQ] show player info
Reply With Quote #9

My mistake, I didn't see the 11 seconds task. However, that won't work properly. On many servers the HUD message is expected to disappear in about 3-4 seconds, because most mods use a huge amount of HUD messages and they can't stay on the screen forever. The most reliable way is to repeat the message each second. You can check other plugins - they all do it like that. A 12 second message will never stay for 12 seconds on a server with many plugins.

Yes, you can retrieve it in a regular array, but in order to do that, you will have to retrieve it every time the message is displayed, aka each second. Why would you do that every time when you know that the id and ip cannot change while the user is connected, so you need to store it in a global array which must have a dimension for the player's id.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-15-2017 , 19:21   Re: [REQ] show player info
Reply With Quote #10

Quote:
Originally Posted by OciXCrom View Post
My mistake, I didn't see the 11 seconds task. However, that won't work properly. On many servers the HUD message is expected to disappear in about 3-4 seconds, because most mods use a huge amount of HUD messages and they can't stay on the screen forever. The most reliable way is to repeat the message each second. You can check other plugins - they all do it like that. A 12 second message will never stay for 12 seconds on a server with many plugins.

Yes, you can retrieve it in a regular array, but in order to do that, you will have to retrieve it every time the message is displayed, aka each second. Why would you do that every time when you know that the id and ip cannot change while the user is connected, so you need to store it in a global array which must have a dimension for the player's id.
Oooh okay now i understand, thanks for the explenation, couldn't figure it out myself :p
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
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 09:19.


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