English "return 1" dont working

4 replies
Goto Page
To the start Previous 1 Next To the start
01.12.21 06:26:24 pm
Up
JustMebruh
User
Offline Off
For all commands i make other hook (like command "!kill" = new hook). And this is "say" hook, i return 1 (make this message invisible). If i type "!kill" - message dont send to server, if i type "!give" - message SEND to server. I dont know how to fix it, but, if i swap places (first was "!give", second was "!kill"), then if i type "!kill" - message send to server, if i type "!give" - message dont send to server.
01.12.21 06:41:14 pm
Up
Mora_rus
User
Offline Off
There is the working code:
There is nothing helpful >


Maybe your code should be like
Code:
1
2
3
4
5
6
7
if say == "!kill" then
 Msg()
 return 1
elseif say == "!give" then
 Msg()
 return 1
end
01.12.21 07:10:47 pm
Up
JustMebruh
User
Offline Off
@user Mora_rus: this code is very big, and i, maybe, make new plugin.
01.12.21 07:19:00 pm
Up
Bowlinghead
User
Offline Off
If you got multiple say-hooks then you have to work with priority, probably. Only the last executed hook will make use of return 1;

Quote:
The attached function with the HIGHEST priority is the function which will be executed LAST. CS2D will take the return value of this last function (if there is any) only. All other return values will be ignored. This is because CS2D can only react in ONE way at a time and therefore it can only process ONE return value even though there are multiple hooked functions.
In most cases you will just omit the priority parameter (it is [optional]).


cs2d lua cmd addhook
Share time limited free games here
02.12.21 05:16:27 am
Up
Mora_rus
User
Offline Off
user JustMebruh has written:
@user Mora_rus: this code is very big, and i, maybe, make new plugin.

Not required to share the full code, maybe for now just say hook(or say hooks? If many)
To the start Previous 1 Next To the start