Forum

> > CS2D > General > Hook 'Usebutton' not working!
ForenübersichtCS2D-ÜbersichtGeneral-ÜbersichtEinloggen, um zu antworten

Englisch Hook 'Usebutton' not working!

16 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Hook 'Usebutton' not working!

jabba
User Off Offline

Zitieren
I tried to do a usebutton hook:

function comprarcasa(id,x,y)
     if(player(id,"exists")) then
     px = player(id,"tilex")
     py = player(id,"tiley")
          if px == 21 and py == 21 then
               msg2(id,"©255000000 ID: "..casas[1].."")
               if casas[1] == 255 then
                    casas[1] = id
                    msg2(id,"©255000000 ID: "..casas[1].."")
                    parse("setmoney "..id.." "..player(id,"money")-1000)
               elseif casas[1] ~= id then
                    msg2(id,"©255000000 Somente o dono pode abrir a casa")
                    msg2(id,"©255000000 ID: "..casas[1].."")
                    return 1
               end
          end
     end
end

And is not working, only for admins... =\

I need to know, is 'usebutton' hook working?

alt Re: Hook 'Usebutton' not working!

SQ
Moderator Off Offline

Zitieren
Anyway, that's not whole script...
You haven't declared any table or other variables. ect "cesas[]"
1× editiert, zuletzt 26.01.10 17:38:10

alt Re: Hook 'Usebutton' not working!

jabba
User Off Offline

Zitieren
function iArray(m)
     local array = {}
     for i = 1, m do
          array[i]=255
     end
     return array
end

casas = iArray(10)

addhook("usebutton","comprarcasa")

function comprarcasa(id,x,y)
     if(player(id,"exists")) then
     px = player(id,"tilex")
     py = player(id,"tiley")
          if px == 21 and py == 21 then
               msg2(id,"©255000000 ID: "..casas[1].."")
               if casas[1] == 255 then
                    casas[1] = id
                    msg2(id,"©255000000 ID: "..casas[1].."")
                    parse("setmoney "..id.." "..player(id,"money")-1000)
               elseif casas[1] ~= id then
                    msg2(id,"©255000000 Somente o dono pode abrir a casa")
                    msg2(id,"©255000000 ID: "..casas[1].."")
                    return 1
               end
          end
     end
end
-------

PS:

button position x = 21 y = 21

PS2:

I'm using version 0.1.1.7

Please! All I need to know is if the 'usebutton' hook is working! I don't need no help with Scripting!
2× editiert, zuletzt 26.01.10 17:50:17

alt Re: Hook 'Usebutton' not working!

jabba
User Off Offline

Zitieren
Didn't work either..

Again, not a script problem.

Please people, I all need to know...

Is the usebutton hook working for you? (Or only for admins?)

alt Re: Hook 'Usebutton' not working!

Cure Pikachu
User Off Offline

Zitieren
jabba hat geschrieben
Please people, I all need to know...

Is the usebutton hook working for you? (Or only for admins?)

Tried mat5b's RPG Mod (Involves the usebutton hook, I guess ) and I suppose the hook works for any player.

alt Re: Hook 'Usebutton' not working!

jabba
User Off Offline

Zitieren
I've searched and downloaded every mat5b RPG mod, but I didn't find the usebutton hook..

Can u send me the download link please?

alt Re: Hook 'Usebutton' not working!

Lee
Moderator Off Offline

Zitieren
There's a very easy way to confirm if usebutton is working... your lack of originality is almost amusing

1
2
3
4
5
6
7
8
addhook("usebutton", "test")
function test(...)
	msg("Calling test...")
	local args = {...}
	for _,param in ipairs(args) do
		msg(param)
	end
end

If nothing happens when you press a button, then the usebutton event does not work, after which you have the right to come here and whine, but not before.

alt Re: Hook 'Usebutton' not working!

CmDark
User Off Offline

Zitieren
amazing...

@jabba

of course it works for every player

there is absolutely no player(i,'usgn') or
anything to suggest that it would not work for everyone.

~~

alt Re: Hook 'Usebutton' not working!

Cure Pikachu
User Off Offline

Zitieren
jabba hat geschrieben
I've searched and downloaded every mat5b RPG mod, but I didn't find the usebutton hook..

Can u send me the download link please?


PMed you the link. Check it

BTW: Download the "mod", extract everything, and search the lua in your maps folder. Its a map LUA.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antwortenGeneral-ÜbersichtCS2D-ÜbersichtForenübersicht