Raised This Month: $285 Target: $400
 71% 

help flags


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
1M1e
Member
Join Date: Mar 2020
Old 07-21-2020 , 11:16   help flags
Reply With Quote #1

can some one do this code just who have flag ADMIN_BAN can see who connect ?


Code:
#include <amxmodx>

#define PLUGIN "ConnectDisconnect Message"
#define VERSION "1.0"
#define AUTHOR "AlliedMods"


public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
}

public client_connect(id){
    new szName[32]
    new szID[32]
    get_user_authid(id, szID, 19)
    get_user_name(id, szName, charsmax(szName))
    client_print(0, print_chat, "%s is connecting SteamID(%s)", szName, szID)
}

public client_putinserver(id){
    new szName[32]
    new szID[32]
    get_user_authid(id, szID, 19)
    get_user_name(id, szName, charsmax(szName))
    client_print(0, print_chat, "%s has connected SteamID(%s)", szName, szID)
}  

public client_disconnected(id){
    new szName[32]
    new szID[32]
    get_user_authid(id, szID, 19)
    get_user_name(id, szName, charsmax(szName))
    client_print(0, print_chat, "%s has disconnected SteamID(%s)", szName, szID)
}

Last edited by 1M1e; 07-23-2020 at 16:49.
1M1e is offline
Old 07-23-2020, 16:44
1M1e
This message has been deleted by 1M1e.
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 07-23-2020 , 16:46   Re: help flags
Reply With Quote #2

No because this is not the "do it for me" section. The function you need is "get_user_flags" - try to do it, otherwise post in the REQUESTS section.

Also, that's not how you upload codes in the forum. Use [code], [php] or [pawn] tags.
__________________

Last edited by OciXCrom; 07-23-2020 at 16:47.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
1M1e
Member
Join Date: Mar 2020
Old 07-23-2020 , 16:52   Re: help flags
Reply With Quote #3

Quote:
Originally Posted by OciXCrom View Post
"get_user_flags" [code], [php] or [pawn] tags.
i trid to do

Code:
	if (!(get_user_flags(id) & ADMIN_BAN)
	{
		return PLUGIN_HANDLED
	}
in top of plugin but did not work

Last edited by 1M1e; 07-23-2020 at 16:52.
1M1e is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 07-23-2020 , 17:43   Re: help flags
Reply With Quote #4

Quote:
Originally Posted by 1M1e View Post
i trid to do

Code:
	if (!(get_user_flags(id) & ADMIN_BAN)
	{
		return PLUGIN_HANDLED
	}
in top of plugin but did not work
You need to use this in every function which you want. Not in the header of the plugin
__________________

Last edited by Shadows Adi; 07-23-2020 at 17:44.
Shadows Adi is offline
1M1e
Member
Join Date: Mar 2020
Old 07-23-2020 , 17:52   Re: help flags
Reply With Quote #5

Quote:
Originally Posted by Shadows Adi View Post
You need to use this in every function which you want. Not in the header of the plugin
Code:
#include <amxmodx>

#define PLUGIN "ConnectDisconnect Message"
#define VERSION "1.0"
#define AUTHOR "AlliedMods"


public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
}

public client_connect(id){

		if (!(get_user_flags(id) & ADMIN_BAN))
	{
		return PLUGIN_HANDLED
	}
    new szName[32]
    new szID[32]
    get_user_authid(id, szID, 19)
    get_user_name(id, szName, charsmax(szName))
    client_print(0, print_chat, "%s is connecting SteamID(%s)", szName, szID)
}

public client_putinserver(id){

		if (!(get_user_flags(id) & ADMIN_BAN))
	{
		return PLUGIN_HANDLED
	}
    new szName[32]
    new szID[32]
    get_user_authid(id, szID, 19)
    get_user_name(id, szName, charsmax(szName))
    client_print(0, print_chat, "%s has connected SteamID(%s)", szName, szID)
}  

public client_disconnected(id){

		if (!(get_user_flags(id) & ADMIN_BAN))
	{
		return PLUGIN_HANDLED
	}
    new szName[32]
    new szID[32]
    get_user_authid(id, szID, 19)
    get_user_name(id, szName, charsmax(szName))
    client_print(0, print_chat, "%s has disconnected SteamID(%s)", szName, szID)
}
did not work
1M1e is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 07-23-2020 , 18:16   Re: help flags
Reply With Quote #6

The player doesn't have admin flags while he is connecting.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
1M1e
Member
Join Date: Mar 2020
Old 07-23-2020 , 18:58   Re: help flags
Reply With Quote #7

Quote:
Originally Posted by OciXCrom View Post
The player doesn't have admin flags while he is connecting.
i want just when player connected to server Just admin will see the print chat !
1M1e is offline
ZaX
Senior Member
Join Date: Jan 2015
Old 07-23-2020 , 19:39   Re: help flags
Reply With Quote #8

Make a task of 2 seconds in client_putinserver with the index of the player.
In the task callback function, get the client name or whatever you want then loop through all players, check if the player has the required flags then show message.
ZaX is offline
1M1e
Member
Join Date: Mar 2020
Old 07-24-2020 , 00:37   Re: help flags
Reply With Quote #9

like this ?

Code:
#include <amxmodx>

#define PLUGIN "ConnectDisconnect Message"
#define VERSION "1.0"
#define AUTHOR "AlliedMods"


public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
}

public client_join(id)
{
	 set_task(2.0, "client_connect" ,ADMIN_BAN)
}

public client_connect(id){
    new szName[32]
    new szID[32]
    get_user_authid(id, szID, 19)
    get_user_name(id, szName, charsmax(szName))
    client_print(0, print_chat, "%s is connecting SteamID(%s)", szName, szID)
}

public client_joined(id)
{
	 set_task(2.0, "client_putinserver" ,ADMIN_BAN)
}

public client_putinserver(id){
    new szName[32]
    new szID[32]
    get_user_authid(id, szID, 19)
    get_user_name(id, szName, charsmax(szName))
    client_print(0, print_chat, "%s has connected SteamID(%s)", szName, szID)
}

public client_left(id)
{
	 set_task(2.0, "client_disconnected" ,ADMIN_BAN)
}  

public client_disconnected(id){
    new szName[32]
    new szID[32]
    get_user_authid(id, szID, 19)
    get_user_name(id, szName, charsmax(szName))
    client_print(0, print_chat, "%s has disconnected SteamID(%s)", szName, szID)
}
not work

Last edited by 1M1e; 07-24-2020 at 00:52.
1M1e is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-24-2020 , 02:09   Re: help flags
Reply With Quote #10

No, that is very wrong.

The important part is that you're wanting to print something to all admins that are already in the server. That actually means that you're needing to address the client_print() function, not when the new player joins the server.

The other major requirement for your plugin is that you do do the printing of the message after two events have occurred: the player has joined the server and the the player has been authenticated by Steam (meaning they have a SteamID).

I suggest that you start with just printing the name when the player is put into the server. Get that working first using client_putinserver(). Then, you can add to printing only to admins by replacing your client_print() with a for loop that goes through all connected players and then calling client_print() only on those that have admin access. I suggest that you look for other plugins and threads where you see get_players() being used, most of these will have an example of how to use it and its results in a for loop.

Once you have that working, you can then work on adding the SteamID. The simplest (but not the most proper) would be to do what was previously mentioned to add a delay. So, in client_putinserver() you would use set_task() to call a custom function that contains the player loop code that prints the message.

Try to do some of those steps and if you run into issues, post the code that you've tried and we can help you out. If you make a decent effort to do these steps on your own, people will generally be more willing to help.
__________________
fysiks 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 10:22.


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