English Increasing Speed every second

5 replies
Goto Page
To the start Previous 1 Next To the start
14.04.19 04:59:32 pm
Up
AtomKuh
User
Offline Off
I want my speed to be increased every second until 10 seconds are reached.

I have this script (console does not show any errors):

Code:
1
2
3
4
5
6
7
8
function menu_f2(id,action)
if action==1 then
for i = 1000,10000,1000 do
timer(i,"parse","speedmod " .. id .. " " .. player(id, "speedmod") + 10)
  
     end              
end
end


It does not work^^ It only increases my speed +10 after one second and that nothing happens^^
14.04.19 05:04:26 pm
Up
Goo
User
Offline Off
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
sp = { playersdata = {} }
for i = 1 ,32 do
     sp.playersdata[i] = { increase = false }
end

addhook('second', 'sp.hooks.second')
function sp.hooks.second()
     for _, id in pairs(players(0, 'tableliving')) do
          if sp.playerdata[id].increase then
               parse('speedmod '..id.. '..player(id, 'speed') + 10)
          end
     end
end

addhook('leave', 'sp.hooks.leave')
function sp.hooks.leave(id)
     sp.playerdata[id].increase = false
end

addhook('serveraction', 'sp.hooks.serveraction')
function sp.hooks.serveraction(id, button)
     if button == 1 then
          sp.playersdata[id].increase = not sp.playersdata[id].increase
     end
end
14.04.19 05:11:20 pm
Up
AtomKuh
User
Offline Off
Thanks Goo but I am getting an error in this line:

Code:
1
parse('speedmod '..id.. '..player(id, 'speed') + 10)


Error: LUA ERROR: sys/lua/lol.lua:10: ')' expected near 'speed'
14.04.19 05:35:13 pm
Up
panteon00
User
Offline Off
there is missing a '
Code:
1
parse('speedmod '..id..' '..player(id, 'speed') + 10)
loading...
14.04.19 05:59:40 pm
Up
AtomKuh
User
Offline Off
after changing that line my games crashes instantly after starting the server

Error in log-file:
Code:
1
LUA ERROR: sys/lua/lol.lua:7: attempt to index field 'hooks' (a nil value)
14.04.19 06:46:06 pm
Up
panteon00
User
Offline Off
yeah, i think i fixed all errors now

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
sp = { playersdata = {}, hooks = {} }
for i = 1 ,32 do
     sp.playersdata[i] = { increase = false }
end

addhook('second', 'sp.hooks.second')
function sp.hooks.second()
     for _, id in pairs(player(0, 'tableliving')) do
          if sp.playersdata[id].increase then
               parse('speedmod '..id..' '..player(id, 'speedmod') + 10)
          end
     end
end

addhook('leave', 'sp.hooks.leave')
function sp.hooks.leave(id)
     sp.playersdata[id].increase = false
end

addhook('serveraction', 'sp.hooks.serveraction')
function sp.hooks.serveraction(id, button)
     if button == 1 then
          sp.playersdata[id].increase = not sp.playersdata[id].increase
     end
end
loading...
To the start Previous 1 Next To the start