English this script need work

3 replies
Goto Page
To the start Previous 1 Next To the start
31.03.21 06:07:23 pm
Up
NanuPlayer
User
Offline Off
guys i need help.. im not good in scripting... i mean i need this script
if you say !nuke the script open...
help me pls

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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
local FRAGS = {}

function DoSetup()
     for i = 1, 32 do
          FRAGS[i] = 0
     end
end
DoSetup()

addhook('join', 'OnJoin')
function OnJoin(id)
     FRAGS[id] = 0
end

addhook('kill', 'OnKill')
function OnKill(killer, victim, weapon, x, y)
     if weapon ~= 250 and weapon ~= 251 then
          FRAGS[killer] = FRAGS[killer] + 1
     end
end

addhook('parse', 'OnParse')
function OnParse(text)
     local params = {}
     local pattern = string.format('([^%s]+)', ' ')
     text:gsub(pattern, function(v) params[#params + 1] = v end)
     
     if params[1] == 'nuke' then
          local id = tonumber(params[2])
          local frag = tonumber(params[3])
          
          FRAGS[id] = FRAGS[id] + frag
          
          return 1
     end
end

addhook('serveraction', 'OnServerAction')
function OnServerAction(id, action)
     if action == 1 then
          NukeMenu(id)
     end
end

addhook('say', 'OnSay')
addhook('sayteam', 'OnSay')
function OnSay(id, message)
     if message == '!nuke' then
          NukeMenu(id)
     end
end

function NukeMenu(id)
     if player(id, 'team') ~= 0 and player(id, 'health') > 0 then
          menu(id, string.format('Nuke Power (Frags: %s),20 kt|25,50 kt|30,200 kt|100,300 kt|250,1 mt|550,5 mt|700', FRAGS[id]))
     end
end

addhook('menu', 'OnMenu')
function OnMenu(id, title, button)
     if string.sub(title, 0, 10) == 'Nuke Power' then
          if button == 1 then
               OnExplosion(id, 25, 20)
          elseif button == 2 then
               OnExplosion(id, 30, 50)
          elseif button == 3 then
               OnExplosion(id, 100, 200)
          elseif button == 4 then
               OnExplosion(id, 250, 300)
          elseif button == 5 then
               OnExplosion(id, 550, 1000)
          elseif button == 6 then
               OnExplosion(id, 700, 5000)
          end
     end
end

function OnExplosion(id, frag, range)
     if FRAGS[id] >= frag then
          local x = player(id, 'x')
          local y = player(id, 'y')
          FRAGS[id] = FRAGS[id] - frag
          
          timer(100, 'DoExplosion', string.format('%s %s %s %s', id, x, y, range), math.ceil(range / 100))
     else
          msg2(id, '©255000000You need more frags@C')
     end
end

function DoExplosion(text)
     local params = {}
     local pattern = string.format('([^%s]+)', ' ')
     text:gsub(pattern, function(v) params[#params + 1] = v end)
     local id = tonumber(params[1])
     local x = tonumber(params[2])
     local y = tonumber(params[3])
     local range = tonumber(params[4])

     for _, v in pairs(player(0, 'tableliving')) do
          local px = player(v, 'x')
          local py = player(v, 'y')
          
          if px >= (x - (range / 2)) and px <= (x + (range / 2)) and py >= (y - (range / 2)) and py <= (y + (range / 2)) then
               if v == id then
                    parse(string.format('customkill 0 Nuke %s', v))
               else
                    parse(string.format('customkill %s Nuke %s', id, v))
               end
          end
     end
     
     parse(string.format('explosion %s %s %s %s %s', x, y, range, 2115098112, id))
end


pls make it if you say !nuke open
Bad Life

Admin/mod comment:

please post in the right section! moved!
02.04.21 06:12:08 pm
Up
descrover
User
Offline Off
I tried the script works fine. But there is a possiblity your say hook interfere with other say hook(s)
04.04.21 10:03:53 pm
Up
Unknown_Cheater
User
Offline Off
Spoiler >
edited 2×, last 04.04.21 10:32:09 pm
one small line of code, one big leap for the programmer
05.04.21 03:35:27 pm
Up
descrover
User
Offline Off
@user Unknown_Cheater: not funny and you are acting childish
To the start Previous 1 Next To the start