AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Set special info for player (https://forums.alliedmods.net/showthread.php?t=299955)

Celena Luna 07-31-2017 11:51

Set special info for player
 
I want to set an info for 1 player and only on that PC only (Like a special reward and prevent to share it).

I used set_user_info and get_user_info but I think it didn't work

PHP Code:

public test(id)
{
    static 
name[35]; 
    
    for(new 
1g_MaxPlayersi++)
    {
        
get_user_name(idnamecharmaxs(name))

        if(
equal(name"Celena  Luna"))
        {
            
set_user_info(id"_sp""656")
            break
        }
    }
}

public 
client_putinserver(id)
{
    new 
info[5]
    
get_user_info(id"_sp"infocharmaxs(info))
    if(
str_to_num(info) == 656)
        
g_special[id] = true



leonardo121 07-31-2017 12:21

Re: Set special info for player
 
try
PHP Code:

get_user_name(idnamecharmaxs(name)) 

:arrow:

PHP Code:

get_user_name(idnamecharmax(name)) 

--
why this is starting with 1 ?
PHP Code:

 for(new 1g_MaxPlayersi++) 


Natsheh 07-31-2017 13:25

Re: Set special info for player
 
No such thing is charmaxs its charsmax and use get players will return in array all the connected players

And you method is bad to set your access if your name.. Is celna etc.

wickedd 07-31-2017 13:47

Re: Set special info for player
 
It would be a lot easier if you use the player SteamID.

Celena Luna 07-31-2017 17:39

Re: Set special info for player
 
Quote:

Originally Posted by leonardo121 (Post 2538882)
try
PHP Code:

get_user_name(idnamecharmaxs(name)) 

:arrow:

PHP Code:

get_user_name(idnamecharmax(name)) 


I wrote too fast xD

Quote:

Originally Posted by leonardo121 (Post 2538882)
why this is starting with 1 ?
PHP Code:

 for(new 1g_MaxPlayersi++) 


I usually start with 0 but sometime it got Out of Range so I try to start with 1 this time

Quote:

Originally Posted by Natsheh (Post 2538899)
And you method is bad to set your access if your name.. Is celna etc.

I use player name to test (just too lazy to get steamid).
Why it is bad anyway? :<

Quote:

Originally Posted by wickedd (Post 2538905)
It would be a lot easier if you use the player SteamID.

Like I said, I want it on 1 computer only (well if he didn't know of course :P) so I check both SteamID and an info.

Natsheh 07-31-2017 17:42

Re: Set special info for player
 
0 is the server id/worldspawn. And 1 is the first playerslot id.

Did you paid an attention at my previous post?

Celena Luna 07-31-2017 17:57

Re: Set special info for player
 
Quote:

Originally Posted by Natsheh (Post 2538949)
0 is the server id/worldspawn. And 1 is the first playerslot id.

Did you paid an attention at my previous post?

PHP Code:

static Players[32], iNumSteamID[10]
get_players(PlayersiNum)
for (new 
0iNum; ++i)
{
    
//get_user_name(id, name, charsmax(name)) 
    
get_user_authid(idSteamIDcharsmax(SteamID)

        if(
equal(SteamIDsp_player)) 
        { 
            
set_user_info(id"_sp""656"
            break 
        }
}

public 
client_putinserver(id

    new 
info[5
    
get_user_info(id"_sp"infocharsmax(info)) 
    if(
str_to_num(info) == 656
        
g_special[id] = true 



Natsheh 07-31-2017 18:15

Re: Set special info for player
 
PHP Code:

new Players[32], iNumSteamID[32]
get_players(PlayersiNum)
for (new 
iPlayeriNumi++)
{
     
Player Players[i]
    
//get_user_name(id, name, charsmax(name)) 
    
get_user_authid(PlayerSteamIDcharsmax(SteamID)

        if(
equal(SteamIDsp_player)) 
        { 
            
set_user_info(id"_sp""656"
            break 
        }


Here you go anyway your whole idea its seems for nonsteam unfortunately

wickedd 07-31-2017 19:50

Re: Set special info for player
 
This is a bad idea. Because if the player config.cfg is set to read only, this will only last until he closes CS.

Celena Luna 08-02-2017 03:22

Re: Set special info for player
 
Yeah, it is bad idea. I will think about other way :(


All times are GMT -4. The time now is 23:09.

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