Raised This Month: $ Target: $400
 0% 

Having problem with containi


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
killergirl
Senior Member
Join Date: Jul 2010
Old 03-27-2011 , 05:22   Having problem with containi
Reply With Quote #1

I'm trying to make a restriction for clients who changed their name or uses symbols: "~ `"

Here is the code:

PHP Code:
public client_infochanged(id)
{
new 
Name[32]

get_user_name(idName31)

   if(
containi(Name"`"))
   {
      
set_user_info(id"name""SYMBOL")
   }
return 
PLUGIN_HANDLED

The code it's working only if the client change his name into "`". But if the client change his name into "`````````" or "a``````````" the code won't work.
killergirl is offline
lis_16
Senior Member
Join Date: Feb 2008
Old 03-27-2011 , 07:22   Re: Having problem with containi
Reply With Quote #2

Your code should work but try with this:
PHP Code:
if(contain(Name"`") !=-1
lis_16 is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 03-27-2011 , 13:50   Re: Having problem with containi
Reply With Quote #3

Remember that the contain natives return the location where the string was found. -1 being returned if it is not found.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
lis_16
Senior Member
Join Date: Feb 2008
Old 03-27-2011 , 16:20   Re: Having problem with containi
Reply With Quote #4

So if a string we are looking for is first, conatin return 0, so it's found but if don't work. My way should work-works for me
lis_16 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:40.


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