View Single Post
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 01-04-2022 , 12:07   Re: [ReAPI] Advanced slot reservation
Reply With Quote #13

People in this topic sound like a broken record, but Shadows Adi also did a poor job explaining why steamid can't be used at this point. This isn't a matter of supporting no steam, during SV_ConnectClient the steamid is not available and no player index is passed to the function.
The IP can be obtained from "netfrom" buffer(which is what the plugin is doing). So, this plugin isn't for no steam.
However, I agree this is not terribly useful right now since most people have dynamic IP. But, if you add the option to reserve slots by name too(see below) then this may be somewhat useful and usable.

@Shadows Adi, you can retrieve the name without the use of extra ReAPI functions, no need to add anything to the API. See the following example:

PHP Code:
public SV_ConnectClient()
{
    new 
userinfo[1024]
    
read_args(userinfocharsmax(userinfo))

    new 
keyPos contain(userinfo"name")
    if(
keyPos != -1)
    {
        new 
buffer[1024]
        
copy(buffercharsmax(buffer), userinfo[keyPos])

        new 
key[32], temp[512], name[32], unused[512]
        
strtok(bufferkeycharsmax(key), tempcharsmax(temp), '\')
        strtok(temp, name, charsmax(name), unused, charsmax(unused), '
\')

        server_print("name = [%s]", name)
    }

name will contain the player name.

I can also provide the orpheu signature, if you want to add support for regular hlds. You don't have to deal with a lot of orpheu specific code, in case you were wondering.
__________________

Last edited by HamletEagle; 01-04-2022 at 12:17.
HamletEagle is offline