0


this is a really simple non-amx2d lua script for resetting score.

addhook("say","rs")
function rs(p,txt)
    if (txt=="resetscore") then
        parse("setscore "..p.." 0")
        parse("setdeaths "..p.." 0")
        msg(player(p,"name").." reset his score")
        return 1
    end
end

how can i make it so that the no regular text appears? the "return 1" seems to do nothing o.O

flag offensive
asked 2010-05-11 06:03:21.250962
1
add comment
9 Answers:
0


I can't seem to reproduce the problem, can you describe the server environment?

permanent link | flag offensive
answered 2010-05-11 22:54:32.475527
41
add comment
0


uh... server = my pc with windows xp sp3 i doubt that has much to do with it though..

the weird this is that i have another similar script (listplayers) where the "return 1" works on my computer, but fails on mostafa's computer. weird...

addhook("say","lp")
function lp(p,txt)
    if (txt=="listplayers") then
        msg2(p, "ID - Name - IP Address - USGN ID")
        for i=1,32 do
            if (player(i,"exists")) then
                msg2(p, i.." - "..player(i,"name").." - "..player(i,"ip").." - "..player(i,"usgn"))
            end
        end
        return 1
    end
end
permanent link | flag offensive
answered 2010-05-12 03:12:37.678584
1
add comment
0


o_O looks like the problem comes arbitrarily then, it could be a bug with the way CS2D propagates the return values of hook events.

permanent link | flag offensive
answered 2010-05-12 21:12:37.983766
41
add comment
0


here's the really weird thing: this is my server.lua

dofile("sys/lua/automoney.lua")
dofile("sys/lua/listplayers.lua")
dofile("sys/lua/resetscore.lua")

if i comment out the second line, the problem does not occur o.O wtf????

and if i switch the second and third lines, the problem occurs for listplayers but not resetscore...

it seems like the "return 1" for the say hook only works for the first function...

permanent link | flag offensive
answered 2010-05-13 02:14:30.593530
1
add comment
0


You probably overwrite your first hook, the one you provided in listplayers.lua. So it happens that it will run the say hook in listplayers and not in resetscore.lua.

permanent link | flag offensive
answered 2010-05-13 12:04:48.965390
46
add comment
0


Check to make sure that none of your other say functions have a return 0 in them, as eTarPu just said, you may have just overwrote the hook that you want.

permanent link | flag offensive
answered 2010-05-13 19:50:14.021050
41
add comment
0


nope lol i have only 2 functions in my server.lua, both of which are posted above..

permanent link | flag offensive
answered 2010-05-14 06:18:55.740800
1
add comment
0


Check these files as well:

dofile("sys/lua/automoney.lua")
dofile("sys/lua/listplayers.lua")
dofile("sys/lua/resetscore.lua")
permanent link | flag offensive
answered 2010-05-14 16:48:12.036561
41
add comment
0


ya i took out automoney and it still doesn't work -.-

listplayers and resetscore are posted above

permanent link | flag offensive
answered 2010-05-16 21:28:40.185576
1
add comment
Your answer:
You are now not logged in but you can answer first and then login
toggle preview



Tags:

× 1
× 1
× 1

Asked: 2 years ago

Seen: 1,307 times

Last updated: 2 years ago

Related questions


Made with Django.