AlliedModders

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

Unidentified 12-27-2005 18:29

Speech
 
When I used this, It gives a response to everything 'EXCEPT' the containi I put. Looky.

Code:
public plugin_init(){     register_clcmd("say","HandleSay") } public HandleSay(id) {     new Speech[192]     read_args(Speech,192)     remove_quotes(Speech)     if( (containi(Speech, "my trigger") == -1)) {         client_print(id,print_chat, "My response")     }     return PLUGIN_CONTINUE }

What's causing this? It's becoming annoying.

Sneakpeek 12-27-2005 18:35

I belive its just
Code:
if((containi(Speech, "my trigger")))

and not with the
Code:
== -1

...at the end.

Because that would print your response if your message does not contain "my trigger"

Unidentified 12-27-2005 18:37

No. Same result.

Sneakpeek 12-27-2005 18:40

Oh now I see whats wrong.

Code:
new Speech[192] read_args(Speech, 191) //You had 192 here

(It still aint "== -1" at the end as I said in the first post)

And btw, you had two "(" at your if statement.
(Cant remeber the word for it :D)

Code:
//It should be if(containi(Speech, "my trigger")) //And not if((containi(Speech, "my trigger")))

Belsebub 12-27-2005 18:43

should be
Code:
if( containi(Speech, "my trigger") != -1)


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

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