Quote:
Originally Posted by Silencer123
I think he is talking about the Steam ID? *confused*
Code:
new authid[35]
get_user_authid(id,authid,34)
new name[32]
get_user_name(id,name,31)
if(equal(name,"This Name") && equal(authid,"STEAM_0:1:23456789"))
{
// Name is "This Name" and Steam ID is "STEAM_0:1:23456789"
}
|
Yes and no.
equal is usually case sensitive. Using equal to compare a name with a defined name will return false unless the defined is spelled exactly the same as the used name.
This whole thing
Code:
if(equal(name,"This Name") && equal(authid,"STEAM_0:1:23456789"))
will return false if "This Name" doesn't match the name the player is using regardless if the players steamid matches the plugins defined steamid.
Assuming you are correctly retrieving a players steamid, ie. in putinserver, it should look like this:
Code:
new authid[32], name[32]
get_user_authid(id,authid,31)
get_user_name(id,name,31)
if(equal(authid, defined_authid)) // checks if players authid matches defined authid, if it matches proceed.
{
//since we have found the player whose steamid matches the plugins defined steamid, we execute whatever code we want, in this case a client print of the name the person is using.
client_print(id, print_chat, "Hello %s: Your SteamID matches the plugins SteamID", name)
}