AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to make this give permission on IP? (https://forums.alliedmods.net/showthread.php?t=340586)

Apocalyman 11-26-2022 09:51

How to make this give permission on IP?
 
Theres this plugin for CS that is basically admins_manager but simplified. However, it puts the permissions on steam ID and I tried playing around with it change to it to IP but to no avail (I dont know how to program) it gives "Client with that name or userid not found" in the server console but for some reason with authid (steamid) it works perfectly fine. If someone knows how to make this IP please let me know! thank you!
Code link: https://pastebin.com/ZAdaL7br

CryWolf 12-06-2022 03:30

Re: How to make this give permission on IP?
 
Code:

get_user_authid(plr, playerid, sizeof playerid - 1);
to ----->
PHP Code:

get_user_ip plrplayeridcharsmax (playerid) ); 


Apocalyman 08-07-2023 18:30

Re: How to make this give permission on IP?
 
Quote:

Originally Posted by CryWolf (Post 2794563)
Code:

get_user_authid(plr, playerid, sizeof playerid - 1);
to ----->
PHP Code:

get_user_ip plrplayeridcharsmax (playerid) ); 


It doesnt work I tried

MrPickles 08-07-2023 21:24

Re: How to make this give permission on IP?
 
Quote:

Originally Posted by CryWolf (Post 2794563)
Code:

get_user_authid(plr, playerid, sizeof playerid - 1);
to ----->
PHP Code:

get_user_ip plrplayeridcharsmax (playerid) ); 


Did you know that this does the same thing perfectly? Charsmax is the size of - 1.

I don't think it's possible, you have to rebuild the code and match the ip before giving permissions, to give a range if or if the STEAMID has to be used, it is based on that, not the ip, you could try placing a condition before giving the permission checking if the ip is correct, like:

PHP Code:

    new plr str_to_num(Data);
 
    
get_user_name(idownerNamesizeof ownerName 1);
    
get_user_name(plrplayerNamesizeof playerName 1);
    
get_user_authid(plrplayeridsizeof playerid 1); 
 
    new 
szIP[32]
    
get_user_ip(plrszIPcharsmax(szIP), 1)

    if( 
equalszIP"188.212") )
    {
         
server_cmd("amx_addadmin ^"%s^" ^"%s^""playeridaccFlags[szKey]);
         
ColorChat(0"Owner ^4%s^1 Gave^4 %s^1 Access To^4 %s"ownerNameaccNames[szKey], playerName); 
         
server_cmd("amx_reloadadmins")
    }
    
menu_destroy(setLevel);
    return 
PLUGIN_HANDLED


fysiks 08-07-2023 23:27

Re: How to make this give permission on IP?
 
There is no good reason to use IP instead of SteamID. Just use SteamID.

Apocalyman 08-08-2023 11:05

Re: How to make this give permission on IP?
 
Quote:

Originally Posted by MrPickles (Post 2808355)
Did you know that this does the same thing perfectly? Charsmax is the size of - 1.

I don't think it's possible, you have to rebuild the code and match the ip before giving permissions, to give a range if or if the STEAMID has to be used, it is based on that, not the ip, you could try placing a condition before giving the permission checking if the ip is correct, like:

PHP Code:

    new plr str_to_num(Data);
 
    
get_user_name(idownerNamesizeof ownerName 1);
    
get_user_name(plrplayerNamesizeof playerName 1);
    
get_user_authid(plrplayeridsizeof playerid 1); 
 
    new 
szIP[32]
    
get_user_ip(plrszIPcharsmax(szIP), 1)

    if( 
equalszIP"188.212") )
    {
         
server_cmd("amx_addadmin ^"%s^" ^"%s^""playeridaccFlags[szKey]);
         
ColorChat(0"Owner ^4%s^1 Gave^4 %s^1 Access To^4 %s"ownerNameaccNames[szKey], playerName); 
         
server_cmd("amx_reloadadmins")
    }
    
menu_destroy(setLevel);
    return 
PLUGIN_HANDLED


If its that complicated then staying with steamID will probably be for the best. Do you perhaps know if its possible to add a remove admin section to the menu so I can remove permissions with it too and just not give?

fysiks 08-08-2023 23:05

Re: How to make this give permission on IP?
 
Removing admins isn't a functionality that is built into AMX Mod X. I think I recall people asking for something like this in the past, you should search around to see if you can find if there was any solutions implemented.


All times are GMT -4. The time now is 00:19.

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