AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   strfind (https://forums.alliedmods.net/showthread.php?t=29047)

Z@C 05-28-2006 15:43

strfind
 
i have this string
strfind(name,"fuck",1) == ?
what must be here (?) if this is true?
name - this is get_user_name

Xanimos 05-28-2006 15:47

if(containi(<NAME VARIABLE> , "fuck") > -1)

Z@C 05-29-2006 10:46

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

KoST 05-29-2006 11:26

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

and MaxTegs + 1 is one too much..

Z@C 05-29-2006 11:37

error in line 19:
if (containi(name,tlist[t]) > -1){
only nick contain tlist[t] and admin_res.

KoST 05-29-2006 11:38

please send whole code..

Z@C 05-29-2006 11:46

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?

Xanimos 05-29-2006 12:11

Show all of your code.

Z@C 05-29-2006 12:44

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) }

KoST 05-29-2006 12:50

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...


All times are GMT -4. The time now is 16:27.

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