Raised This Month: $32 Target: $400
 8% 

Get a client by name


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
allenwr
Veteran Member
Join Date: Jan 2006
Location: The place where the karm
Old 06-22-2009 , 01:15   Get a client by name
Reply With Quote #1

I haven't had to get a user by name in a long time, I did many searches using target and other criteria and still am at a loss.

example sm_slap joh
Player john was slapped.

Get where I am going?
__________________
Don't ever place an order with Vee Servers. This is why.
allenwr is offline
Send a message via ICQ to allenwr Send a message via Yahoo to allenwr
pheadxdll
AlliedModders Donor
Join Date: Jun 2008
Old 06-22-2009 , 01:26   Re: Get a client by name
Reply With Quote #2

http://wiki.alliedmods.net/Introduct...ltiple_Targets
__________________
pheadxdll is offline
almcaeobtac
Senior Member
Join Date: Nov 2008
Location: Florida
Old 06-22-2009 , 12:47   Re: Get a client by name
Reply With Quote #3

Code:
decl String:TypedName[32]
decl String:TestName[32]
decl String:PlayerName[32]
decl Player
Player = -1
GetCmdArgString(TypedName, 32)
StripQuotes(TypedName)
TrimString(TypedName)

for(new x = 1; x <= GetMaxClients(); x++)
{
    if(IsClientInGame(x))
    {
        GetClientName(x, TestName, 32)
        if(StrContains(TestName, TypedName, false) != -1)
        {
            Player = x
            PlayerName = TestName
        }
    }
}

if(Player == -1)
{
    //no client found for the typed name
}
__________________
almcaeobtac is offline
exvel
SourceMod Donor
Join Date: Jun 2006
Location: Russia
Old 06-22-2009 , 13:15   Re: Get a client by name
Reply With Quote #4

ProcessTargetString
__________________
For admins: My plugins

For developers: Colors library
exvel is offline
Send a message via ICQ to exvel
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:11.


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