English Lua Scripts/Questions/Help

6,770 replies
Goto Page
To the start Previous 1 2 ... 267 268 269 ... 338 339 Next To the start
28.09.10 04:35:08 am
Up
MasterAsp
User
Offline Off
Never mind, I glanced at AMX2D usage of it, and I figured out how it works
28.09.10 03:09:20 pm
Up
Boss
User
Offline Off
im trying to get this work but each time i do it i lose the menu.


Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
s_bike_b = [[]]
function udp_sbike(id)
     if pl_have_bike[id]==1 then
          s_bike_b = [[Return the Motorcycle]]
     elseif pl_have_bike[id]==0 then
          s_bike_b = [[Rent a Motorcycle]]
     end
end

s_car_b = [[]]
function udp_scar(id)
     if pl_have_car[id]==1 then
          s_car_b = [[Return the Car]]
     elseif pl_have_car[id]==0 then
          s_car_b = [[Rent a car]]
     end
end


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
elseif sel == 8 then
               menu(id,[[Rent List@b,Rent a Motorcycle,Rent a car]])
          end
     end
     if men == [[Rent List]] then
          if sel == 1 then
               if pl_have_bike[id]==0 then
                    bike_img_pos[id]=image([[gfx/[TB]Reality Roleplay Project/Add-Ons/Vehicles/motorcycle-copy.png]],1,1,1)
                    imagepos(bike_img_pos[id],player(id,[[x]]),player(id,[[y]]),player(id,[[rot]]))
                    vehicle_tx[id]=player(id,[[tilex]])
                    vehicle_ty[id]=player(id,[[tiley]])
                    vehicle_x[id]=player(id,[[x]])
                    vehicle_y[id]=player(id,[[y]])
                    pl_have_bike[id]=1
               elseif sel == 2 then
               if pl_have_bike[id]==0 then
                    bike_img_pos[id]=image([[gfx/[TB]Reality Roleplay Project/Add-Ons/Vehicles/motorcycle-copy.png]],1,1,1)
                    imagepos(bike_img_pos[id],player(id,[[x]]),player(id,[[y]]),player(id,[[rot]]))
                    vehicle_tx[id]=player(id,[[tilex]])
                    vehicle_ty[id]=player(id,[[tiley]])
                    vehicle_x[id]=player(id,[[x]])
                    vehicle_y[id]=player(id,[[y]])
                    pl_have_bike[id]=1
               elseif pl_have_bike[id]==1 then
                    if pic[id]>0 then
                         parse([[customkill ]]..id..[[ Eject ]]..id)
                         parse([[explosion ]]..vehicle_x[id]..[[ ]]..vehicle_y[id]..[[ 100 200 ]]..id)
                         vehicle_tx[id]=0
                         vehicle_ty[id]=0
                         vehicle_x[id]=0
                         vehicle_y[id]=0
                         freeimage(bike_img[id])
                    else
                         parse([[explosion ]]..vehicle_x[id]..[[ ]]..vehicle_y[id]..[[ 100 200 ]]..id)
                         vehicle_tx[id]=0
                         vehicle_ty[id]=0
                         vehicle_x[id]=0
                         vehicle_y[id]=0
                         freeimage(bike_img_pos[id])
                    end
                    pl_have_bike[id]=0
               end
          end
     end
28.09.10 06:36:13 pm
Up
sixpack
User
Offline Off
Okay!
I got a question for ya!
Are there any LUA commands to make the script wait?
I mean:

msg("HELLO!")
wait 1000 --waits 1000ms
msg("MY NAME IS SCRIPT!")

[Random examples given!]
28.09.10 06:42:29 pm
Up
DC
Admin
Offline Off
no because it would make the whole game wait = huge lag. not a good idea

you have to work with the built-in timer system which is pretty easy. read sys/lua/info.txt in your cs2d folder.

your sample done the right way:
Code:
1
2
3
4
5
6
msg("HELLO!")
timer(1000,"timer_msg","MY NAME IS SCRIPT!")

function timer_msg(txt)
     msg(txt)
end

(untested)
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
28.09.10 07:03:05 pm
Up
SkullFace
User
Offline Off
i am just wondering but i get error like
"LUA ERROR: maps/zm_nacht_der_untoten_v1.3.lua:72: unexpected symbol near 'then' "

i think its this
Code:
1
local c=math.random(1,13)==1 then
cuz i think i cant get more than 10 do i ?

P.S. i was just testing will it work over 10
IMG:https://i.imgur.com/kZBVkjM.gif
P.S. - I've been extracting recently enviromental sound files from other games, if anyone is interested in them for adding them to their maps, scripts, PM me
28.09.10 07:05:45 pm
Up
HaRe
User
Offline Off
DaKnOb has written:
Okay!
I got a question for ya!
Are there any LUA commands to make the script wait?
I mean:

msg("HELLO!")
wait 1000 --waits 1000ms
msg("MY NAME IS SCRIPT!")

[Random examples given!]


you can always do this

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
timer = 9999999
howlong = 1000 -- How long there should be between that shit

addhook("ms100","timer") function timer()
     timer=timer+1
     if timer==howlong then
          msg("MY NAME IS SCRIPT!")
     end
end

addhook("minute","startit") function startit()
     msg("HELLO!")
     timer=0
end


@Burex explain more on the script and btw use

local c = math.random(1, 13)
if c==5 then

and yes it works more than 10
w0w im so eXotiK
28.09.10 07:59:25 pm
Up
TDShuft
User
Offline Off
Is there how like if some 1 move on X,Y tile and get a menu ?
Sorry , I can't be Perfect !
28.09.10 08:19:58 pm
Up
HaRe
User
Offline Off
shuft has written:
Is there how like if some 1 move on X,Y tile and get a menu ?


Code:
1
2
3
4
5
6
addhook("movetile","ifmove") function ifmove(id,x,y)
-- x and y = tile x and y
     if x==x and y==y then
          menu(id,"Whatever,lol")
     end
end
w0w im so eXotiK
28.09.10 08:21:11 pm
Up
Jynxxx
User
Offline Off
Can anyone make me a script.
That gives people speedmod on the kills they get.
But if they die they go back down to 0 speedmod like they have to kill in a row like unstopable the get 6 speedmod.
28.09.10 08:39:02 pm
Up
HaRe
User
Offline Off
Dantes Inferno has written:
Can anyone make me a script.
That gives people speedmod on the kills they get.
But if they die they go back down to 0 speedmod like they have to kill in a row like unstopable the get 6 speedmod.


Code:
1
2
3
4
5
6
7
addhook("kill","speedget") function speedget(id)
     parse("speedmod "..id.." "..(player(id,"speedmod") + 1))
end

addhook("die","speedre") function speedre(id)
     parse("speedmod "..id.." 0")
end
w0w im so eXotiK
28.09.10 08:56:06 pm
Up
Jynxxx
User
Offline Off
Hey i have a question, I put the utsfx mod(in the samples

folder) on my server but i want it to end up in the middle of

the screen and it doesn' t even show all the levels of the

kills it only shows sheds first blood and doublekill.

Can someone make me a new one
edited 1×, last 29.09.10 12:08:14 am
29.09.10 02:18:43 am
Up
TDShuft
User
Offline Off
Spoiler >

help ??
Sorry , I can't be Perfect !
29.09.10 03:47:57 am
Up
MasterAsp
User
Offline Off
Spoiler >
Up
Boss
User
Offline Off
my gm is roleplay so if anyone know something about it plz help me out with this little thing

i think its a bug from the game because i did everything correct im a scripter i study script i use c++, scripting at lua its easy but the commands different if someone know where i can find the commands for lua reply.

here the script:

first i add the license at menu

Code:
1
menu(id,[[Drop System,$100,$500,$1000,$5000,$10000,$50000,$100000,Vehicle Shop,license Shop,]])


second i add the other menu for licence shop

Code:
1
2
elseif sel == 9 then
               menu(id,[[Rent a license@b,Building License(50k),Vehicle License(50k),]])


third i add the commands for license shop

Code:
1
2
3
4
5
6
7
8
9
10
if men == [[Rent a license]] then
          if sel == 1 then
            if rp_license[pl]==false then
                rp_license[pl]=true
                rp_msg2([[000255000]],[[License Shop Owner Rent you a Building license!]])
              end
                    else
                    rp_msg2([[000255000]],[[You Dont Have Money To Rent This license!]])
               end
          end


evrything works fine but the license menu didnt open but i see it at the first menu, second menu didnt show up anyone know why?

thx for help
29.09.10 03:18:02 pm
Up
Surplus
User
Offline Off
iDios has written:
Ok so you can make me the script ?

Done when u posted that message
lol
29.09.10 04:11:01 pm
Up
GreenDevil
User
Offline Off
Please reply fast!!! :S
Something is wrong!
Code:
1
2
3
4
5
6
7
8
9
10
11
local money = 100


addhook("movetile","monzer")
function monzer(id,money)
     if (""..player(id,"tilex").." and "..player(id,"tiley")"") then
     tilex = 53
          tiley = 40
     parse("setmoney "..id.." "..(player(id,"money")+1)"")
     end
end
edited 1×, last 29.09.10 04:34:17 pm
29.09.10 04:46:22 pm
Up
SQ
Moderator
Offline Off
@MeGaEdIIToRMaN,
Your script makes no sense, in other words everything is wrong.
At least, tell me what that function should do...
Code:
1
2
3
4
addhook("movetile","monzer")
function monzer(id)
     parse("setmoney "..id.." "..(player(id,"money")+1))
end
29.09.10 04:59:18 pm
Up
HaRe
User
Offline Off
GrandMyth has written:
@MeGaEdIIToRMaN,
Your script makes no sense, in other words everything is wrong.
At least, tell me what that function should do...
Code:
1
2
3
4
addhook("movetile","monzer")
function monzer(id)
     parse("setmoney "..id.." "..(player(id,"money")+1))
end


he wants this

Code:
1
2
3
4
5
6
addhook("movetile","monzer")
function monzer(id,x,y)
     if x==53 and y==40 then
          parse("setmoney "..id.." "..(player(id,"money")+1))
     end
end
w0w im so eXotiK
29.09.10 06:42:40 pm
Up
Coffe
User
Offline Off
I was creating new items for my server of tibia, When i click on "dedicate server" and when the program runs, the console give me two Errors, i was wondering if someone could tell me the mistakes that i made.

1)First One

Lua : adding funcion 'TIMERms100' to hook 'ms100'
LUA ERROR : sys/lua/cs2dtibia/items.lua:1467: unespected symbol near ' . '

Spoiler >


2)Second One

ERROR: failed to load 'bot/names.txt'

Thanks a lot if you answer my question
edited 1×, last 29.09.10 07:04:50 pm
IMG:http://i750.photobucket.com/albums/xx148/carlosgarciadelcastillo/coffee-sig2.jpg
29.09.10 06:53:56 pm
Up
Boss
User
Offline Off
ok this is the last post for me here i post 2 and no one answer anw i fix them. so this one is very easy the problem with end.




if i do it like this :
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
if men == [[T Menu]] then
          if sel == 1 then
               menu(id,[[T Menu Insta Equip,Scout|$60000,Light Armor|$70000,Glock|$20000,Flashbang|$30000,Flare|20000]])
          elseif sel == 2 then
               rp_ct_arrest_button(id)
               if tele_sys == 1 then
                    if rp_license[id]==true then
                         menu(id,[[Teleport Menu@b,Go to position|$5000,Set Current Position,Toggle Spawn Behavior (]]..tsb[id]..[[),]]..ct_57_b)
                    else
                         rp_msg2(id,[[255000000]],[[[RP] You must to be licenced!]])
                    end
               else
                    rp_msg2(id,[[255000000]],[[[RP] Teleport System is Disabled!]])
               end
          elseif sel == 3 then
               rp_msg2(id,[[000255000]],[[[RP] Press F1 To see the Help]])
               end
         elseif sel == 4 then
               menu(id,[[Rent a vehicle part-1,BMW-2003(50k),Old-Ferrari(50K),Toyota(30k),Porche(50k),Infinity(70k),Rent a vehicle part-2]])
          elseif sel == 5 then
               menu(id,[[Rent a license@b,Building License(50k),Vehicle License(50k)]])
               end

the menu will work but u can`t press on [Rent a vehicle part-1] and [Rent a vehicle part-2] and [Rent a license].

ok now this weird if you press on [T Menu Insta Equip] then chose [Flashbang] the [Rent a vehicle part-1] will open then press on [Infinity] the [Rent a vehicle part-2] will open. the same thing for [Rent license] at [flare].

i`m confused i know i have to close each [if] with [end] so i try this
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
if men == [[T Menu]] then
          if sel == 1 then
               menu(id,[[T Menu Insta Equip,Scout|$60000,Light Armor|$70000,Glock|$20000,Flashbang|$30000,Flare|20000]])
               end
          elseif sel == 2 then
               rp_ct_arrest_button(id)
               if tele_sys == 1 then
                    if rp_license[id]==true then
                         menu(id,[[Teleport Menu@b,Go to position|$5000,Set Current Position,Toggle Spawn Behavior (]]..tsb[id]..[[),]]..ct_57_b)
                    else
                         rp_msg2(id,[[255000000]],[[[RP] You must to be licenced!]])
                    end
               else
                    rp_msg2(id,[[255000000]],[[[RP] Teleport System is Disabled!]])
               end
          elseif sel == 3 then
               rp_msg2(id,[[000255000]],[[[RP] Press F1 To see the Help]])
               end
          end
         elseif sel == 4 then
               menu(id,[[Rent a vehicle part-1,BMW-2003(50k),Old-Ferrari(50K),Toyota(30k),Porche(50k),Infinity(70k),Rent a vehicle part-2]])
          end
          elseif sel == 5 then
               menu(id,[[Rent a license@b,Building License(50k),Vehicle License(50k)]])
               end

when i start the server the whole script didnt work.

anyone know something about this? really weird

Edited : Fixed
edited 1×, last 30.09.10 12:21:18 am
To the start Previous 1 2 ... 267 268 269 ... 338 339 Next To the start