Forum

> > CS2D > Scripts > !speed command error
Forums overviewCS2D overview Scripts overviewLog in to reply

English !speed command error

9 replies
To the start Previous 1 Next To the start

old !speed command error

KagamineLen
User Off Offline

Quote
im making a command that when you say !speed (value)
it will speedmod you to that value

i need help fixing it

[01:41:50] LUA ERROR: sys/lua/LuaScript.lua:19: '=' expected near 'end'

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
addhook('say', '_say')
function _say(id, text)

if text == '!help' then
parse('sv_msg2 '..id..' !speed [Value] -- Gives You a Speed with Value-XX')
parse('sv_msg2 '..id..' !equip [WPN-ID] -- Equip A XX-ID Weapon')
parse('sv_msg2 '..id..' !armor82 -- Gives You Medic Armor')
parse('sv_msg2 '..id..' !armor83 -- Gives You Super Armor')
parse('sv_msg2 '..id..' !laser -- Equip A Weapon')
end

if string.find(text,'!speed') then
local speed1 = text:sub(1,6)
if speed1 == '!speed' then
local speed2 = text:sub(8,10)
parse('speedmod '..id..' '..speed1)
end
return1
end


end

old Re: !speed command error

Bowlinghead
User Off Offline

Quote
ROFL!

Script has written
addhook('say', '_say')
function _say(id, text)

if text == '!help' then
parse('sv_msg2 '..id..' !speed [Value] -- Gives You a Speed with Value-XX')
parse('sv_msg2 '..id..' !equip [WPN-ID] -- Equip A XX-ID Weapon')
parse('sv_msg2 '..id..' !armor82 -- Gives You Medic Armor')
parse('sv_msg2 '..id..' !armor83 -- Gives You Super Armor')
parse('sv_msg2 '..id..' !laser -- Equip A Weapon')
end

if string.find(text,'!speed') then
local speed1 = text:sub(1,6)
if speed1 == '!speed' then
local speed2 = text:sub(8,10)
parse('speedmod '..id..' '..speed2)
end
return1
end


end


Your Script is correct but the "return1" is wrong
edited 1×, last 13.08.11 08:43:51 pm

old Re: !speed command error

Anti-Grav
User Off Offline

Quote
Hmm

1
parse('speedmod' '..id..' '..speed1')

I think that works. Because every word is in ' '. Sorry when not.

Edit:

MC_Bowlinghead's solution should work. It has to be return 1 with space.

old Re: !speed command error

EngiN33R
Moderator Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
addhook('say', '_say')
function _say(id, text)
if text == '!help' then
parse('sv_msg2 '..id..' !speed [Value] -- Gives You a Speed with Value-XX')
parse('sv_msg2 '..id..' !equip [WPN-ID] -- Equip A XX-ID Weapon')
parse('sv_msg2 '..id..' !armor82 -- Gives You Medic Armor')
parse('sv_msg2 '..id..' !armor83 -- Gives You Super Armor')
parse('sv_msg2 '..id..' !laser -- Equip A Weapon')
end

if string.find(text,'!speed') then
local speed1 = text:sub(1,6)
if speed1 == '!speed' then
local speed2 = text:sub(8,10)
parse('speedmod '..id..' '..speed1)
end
return 1
end

end

You just needed to change
1
return1
to
1
return 1
in your code. Yeah.

old Re: !speed command error

EngiN33R
Moderator Off Offline

Quote
@MC_Bowlinghead

I didn't read the further posts, I just fixed the error and only after noticed that you said the same.

old Re: !speed command error

RAVENOUS
BANNED Off Offline

Quote
user EngiN33R has written
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
addhook('say', '_say')
function _say(id, text)
if text == '!help' then
parse('sv_msg2 '..id..' !speed [Value] -- Gives You a Speed with Value-XX')
parse('sv_msg2 '..id..' !equip [WPN-ID] -- Equip A XX-ID Weapon')
parse('sv_msg2 '..id..' !armor82 -- Gives You Medic Armor')
parse('sv_msg2 '..id..' !armor83 -- Gives You Super Armor')
parse('sv_msg2 '..id..' !laser -- Equip A Weapon')
end

if string.find(text,'!speed') then
local speed1 = text:sub(1,6)
if speed1 == '!speed' then
local speed2 = text:sub(8,10)
parse('speedmod '..id..' '..speed1)
end
return 1
end

end

You just needed to change
1
return1
to
1
return 1
in your code. Yeah.


For right terming you might change

1
parse('sv_msg2 '..id..' !speed [Value] -- Gives You a Speed with Value-XX')

to

1
msg2(id,"!speed [Value] -- Gives You a Speed with Value-XX")

shorter and less confusion.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview