Raised This Month: $ Target: $400
 0% 

strfind


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Z@C
Member
Join Date: May 2006
Location: Moscow, Russia
Old 05-28-2006 , 15:43   strfind
Reply With Quote #1

i have this string
strfind(name,"fuck",1) == ?
what must be here (?) if this is true?
name - this is get_user_name
__________________
HLDS protocol 48 (CS 1.1.2.6 build 4883 on FreeBSD 9.0)
AMXX v1.8.1.3746 | METAMOD v1.19p32 | DProto 0.9.87
Web: Nginx 1.0.10 (build 1.1), Apache 2.2.21, PHP 5.3.8, MySQL 5.5.17
Z@C is offline
Send a message via ICQ to Z@C
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 05-28-2006 , 15:47  
Reply With Quote #2

if(containi(<NAME VARIABLE> , "fuck") > -1)
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
Z@C
Member
Join Date: May 2006
Location: Moscow, Russia
Old 05-29-2006 , 10:46  
Reply With Quote #3

look...

new tlist[MaxTegs][] = {"TEG","TE G","T EG","T E G"}
new nlist[MaxNicks][] = {"fuck"}

but when user connected i have error in console. i think "space" is error.

Code:
for (new t = 0; t < MaxTegs + 1; t++){         if (containi(name,tlist[t]) > -1){             if (get_user_flags(id) & ADMIN_RESERVATION){                 return PLUGIN_CONTINUE             }             else {                 format(Reason,127,"Nick ^"%s^" is forbid. Change your Nickname or communicate with admins",name)                 action(id)             }         }     }         for (new n = 0; n < MaxNicks + 1; n++){         if (containi(name,nlist[n]) > -1){             if (get_user_flags(id) & ADMIN_RESERVATION){                 return PLUGIN_CONTINUE             }             else {                 format(Reason,127,"In your nick ^"%s^" found a word is ^"fuck^". Change your Nickname",name)                 action(id)             }         } }

and word "fuck" not found.
help me plz
__________________
HLDS protocol 48 (CS 1.1.2.6 build 4883 on FreeBSD 9.0)
AMXX v1.8.1.3746 | METAMOD v1.19p32 | DProto 0.9.87
Web: Nginx 1.0.10 (build 1.1), Apache 2.2.21, PHP 5.3.8, MySQL 5.5.17
Z@C is offline
Send a message via ICQ to Z@C
KoST
Senior Member
Join Date: Jul 2005
Old 05-29-2006 , 11:26  
Reply With Quote #4

Code:
            if (get_user_flags(id) & ADMIN_RESERVATION){                 return PLUGIN_CONTINUE             }
put that above for loop

and MaxTegs + 1 is one too much..
__________________
KoST is offline
Z@C
Member
Join Date: May 2006
Location: Moscow, Russia
Old 05-29-2006 , 11:37  
Reply With Quote #5

error in line 19:
if (containi(name,tlist[t]) > -1){
only nick contain tlist[t] and admin_res.
__________________
HLDS protocol 48 (CS 1.1.2.6 build 4883 on FreeBSD 9.0)
AMXX v1.8.1.3746 | METAMOD v1.19p32 | DProto 0.9.87
Web: Nginx 1.0.10 (build 1.1), Apache 2.2.21, PHP 5.3.8, MySQL 5.5.17
Z@C is offline
Send a message via ICQ to Z@C
KoST
Senior Member
Join Date: Jul 2005
Old 05-29-2006 , 11:38  
Reply With Quote #6

please send whole code..
__________________
KoST is offline
Z@C
Member
Join Date: May 2006
Location: Moscow, Russia
Old 05-29-2006 , 11:46  
Reply With Quote #7

Quote:
Originally Posted by KoST
and MaxTegs + 1 is one too much..
if will MaxTegs without +1,then final "TEG" no will be checked
mb if i write:
Code:
for (new t = MaxTegs; t > 0; t--)
this is better?
__________________
HLDS protocol 48 (CS 1.1.2.6 build 4883 on FreeBSD 9.0)
AMXX v1.8.1.3746 | METAMOD v1.19p32 | DProto 0.9.87
Web: Nginx 1.0.10 (build 1.1), Apache 2.2.21, PHP 5.3.8, MySQL 5.5.17
Z@C is offline
Send a message via ICQ to Z@C
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 05-29-2006 , 12:11  
Reply With Quote #8

Show all of your code.
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
Z@C
Member
Join Date: May 2006
Location: Moscow, Russia
Old 05-29-2006 , 12:44  
Reply With Quote #9

Code:
#include <amxmod> #define MaxTegs 5 #define MaxNicks 1 new tlist[MaxTegs][] = {"[T-90]","[ T - 90 ]","[ T-90 ]","T-90","T - 90"} new nlist[MaxNicks][] = {"fuck"} new Reason[128],name[32] public plugin_init(){     register_plugin("NickNameForbider","1.0","[T-90] Z@C") } public client_authorized(id){     get_user_name(id,name,31)         if (get_user_flags(id) & ADMIN_RESERVATION){         return PLUGIN_CONTINUE     }     else {         for (new t = MaxTegs; t > 0; t--){             if (containi(name,tlist[t]) > -1){                 format(Reason,127,"Nick ^"%s^" is forbid. Change your Nickname or communicate with admins",name)                 action(id)             }         }                 for (new n = MaxNicks; n > 0; n--){             if (containi(name,nlist[n]) > -1){                 format(Reason,127,"In your nick ^"%s^" found a word is ^"fuck^". Change your Nickname",name)                 action(id)             }         }                 if (strcmp(name,"player",1) == 0 || strcmp(name,"unnamed",1) == 0 || strcmp(name,"chicken",1) == 0){             format(Reason,127,"Nick ^"%s^" is banned. Change your Nickname",name)             action(id)         }                 if (strlen(name) < 3){             format(Reason,127,"Nick ^"%s^" very short. Change your Nickname",name)             action(id)         }     }     return PLUGIN_HANDLED } public action(id){     server_cmd("kick #%d ^"%s^"",get_user_userid(id),Reason) }
__________________
HLDS protocol 48 (CS 1.1.2.6 build 4883 on FreeBSD 9.0)
AMXX v1.8.1.3746 | METAMOD v1.19p32 | DProto 0.9.87
Web: Nginx 1.0.10 (build 1.1), Apache 2.2.21, PHP 5.3.8, MySQL 5.5.17
Z@C is offline
Send a message via ICQ to Z@C
KoST
Senior Member
Join Date: Jul 2005
Old 05-29-2006 , 12:50  
Reply With Quote #10

Code:
for (new t = 0; t<MaxTegs ; t++)
also return each time after calling action(id)..since one test is positive it need not check the other cases...
__________________
KoST 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 16:27.


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