Raised This Month: $32 Target: $400
 8% 

Check for Z flag and show the steam name from steamid


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
amicull
Junior Member
Join Date: Feb 2017
Old 03-31-2020 , 16:51   Check for Z flag and show the steam name from steamid
Reply With Quote #1

Hello AM! I'm tryin' to do a script that check for owner and display it in chat. Like, Owner *player* has connected. And when he is disconnected, i want to show the name of the owner from steamid (any, i don't care. 64 is used how i saw). And i want to display the steam name from steamid because it's more dynamic, me and my friend we are changing names often, so i don't have to change the code and recompile again (or an cfg file.). To be more explicit, let's give an example.. sm_info should tell you if owner is on or not. And should say who's the owner if you have a problem, you can contact him. I looked a bit on forum and found this:
Code:
for(new i = 1 ; i <= GetMaxClients();i++)
	{
		if(IsClientInGame(i))
		{
			new AdminId:AdminID = GetUserAdmin(i);
			if(AdminID != INVALID_ADMIN_ID)
			{
			{
				GetClientName(i, AdminNames[count], sizeof(AdminNames[]));
				count++;
			}
			}
		}
But i think i should use GetUserFlagBit then use & ADMFLAG_ROOT . I didn't got it how ADMINID works. i'm messed up right now. But, if !(GetUserFlagBits(client) & ADMFLAG_ROOT) should work for offline print? I don't know what i should do more, to be honest.

Thanks in advice.

Last edited by amicull; 04-01-2020 at 02:24.
amicull is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 03-31-2020 , 17:10   Re: Check for Z flag and show the steam name from steamid
Reply With Quote #2

Is this for amxmodx or sourcemod? The code u provided is one for sourcemod.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
amicull
Junior Member
Join Date: Feb 2017
Old 04-01-2020 , 02:23   Re: Check for Z flag and show the steam name from steamid
Reply With Quote #3

Quote:
Originally Posted by Napoleon_be View Post
Is this for amxmodx or sourcemod? The code u provided is one for sourcemod.
My bad... i should put the post in sourcemod subforum.
amicull is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 04-02-2020 , 09:03   Re: Check for Z flag and show the steam name from steamid
Reply With Quote #4

Well, I'm just saying, these old school admin flag bit checks are like bad practising.
Another is, grant anyone with admin flag ROOT "Z", this bypass all things. It's pain in the ass at the end.





Anyway, I'm suggesting, to make admin group called "owner".
And plugin works on admin(s) which have granted into that admin group.

- Add Owners in admins.cfg, not in admins_simple.ini

...addons\sourcemod\configs\admin_groups.cfg


...addons\sourcemod\configs\admins.cfg



Here is little example.
- This only works now when owners are in game. Connect and disconnect message.
- Command sm_info, show owners in game.

plugin code
Bacardi is offline
amicull
Junior Member
Join Date: Feb 2017
Old 04-02-2020 , 17:44   Re: Check for Z flag and show the steam name from steamid
Reply With Quote #5

Quote:
Originally Posted by Bacardi View Post
Well, I'm just saying, these old school admin flag bit checks are like bad practising.
Another is, grant anyone with admin flag ROOT "Z", this bypass all things. It's pain in the ass at the end.





Anyway, I'm suggesting, to make admin group called "owner".
And plugin works on admin(s) which have granted into that admin group.

- Add Owners in admins.cfg, not in admins_simple.ini

...addons\sourcemod\configs\admin_groups.cfg


...addons\sourcemod\configs\admins.cfg



Here is little example.
- This only works now when owners are in game. Connect and disconnect message.
- Command sm_info, show owners in game.

plugin code

Thank you very much mate! You helped me a lot! But, the question is, for offline prints how i should make it? SteamAPI?

Edit: how can i get the plugin to print the command "!info" in chat on client connect and after 5 minutes every time? (i know the advertisments should make this, but is a competitive server. No other plugins... just this plugin what i made. Thanks to Bacardi for helping me btw)

Last edited by amicull; 04-02-2020 at 17:48.
amicull is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 04-02-2020 , 18:01   Re: Check for Z flag and show the steam name from steamid
Reply With Quote #6

Fetching player name from Steam page is kindy... lot of work
I found one example https://forums.alliedmods.net/showth...95#post2606995
You need WebApi key to make http request.

What you say, if we just store owners(s) in simple KeyValues file on server ?
Once owner(s) have visit on server, they have stored in file, then you can print those in "offline".
And we can update owner name in file also.
__________________
Do not Private Message @me
Bacardi is offline
amicull
Junior Member
Join Date: Feb 2017
Old 04-02-2020 , 19:05   Re: Check for Z flag and show the steam name from steamid
Reply With Quote #7

Quote:
Originally Posted by Bacardi View Post
Fetching player name from Steam page is kindy... lot of work
I found one example https://forums.alliedmods.net/showth...95#post2606995
You need WebApi key to make http request.

What you say, if we just store owners(s) in simple KeyValues file on server ?
Once owner(s) have visit on server, they have stored in file, then you can print those in "offline".
And we can update owner name in file also.
I know what you mean... like owners.txt )) but i can do that trick? Like a timer to show up the command in chat every 5 min?
amicull is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 04-02-2020 , 19:18   Re: Check for Z flag and show the steam name from steamid
Reply With Quote #8

I think you can do that. Here is good place to read more. https://wiki.alliedmods.net/Category...eMod_Scripting


This is version with KeyValue.
kv file is saved in ...addons/sourcemod/data/kvStore_Owners.txt
-- If you wish to edit that kv file -> unload plugin before that or else it write with current data.
Spoiler
__________________
Do not Private Message @me

Last edited by Bacardi; 04-02-2020 at 19:18. Reason: link
Bacardi is offline
amicull
Junior Member
Join Date: Feb 2017
Old 04-03-2020 , 14:17   Re: Check for Z flag and show the steam name from steamid
Reply With Quote #9

Quote:
Originally Posted by Bacardi View Post
I think you can do that. Here is good place to read more. https://wiki.alliedmods.net/Category...eMod_Scripting


This is version with KeyValue.
kv file is saved in ...addons/sourcemod/data/kvStore_Owners.txt
-- If you wish to edit that kv file -> unload plugin before that or else it write with current data.
Spoiler

Mate... you did all the work for me... I can't thank enough for helping me ;) !
I don't know how sourcepaw works, but i wanted to do like this
Code:
#include fstream
ifstream InputFile
ofstream OutputFile
public void Saving_owners()
{
OutputFile.open(owner_save.txt)
....
}
Then putting all into a string and printing that string in OutFile and when was called !info command, the txt file was updated. Old School C++ ))
But now i realized that, if is just 1 owner on, the second one will disappear form save file. It's more complicated how i though it will be ))

For now, is ok... i don't have so much free-time... Anyway, thank you very much Bacardi. You destroyed me ))
amicull is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 04-03-2020 , 14:56   Re: Check for Z flag and show the steam name from steamid
Reply With Quote #10

Hey look, how I started my coding practising ( 24-04-10)
Almost 10 years ago. Times fly.

Simple code what start count headshot [Help]

Thanks to all forum users, who have helped, show they code snippets and plugins. But I never learn english very well.
__________________
Do not Private Message @me

Last edited by Bacardi; 04-03-2020 at 14:58.
Bacardi is offline
Reply


Thread Tools
Display Modes

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 19:45.


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