Raised This Month: $51 Target: $400
 12% 

n00b question : SearchForClients Alternatives


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MoggieX
Veteran Member
Join Date: Aug 2007
Location: n00bville
Old 01-22-2008 , 05:39   n00b question : SearchForClients Alternatives
Reply With Quote #1

Morning,

Brace ya self, another n00b question coming :-P

Currently I'm using the sm cash plugin by ferret as a base for another plugin however its using SearchForClients() function to locate the target, when compiling, it gives a warnign that its depreciated.

However when I try the alternatives [FindTarget() or ProcessTargetString()] I receive back:

'argument type mismatch (argument 1)'

This is what I have written, can some point me in the right direction to using one of the alternatives? Where 'name' is the target

PHP Code:
// find a target
    
new iClients[3];
    new 
iNumClients FindTarget(nameiClients3);
    
    if (
iNumClients == 0)
    {
        
PrintToChatAll("\x04[SM Colour]\x01 No matching client");
        
//ReplyToCommand(client, "[SM Colour] %t", "No matching client");
        
return Plugin_Handled;
    }
    else if (
iNumClients 1)
    {
        
PrintToChatAll("\x04[SM Colour]\x01 More than one client matches");
        
//ReplyToCommand(client, "[SM Colour] %t", "More than one client matches", name);
        
return Plugin_Handled;
    }
    else if (!
CanUserTarget(clientiClients[0]))
    {
        
PrintToChatAll("\x04[SM Colour]\x01 Unable to target");
        
//ReplyToCommand(client, "[SM Colour] %t", "Unable to target");
        
return Plugin_Handled;
    }
other code here.... 
BTW once this is done, I'll be ready to release it!

Matt
__________________
MoggieX is offline
Send a message via Skype™ to MoggieX
MoggieX
Veteran Member
Join Date: Aug 2007
Location: n00bville
Old 01-22-2008 , 08:47   Re: n00b question : SearchForClients Alternatives
Reply With Quote #2

hmmm.... ignore the above the base commands appear to be what I was looking for as it looks like the extra coding added to check the clinets has now been added to ProcessTargetString() and will do the vast majority of the checking!

Matt
__________________
MoggieX is offline
Send a message via Skype™ to MoggieX
ferret
SourceMod Developer
Join Date: Dec 2004
Location: Atlanta, GA
Old 01-28-2008 , 10:21   Re: n00b question : SearchForClients Alternatives
Reply With Quote #3

FindTarget is a very simple stock meant to hide and wrap up the ProcessTargetString and error message handling. It's only really meant for commands that will only target a single player. If you need stuff like @all/@team, don't use it.

Sounds like you got where you need to go though.
__________________
I'm a blast from the past!
ferret is offline
MoggieX
Veteran Member
Join Date: Aug 2007
Location: n00bville
Old 01-29-2008 , 07:27   Re: n00b question : SearchForClients Alternatives
Reply With Quote #4

Quote:
Originally Posted by ferret View Post
FindTarget is a very simple stock meant to hide and wrap up the ProcessTargetString and error message handling. It's only really meant for commands that will only target a single player. If you need stuff like @all/@team, don't use it.

Sounds like you got where you need to go though.
Hi Ferret,

Yes I did after trawling through the base plugins

BTW The reason for the post as I was using your cash plugin as a base which uses that function and wanted an alternative so that the plugin I was writting it would be approved (not using a depreciated function)

Matt
__________________
MoggieX is offline
Send a message via Skype™ to MoggieX
ferret
SourceMod Developer
Join Date: Dec 2004
Location: Atlanta, GA
Old 01-29-2008 , 13:53   Re: n00b question : SearchForClients Alternatives
Reply With Quote #5

Yeah cash is very old. It was written before ProcessTargetString was added (Many many months bebfore). In fact, it was written before FindTarget was made a base stock.
__________________
I'm a blast from the past!
ferret is offline
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 14:30.


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