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

[CORE] contain & containi


  
 
 
Thread Tools Display Modes
Author Message
buskfaus
Junior Member
Join Date: Mar 2006
Old 02-07-2007 , 17:09   [CORE] contain & containi
#1

I have a problem with both contain and containi functions. I have a setup around here that checks players name 0.5 seconds after the client_authorized event and if name matches some pattern, it basically kicks the player. Now the problem is, that both equal and equali functions work great, and both equal and equali do not. if I put something like (very basically)
Code:
new name[32]
get_user_name(id,name,31)
if(containi(name, "Cheater"))
   server_cmd("kick #%d  Errorneous nickname: Cheater", get_user_userid(id))
this bit above will kick anyone connecting to the server, no matter what their nickname is - "a", "some_nickname" or "hello123" or whatever.
But this bit
Code:
if (equali(name, "killer"))
      server_cmd("kick #%d  Errorneous nickname: killer", get_user_userid(id))
works perfectly fine.
Where's the problem ?
buskfaus is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 02-07-2007 , 17:14   Re: [CORE] contain & containi
#2

This is not a bug. The correct usage is if(containi(x[],y[]) != -1) to check if y is contained anywhere in x.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
BAILOPAN
Join Date: Jan 2004
Old 02-07-2007 , 19:58   Re: [CORE] contain & containi
#3

Please make sure to read the documentation in the future:
http://www.amxmodx.org/funcwiki.php?...aini&go=search

Perhaps you were confused that -1 will be a true case in an if statement. This is because anything non-zero is considered "true."
__________________
egg
BAILOPAN is offline
 



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 17:18.


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