English Cigarette script

22 replies
Goto Page
To the start Previous 1 2 Next To the start
26.03.14 03:59:52 pm
Up
Marcell
Super 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
addhook("spawn","onJoinAddLigther")
function onJoinAddLighter(lighter,cigarette)
     if Player[id].joined then
     ligther = 0 + 1
     cigarette = 0 + 1
end
end


function OnCigarette(id, lighter, cigarette)
     if ligther = 1 then
     if cigarette => 1 then
          parse("effect "smoke" "..player(id, "x").." "..player(id, "y").." 2 2") 
          end
     
     if lighter = 0 then 
     msg2(id, "©255000000You don't have lighter, buy one at shop!") 
     end  
     if cigarette = 0 then 
     msg2(id, "©255000000You don't have cigarette!") 
     end
end
end


Whats wrong?
26.03.14 04:25:37 pm
Up
alex72super
User
Offline Off
First, what's the error?

On line 2:

Code:
function onJoinAddLighter(lighter,cigarette)


But on line 4:

Code:
ligther = 0 + 1


Check how you wrote 'Lighter'.
26.03.14 04:49:16 pm
Up
Rainoth
Moderator
Offline Off
also all checks should be "==" instead of "=" since "=" is declaring the variable.
26.03.14 05:18:33 pm
Up
Avo
User
Offline Off
Fixed. Much fix. Many typos, syntax mistakes such as "lighter"/"ligther", few useless lines.

Note that effect of size 5 5 won't be really visible when you call OnCigarette function once.
More >
26.03.14 10:41:36 pm
Up
Sneaky
User
Offline Off
Smoking weed in CS2D..
Just great!
Where ever you go ,your soul goes with you.
27.03.14 08:25:51 am
Up
Marcell
Super User
Offline Off
The problem is not is the full code... i mean i already have player[id] definitions, so it isn't worked at all...
can i show the full code in pm @user Avo: ?
27.03.14 04:10:12 pm
Up
Avo
User
Offline Off
I don't see any reason why you shouldn't post it here. Give it here.
27.03.14 04:26:13 pm
Up
Marcell
Super User
Offline Off
Then look at

Spoiler >

Spoiler >

Spoiler >

Spoiler >
edited 1×, last 27.03.14 05:21:02 pm
27.03.14 04:33:28 pm
Up
Infinite Rain
Reviewer
Offline Off
@user Marcell:
You aren't spoiling anything. Use more tag instead!
A thousand may fall at your side, ten thousand at your right hand, but it will not come near you. You will only look with your eyes and see the recompense of the wicked. - Psalm 91:7-8 ESV
27.03.14 04:57:26 pm
Up
Marcell
Super User
Offline Off
what???

for me spoiler working fine, when i click to it, it show the full code
27.03.14 05:11:12 pm
Up
Infinite Rain
Reviewer
Offline Off
@user Marcell:
Spoiler tag is used for hiding spoilers, more tag is used for hiding the long information.

I don't think that your script spoiled anything.

(And if you're still too stupid to understand what do I mean, read this: http://www.unrealsoftware.de/forum_posts.php?post=358328#jn)
A thousand may fall at your side, ten thousand at your right hand, but it will not come near you. You will only look with your eyes and see the recompense of the wicked. - Psalm 91:7-8 ESV
27.03.14 05:21:34 pm
Up
Marcell
Super User
Offline Off
fixed now, you cannot say now i didN't used any tags
27.03.14 05:22:10 pm
Up
DannyDeth
User
Offline Off
@user Infinite Rain:
It does the job fine. If you cannot muster the mental ability to investigate, that's on you, not him.
27.03.14 05:31:24 pm
Up
Infinite Rain
Reviewer
Offline Off
@user Marcell:
Know what? Forget it.
A thousand may fall at your side, ten thousand at your right hand, but it will not come near you. You will only look with your eyes and see the recompense of the wicked. - Psalm 91:7-8 ESV
27.03.14 05:33:40 pm
Up
Marcell
Super User
Offline Off
i don't want to forget it
28.03.14 12:43:37 am
Up
TheAnonymous
User
Offline Off
@user Marcell: Your file does not work because you did maybe the codes very fast and that you went

LUA ERROR: sys/lua/cigarette.lua:11: 'then' expected near '=' This is the error...
28.03.14 05:22:22 am
Up
Marcell
Super User
Offline Off
God.. the full code is almost 30 files thats why i also wanted to send it via fileshare
28.03.14 12:11:47 pm
Up
TheAnonymous
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
addhook("spawn","onJoinAddLigther")
function onJoinAddLighter(lighter,cigarette)
     if Player[id].joined then
     ligther = 0 + 1
     cigarette = 0 + 1
end
end


function OnCigarette(id, lighter, cigarette)
     if ligther = 1 then
     if cigarette => 1 then
          parse("effect "smoke" "..player(id, "x").." "..player(id, "y").." 2 2") 
          end
     
     if lighter = 0 then 
     msg2(id, "©255000000You don't have lighter, buy one at shop!") 
     end  
     if cigarette = 0 then 
     msg2(id, "©255000000You don't have cigarette!") 
     end
end
end


@user Marcell: Line 11 contains an error
28.03.14 12:22:23 pm
Up
MikuAuahDark
User
Offline Off
Line 11
Code:
1
if ligther = 1 then


Should me
Code:
1
if ligther == 1 then


I don't guarantee that it would not return error attempt to call a nil value
Hello? Are you there, Tae Hanazono?
28.03.14 04:46:13 pm
Up
Avo
User
Offline Off
you know guys, I've already posted fixed version.

user Marcell has written:
God.. the full code is almost 30 files thats why i also wanted to send it via fileshare
Unless you're a pro scripter, you shouldn't use so many separate files. As you see it complicates everything atm, for example - you won't find anyone who want to help you.

One does not simply want to fix 30 files.
To the start Previous 1 2 Next To the start