English Bring & Teleport for Hc

7 replies
Goto Page
To the start Previous 1 Next To the start
20.08.18 02:35:50 pm
Up
Man Of Steel
User
Offline Off
Hi Guys,

I'm editing hc admin script, i wanted to add Bring and Teleport in F3 menu so i added this code for that, check

Spoiler >



Spoiler >


Spoiler >


But Code not working, even no errors
Anybody can help me pls.
I'm not Scripter i just edit script.
FRiendly boYy.
20.08.18 03:38:39 pm
Up
Devil-Thanh
GAME BANNED
Offline Off
Code:
1
live_player(id)
20.08.18 07:48:53 pm
Up
Man Of Steel
User
Offline Off
@user Devil-Thanh: i understood what you said, and i did again but no work even no errors, i'm suprised
FRiendly boYy.
20.08.18 10:45:46 pm
Up
Rainoth
Moderator
Offline Off
What he said applies but more so than that, you're attaching functions (in first spoiler which you shouldn't even add because it doesn't contain a lot of code) that do not exist, so the menu calls a function that's nil and nothing happens.

hc.moderation.bring_command
~=
function hc.moderation.bring(id, arg)

Same thing for teleport.

In the future when you don't get errors, look at every single detail one by one and check if it's working. Even the very obvious things.

Good luck.
21.08.18 08:55:33 am
Up
Man Of Steel
User
Offline Off
@user Rainoth: Where put it? Please give me example
I'm confused
FRiendly boYy.
21.08.18 01:27:02 pm
Up
Rainoth
Moderator
Offline Off
You don't put any comparisons or anything.

You defined function "function hc.moderation.bring(id, arg)" yet you're telling HC to call function "hc.moderation.bring_command". Those are two different functions and the one you didn't define obviously doesn't exist, so nothing happens.

To put it in the most simple terms, this is what you've done:

Code:
1
2
3
4
5
function a()
  print("woohoo")
end

b()


b() doesn't exist, only a() but you're calling b(). You're doing the same thing with your functions.
22.05.19 09:36:25 am
Up
Inside file
Code:
1
hc/core/util.lua
add

Code:
1
2
3
4
5
6
7
8
9
10
11
12
function hc.isAlive(p, id)     
     if (player(id,"team") == hc.T or player(id,"team") == hc.CT) then
          if player(id, "health") > 0 then
               return true
          else
               hc.error(p, "This player is dead.")
          end
     else
          hc.error(p, "This player is spectating.")
     end
     return false
end


Inside file
hc/modules/moderation.lua
add this code inside function
Code:
1
function hc.moderation.init()


Code:
1
2
hc.add_menu_command("Bring", hc.moderation.bring_command, hc.MODERATOR1, hc.ADMIN_MENU_KEY, { category = "Moderate" })     
     hc.add_menu_command("GoTo", hc.moderation.goto_command, hc.MODERATOR1, hc.ADMIN_MENU_KEY, { category = "Moderate" })


Search for
Code:
1
-- Menu commands
comment and add

Code:
1
2
3
4
5
6
7
function hc.moderation.bring_command(p)
    hc.show_menu(p, "Bring", hc.get_players(), hc.moderation.bring)
end

function hc.moderation.goto_command(p)
    hc.show_menu(p, "GoTo", hc.get_players(), hc.moderation.goto)
end


Search for
Code:
1
-- Menu callbacks
comment and add

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
function hc.moderation.bring(p, _, item)
    local id = item.id

     if hc.isAlive(p, id) then
          hc.exec(p, "setpos " .. id .. " " .. player(p, "x") .. " " .. player(p, "y"))
     end
end

function hc.moderation.goto(p, _, item)
    local id = item.id

     if hc.isAlive(p, id) then
          hc.exec(p, "setpos " .. p .. " " .. player(id, "x") .. " " .. player(id, "y"))
     end
end


You are done √
Mess with the best, die like the rest. ༼ つ ◕_◕ ༽つ
22.05.19 09:50:08 am
Up
Gaios
Security Supporter
Offline Off
@user G3tWr3ck3d: You're fast.
To the start Previous 1 Next To the start