AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Scripting with steam id help (https://forums.alliedmods.net/showthread.php?t=105758)

ieGaming 10-08-2009 03:51

Scripting with steam id help
 
I have tried my best and still haven't got it to work. I'm trying make a script that if your steam id is in the steam.ini then it lets you use a certain command. I just need to find out how I can get it to work this is what I think it my be similar to.

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <fun>

new bool:g_command true
new filepath[64],filename[101],readdata[64],readsteam[32],steamid[32],len=0,line=0

public plugin_init()
{
    
register_plugin("command","1.0","UND3RDAWG")
    
register_clcmd("+command","client_authorized",ADMIN_KICK,"bind [key] +command")
    if (
g_command==true)
    
set_task(1.0,"check")
}

public 
check(id)
{
    
get_configsdir(filepath,63)
    
format(filename,100,"%s/steam.ini",filepath)
}

public 
client_authorized(id)
{
    
get_user_authid(idsteamid31)
    
    while(
read_file(filenameline++, readdata63len))
    {
        
parse(readdata,readsteam,31)
        if(
equali(steamid,readsteam))
        {    
            if(!
is_user_alive(id))
            
//command
            
return PLUGIN_CONTINUE
        
}
    }
    return 
PLUGIN_CONTINUE



vitorrd 10-08-2009 07:48

Re: Scripting with steam id help
 
The overall code doesn't make much sense.
First, preffer using local variables than global ones.
Second, you can use a Trie (search the forums for implementations on these) to store the Steam IDs and look them up.
There's no need to complicate it like you did. If you want an example on any of these, feel free to ask for it.

Arkshine 10-08-2009 08:15

Re: Scripting with steam id help
 
Why don't you use the users.ini file ? You can put the steamid you want with a custom level like ADMIN_LEVEL_H ( "t" ). And in your plugin, you use ADMIN_LEVEL_H as level needed.

ieGaming 10-08-2009 10:06

Re: Scripting with steam id help
 
Quote:

Originally Posted by vitorrd (Post 955612)
The overall code doesn't make much sense.
First, preffer using local variables than global ones.
Second, you can use a Trie (search the forums for implementations on these) to store the Steam IDs and look them up.
There's no need to complicate it like you did. If you want an example on any of these, feel free to ask for it.

May I have an example :D

Quote:

Originally Posted by Arkshine (Post 955626)
Why don't you use the users.ini file ? You can put the steamid you want with a custom level like ADMIN_LEVEL_H ( "t" ). And in your plugin, you use ADMIN_LEVEL_H as level needed.

I know but I'm trying to separate it to make it easier on me later on. Also I want to do this without users.ini because I have /admin on my server and want to add people without them showing up as admin

Xellath 10-08-2009 10:17

Re: Scripting with steam id help
 
Quote:

Originally Posted by ieGaming (Post 955687)
I know but I'm trying to separate it to make it easier on me later on. Also I want to do this without users.ini because I have /admin on my server and want to add people without them showing up as admin

The admin checker does not show all the admins added through users.ini, it displays online admins with a specific flag(check the source of admin checker to change the flag).

ieGaming 10-08-2009 11:37

Re: Scripting with steam id help
 
Quote:

Originally Posted by Xellath (Post 955692)
The admin checker does not show all the admins added through users.ini, it displays online admins with a specific flag(check the source of admin checker to change the flag).

I'm still more interested in using trie and the steam.ini


All times are GMT -4. The time now is 22:32.

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