forgot something in scripting
11 replies



18.10.16 11:04:12 pm
well i know its not big problem but i get some errors and i forgot how to fix it

if i type !rs in chat box
i won't !rs show in chat box
how ?
plz fast help
cuz i am noob in scripting i need to fix this
sry for my bad english hope u get the idea
if i type !rs in chat box
i won't !rs show in chat box
how ?
plz fast help
cuz i am noob in scripting i need to fix this
sry for my bad english hope u get the idea

In the

return 1
to disable your chat message being shown in chat, take a look at the documentation. @
Yates:
didn't work i tried it before i don't know why

didn't work i tried it before i don't know why

@
Yates:
didn't work i tried it before i don't know why

didn't work i tried it before i don't know why
If you are running more than one script at once combine all of the say hooks, if not make sure the return 1 is at the bottom of the say hook (before end)
It's hard being the best girl in the whole entire world
ok lets test this
or this
still not working
Code:
1
2
3
4
5
6
7
2
3
4
5
6
7
addhook("say" , "saycommand3")
function saycommand3(id,txt)
if(txt=="!test") then
parse("kill "..id.."")
return 1
end
end
function saycommand3(id,txt)
if(txt=="!test") then
parse("kill "..id.."")
return 1
end
end
or this
Code:
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
testlist = {usgnhere}
addhook("say","testsay")
function testsay(id,txt)
for _, usgn in ipairs(testlist) do
if player(id,'usgn') == usgn then
msg("©000255000"..player(id,"name").."©255128000 [test]:©000255000 "..txt)
return 1
end
end
end
addhook("say","testsay")
function testsay(id,txt)
for _, usgn in ipairs(testlist) do
if player(id,'usgn') == usgn then
msg("©000255000"..player(id,"name").."©255128000 [test]:©000255000 "..txt)
return 1
end
end
end
still not working
Code:
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
addhook("say","rs_say")
function rs_say(id,txt)
if txt == "!rs" then
parse("setscore "..id.." 0")
parse("setdeaths "..id.." 0")
msg2(id,"©255255255Score reset.")
return 1
end
end
function rs_say(id,txt)
if txt == "!rs" then
parse("setscore "..id.." 0")
parse("setdeaths "..id.." 0")
msg2(id,"©255255255Score reset.")
return 1
end
end
If not work remove all script you used and use this script
edited 2×, last 19.10.16 01:06:11 am
One thing I'll never understand here is people ask for help with a problem on their script(s) BUT don't post the code for troubleshoot. Showing the code saves lots of time everyone of us. At this time I can only go through guessing.
Did you by any chance write two or more times the addhook
say parameters with the same name? Doing this could also trigger the problem besides of what people mentioned here. Check your code twice carefully. Regarding the two chunk of code you've posted they both work as expected.
Did you by any chance write two or more times the addhook

this is the code i am using and its not working
then i changed the return 1 place
now its working but if you pressed "Z" you can't post anything in chat cuz no thing is showing
hope someone hlep me
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
addhook("say" , "sayhook1")
function sayhook1(id,txt)
if(txt=="!help") then
msg2(id,"©000255000!rs")
msg2(id,"©000255000!kill")
msg2(id,"©000255000!hats")
msg2(id,"©000255000!mypos")
msg2(id,"©000255000!angry")
msg2(id,"©000255000!kickme")
msg2(id,"©000255000!armors")
msg2(id,"©000255000!powers")
msg2(id,"©000255000!weapons")
end
if(txt=="!rs") then
parse ("setscore "..id.." 0")
parse ("setdeaths "..id.." 0")
msg2(id,"©255000000[SERVER]:".."©000255000 Score reseted successful.")
end
if(txt=="!kill") then
parse ("kill "..id.."")
end
if(txt=="!kickme") then
parse ("kick "..id.."")
end
if(txt=="!weapons") then
menu(id,"Weapons Menu 1 / 2,M3|1000$,M4A1|2600$,M249|5000$,,Flamerthrower|16000$,Rocket Launcher|3 Score,RPG Launcher|4 Score,,Next|>>")
end
if(txt=="!armors") then
menu(id,"Armors Menu,Light Armor|3000$,Medium Armor|15000$,Medic Armor|5 Score,Heavy Armor|10 Score,Super Armor|45 Score,,,,Stealth Suit|3000$")
end
if(txt=="!powers") then
menu(id,"Powers Menu,5x Speed|10 Score,Full Healthy|12 Score,,Teleport CT|10 Score,Teleport T|10 Score,,Restart|35 Score,Kill All|40 Score,+1 Score|16000$")
end
if(txt=="!hats") then
menu(id,"Hats Menu 1 / 2,Armor,Gandalf,Marine,Priate,Angel,Devil,Graduation,Party,Next|>>")
end
if(txt=="!angry") then
parse("shake "..id.." 100")
return 1
end
end
function sayhook1(id,txt)
if(txt=="!help") then
msg2(id,"©000255000!rs")
msg2(id,"©000255000!kill")
msg2(id,"©000255000!hats")
msg2(id,"©000255000!mypos")
msg2(id,"©000255000!angry")
msg2(id,"©000255000!kickme")
msg2(id,"©000255000!armors")
msg2(id,"©000255000!powers")
msg2(id,"©000255000!weapons")
end
if(txt=="!rs") then
parse ("setscore "..id.." 0")
parse ("setdeaths "..id.." 0")
msg2(id,"©255000000[SERVER]:".."©000255000 Score reseted successful.")
end
if(txt=="!kill") then
parse ("kill "..id.."")
end
if(txt=="!kickme") then
parse ("kick "..id.."")
end
if(txt=="!weapons") then
menu(id,"Weapons Menu 1 / 2,M3|1000$,M4A1|2600$,M249|5000$,,Flamerthrower|16000$,Rocket Launcher|3 Score,RPG Launcher|4 Score,,Next|>>")
end
if(txt=="!armors") then
menu(id,"Armors Menu,Light Armor|3000$,Medium Armor|15000$,Medic Armor|5 Score,Heavy Armor|10 Score,Super Armor|45 Score,,,,Stealth Suit|3000$")
end
if(txt=="!powers") then
menu(id,"Powers Menu,5x Speed|10 Score,Full Healthy|12 Score,,Teleport CT|10 Score,Teleport T|10 Score,,Restart|35 Score,Kill All|40 Score,+1 Score|16000$")
end
if(txt=="!hats") then
menu(id,"Hats Menu 1 / 2,Armor,Gandalf,Marine,Priate,Angel,Devil,Graduation,Party,Next|>>")
end
if(txt=="!angry") then
parse("shake "..id.." 100")
return 1
end
end
then i changed the return 1 place
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
addhook("say" , "sayhook1")
function sayhook1(id,txt)
if(txt=="!help") then
msg2(id,"©000255000!rs")
msg2(id,"©000255000!kill")
msg2(id,"©000255000!hats")
msg2(id,"©000255000!mypos")
msg2(id,"©000255000!angry")
msg2(id,"©000255000!kickme")
msg2(id,"©000255000!armors")
msg2(id,"©000255000!powers")
msg2(id,"©000255000!weapons")
end
if(txt=="!rs") then
parse ("setscore "..id.." 0")
parse ("setdeaths "..id.." 0")
msg2(id,"©255000000[SERVER]:".."©000255000 Score reseted successful.")
end
if(txt=="!kill") then
parse ("kill "..id.."")
end
if(txt=="!kickme") then
parse ("kick "..id.."")
end
if(txt=="!weapons") then
menu(id,"Weapons Menu 1 / 2,M3|1000$,M4A1|2600$,M249|5000$,,Flamerthrower|16000$,Rocket Launcher|3 Score,RPG Launcher|4 Score,,Next|>>")
end
if(txt=="!armors") then
menu(id,"Armors Menu,Light Armor|3000$,Medium Armor|15000$,Medic Armor|5 Score,Heavy Armor|10 Score,Super Armor|45 Score,,,,Stealth Suit|3000$")
end
if(txt=="!powers") then
menu(id,"Powers Menu,5x Speed|10 Score,Full Healthy|12 Score,,Teleport CT|10 Score,Teleport T|10 Score,,Restart|35 Score,Kill All|40 Score,+1 Score|16000$")
end
if(txt=="!hats") then
menu(id,"Hats Menu 1 / 2,Armor,Gandalf,Marine,Priate,Angel,Devil,Graduation,Party,Next|>>")
end
if(txt=="!angry") then
parse("shake "..id.." 100")
end
return 1
end
function sayhook1(id,txt)
if(txt=="!help") then
msg2(id,"©000255000!rs")
msg2(id,"©000255000!kill")
msg2(id,"©000255000!hats")
msg2(id,"©000255000!mypos")
msg2(id,"©000255000!angry")
msg2(id,"©000255000!kickme")
msg2(id,"©000255000!armors")
msg2(id,"©000255000!powers")
msg2(id,"©000255000!weapons")
end
if(txt=="!rs") then
parse ("setscore "..id.." 0")
parse ("setdeaths "..id.." 0")
msg2(id,"©255000000[SERVER]:".."©000255000 Score reseted successful.")
end
if(txt=="!kill") then
parse ("kill "..id.."")
end
if(txt=="!kickme") then
parse ("kick "..id.."")
end
if(txt=="!weapons") then
menu(id,"Weapons Menu 1 / 2,M3|1000$,M4A1|2600$,M249|5000$,,Flamerthrower|16000$,Rocket Launcher|3 Score,RPG Launcher|4 Score,,Next|>>")
end
if(txt=="!armors") then
menu(id,"Armors Menu,Light Armor|3000$,Medium Armor|15000$,Medic Armor|5 Score,Heavy Armor|10 Score,Super Armor|45 Score,,,,Stealth Suit|3000$")
end
if(txt=="!powers") then
menu(id,"Powers Menu,5x Speed|10 Score,Full Healthy|12 Score,,Teleport CT|10 Score,Teleport T|10 Score,,Restart|35 Score,Kill All|40 Score,+1 Score|16000$")
end
if(txt=="!hats") then
menu(id,"Hats Menu 1 / 2,Armor,Gandalf,Marine,Priate,Angel,Devil,Graduation,Party,Next|>>")
end
if(txt=="!angry") then
parse("shake "..id.." 100")
end
return 1
end
now its working but if you pressed "Z" you can't post anything in chat cuz no thing is showing
hope someone hlep me
In 40 line in the second chunk of code you literally tell Lua to not output any say chat - that's why. Remember that
By your request I had only put
return 1
is independent by other IF conditions and their conditional body. To make it clear, let's say you want !menu text-say-command to not be displayed thus you need to add return 1 at the end of the condition. However note that other commands such as !admin for instance will be displayed. By your request I had only put
return 1
inside the second IF condition as you don't want !rs to be displayed within the chat.edited 1×, last 19.10.16 05:21:07 pm



