Forum

> > CS2D > Scripts > Lua Scripts/Questions/Help
Forums overviewCS2D overview Scripts overviewLog in to reply

English Lua Scripts/Questions/Help

6,770 replies
Page
To the start Previous 1 2326 327 328338 339 Next To the start

old Re: Lua Scripts/Questions/Help

JONY
User Off Offline

Quote
J3sse has written
Noob question: Is it OK to use a lua script in the first page that gives you 16k on respawn? If it is, where should i put it? :S


Yes, just put it in "sys/lua/server.lua" (open with notepad copy-paste the code and have fun).

old Re: Lua Scripts/Questions/Help

J3sse
User Off Offline

Quote
Thanks, but the script didnt seem to work for me - I did paste it on right file. Maybe it's outdated? Or should I press something to activate it? Appreciate your help.

NVM: works good now !!
edited 1×, last 14.12.10 06:53:01 pm

old Lua Script Help

Baofu92
User Off Offline

Quote
Hi,
I've got two questions:

>Can I change shoot point (default is in the center but i need to move it on the rigth, but ever shooting in front) whit a lua script? If yes can you show me how to do?

>Can i remove rotation of weapons when you select them (I mean on top of the screen there is 1 for rifles, 2 for pistols, 3 for knife and wrench, 4 for grenades etc.) ever with a lua script? If yes can you show me how to do?

∗Thanks∗

old Re: Lua Scripts/Questions/Help

JONY
User Off Offline

Quote
Guys, can you help me, please? Dont know what the problem is. I cant get any colored messages, i put this code:
1
parse("hudtxt2 "..id.." 0 \"©255000000red message\"" 40 415")

But instead i get some weired 'A' symbol with the same color numbers (255000000). Any ideas?
J.

old HELP

Fiz
User Off Offline

Quote
I used to be able to run this lua on a map called 'zm_pentagon'
but then i added some more item menu's and it stopped working on my map.

parse("mp_wpndmg scout 100")
parse("mp_wpndmg claw 40")
parse("mp_deathdrop 0")
parse("sv_gm 5")
parse("sv_fow 1")
parse("mp_infammo 1")
parse("mp_wpndmg sg550 60")
parse("mp_wpndmg USP 40")
parse("mp_wpndmg ak47 70")
parse("mp_wpndmg m3 95")
parse("mp_wpndmg xm1014 49")
parse("mp_wpndmg M4A1 69")


addhook("spawn", "pentagon")
function pentagon(id)
if player(id,"team") == 1 then
parse("speedmod "..id.." -15")
elseif player(id,"team") == 2 then
parse("setmaxhealth "..id.." 100")
parse("setmoney "..id.." 0")
end
end

addhook("second","healsystem")
function healsystem()
for id=1,32 do
if player(id,"exists") then
parse("sethealth "..id.." "..player(id,"health")+13)
end
end
end

addhook("minute","zombieadd")
function zombieadd()
parse("bot_add_t")
end

addhook("endround","botkick")
function botkick()
parse("bot_remove_all")
end

addhook("startround","antifreeze")
function antifreeze()
parse("bot_freeze 0")
end

addhook("use","gunbuy")
function gunbuy(id,event,data,x,y)
if (x == 81 and y == 70) then
menu(id,"M14 Menu,Buy|600 Pts.")
elseif (x == 80 and y == 88) then
menu(id,"Olympia Menu,Buy|600 Pts.")
elseif (x == 110 and y == 10) then
menu(id,"M16 Menu,Buy|1500 Pts.")
elseif (x == 100 and y == 14) then
menu(id,"Stakeout Menu,Buy|1800 Pts.")
elseif (x == 127 and y == 28) then
menu(id,"MP5k Menu,Buy|1000 Pts.")
elseif (x == 91 and y == 1) then
menu(id,"PM63 Menu,Buy|1000 Pts.")
elseif (x == 73 and y == 65) then
menu(id,"MPL Menu,Buy|900 Pts.")
elseif (x == 35 and y == 13) then
if (player(id,"money")>999) then
parse("setmoney "..id.." "..(player(id,"money") -

600))
parse("trigger a2")
end
elseif (x == 108 and y == 15) then
if (player(id,"money")>950) then
parse("setmoney "..id.." "..(player(id,"money") -

950))
local c=math.random(1,14)
if c==1 then
parse("weapon m3; drop; weapon mp5; drop; weapon

scout; drop; weapon sg550; drop; weapon ak47; drop; weapon sg552;

drop; weapon rpg; drop; weapon flamethrower; drop; weapon m249;

drop; weapon p90; drop")
parse("equip "..id.." 35")
elseif c==2 then
parse("weapon m3; drop; weapon mp5; drop; weapon

scout; drop; weapon sg550; drop; weapon ak47; drop; weapon sg552;

drop; weapon rpg; drop; weapon flamethrower; drop; weapon m249;

drop; weapon p90; drop")
parse("equip "..id.." 22")
elseif c==3 then
parse("weapon m3; drop; weapon mp5; drop; weapon

scout; drop; weapon sg550; drop; weapon ak47; drop; weapon sg552;

drop; weapon rpg; drop; weapon flamethrower; drop; weapon m249;

drop; weapon p90; drop")
parse("equip "..id.." 3")
elseif c==4 then
parse("weapon m3; drop; weapon mp5; drop; weapon

scout; drop; weapon sg550; drop; weapon ak47; drop; weapon sg552;

drop; weapon rpg; drop; weapon flamethrower; drop; weapon m249;

drop; weapon p90; drop")
parse("equip "..id.." 39")
elseif c==5 then
parse("weapon m3; drop; weapon mp5; drop; weapon

scout; drop; weapon sg550; drop; weapon ak47; drop; weapon sg552;

drop; weapon rpg; drop; weapon flamethrower; drop; weapon m249;

drop; weapon p90; drop")
parse("equip "..id.." 20")
elseif c==6 then
parse("weapon m3; drop; weapon mp5; drop; weapon

scout; drop; weapon sg550; drop; weapon ak47; drop; weapon sg552;

drop; weapon rpg; drop; weapon flamethrower; drop; weapon m249;

drop; weapon p90; drop")
parse("equip "..id.." 10")
elseif c==7 then
parse("weapon m3; drop; weapon mp5; drop; weapon

scout; drop; weapon sg550; drop; weapon ak47; drop; weapon sg552;

drop; weapon rpg; drop; weapon flamethrower; drop; weapon m249;

drop; weapon p90; drop")
parse("equip "..id.." 11")
elseif c==8 then
parse("weapon m3; drop; weapon mp5; drop; weapon

scout; drop; weapon sg550; drop; weapon ak47; drop; weapon sg552;

drop; weapon rpg; drop; weapon flamethrower; drop; weapon m249;

drop; weapon p90; drop")
parse("equip "..id.." 31")
elseif c==9 then
parse("weapon m3; drop; weapon mp5; drop; weapon

scout; drop; weapon sg550; drop; weapon ak47; drop; weapon sg552;

drop; weapon rpg; drop; weapon flamethrower; drop; weapon m249;

drop; weapon p90; drop")
parse("equip "..id.." 32")
elseif c==10 then
parse("weapon m3; drop; weapon mp5; drop; weapon

scout; drop; weapon sg550; drop; weapon ak47; drop; weapon sg552;

drop; weapon rpg; drop; weapon flamethrower; drop; weapon m249;

drop; weapon p90; drop")
parse("equip "..id.." 47")
elseif c==11 then
parse("weapon m3; drop; weapon mp5; drop; weapon

scout; drop; weapon sg550; drop; weapon ak47; drop; weapon sg552;

drop; weapon rpg; drop; weapon flamethrower; drop; weapon m249;

drop; weapon p90; drop")
parse("equip "..id.." 46")
elseif c==12 then
parse("weapon m3; drop; weapon mp5; drop; weapon

scout; drop; weapon sg550; drop; weapon ak47; drop; weapon sg552;

drop; weapon rpg; drop; weapon flamethrower; drop; weapon m249;

drop; weapon p90; drop")
parse("equip "..id.." 40")
elseif c==13 then
parse("weapon m3; drop; weapon mp5; drop; weapon

scout; drop; weapon sg550; drop; weapon ak47; drop; weapon sg552;

drop; weapon rpg; drop; weapon flamethrower; drop; weapon m249;

drop; weapon p90; drop")
parse("equip "..id.." 73")
elseif c==14 then
parse("weapon m3; drop; weapon mp5; drop; weapon

scout; drop; weapon sg550; drop; weapon ak47; drop; weapon sg552;

drop; weapon rpg; drop; weapon flamethrower; drop; weapon m249;

drop; weapon p90; drop")
parse("equip "..id.." 30")

end
end
elseif (x == 45 and y == then
menu(id,"Ammo menu,Buy ammo|200 Pts.")
end
end

addhook("menu","gunbuymenu")
function gunbuymenu(id,title,key)
if (title == "M14 Menu") then
if (key == 1) then
local money = player(id,"money")
if money>599 then
parse("setmoney "..id.." "..(player(id,"money") - 600))
parse("weapon m3; drop; weapon mp5; drop; weapon scout; drop; weapon

sg550; drop; weapon ak47; drop; weapon sg552; drop; weapon rpg;

drop; weapon flamethrower; drop; weapon m249; drop; weapon p90;

drop")
parse("equip "..id.." 37")
end
end
end

if (title == "Olympia Menu") then
if (key == 1) then
local money = player(id,"money")
if money>599 then
parse("setmoney "..id.." "..(player(id,"money") - 600))
parse("weapon m3; drop; weapon mp5; drop; weapon scout; drop; weapon

sg550; drop; weapon ak47; drop; weapon sg552; drop; weapon rpg;

drop; weapon flamethrower; drop; weapon m249; drop; weapon p90;

drop")
parse("equip "..id.." 11")
end
end
end

if (title == "M16 Menu") then
if (key == 1) then
local money = player(id,"money")
if money>1499 then
parse("setmoney "..id.." "..(player(id,"money") - 1500))
parse("weapon m3; drop; weapon mp5; drop; weapon scout; drop; weapon

sg550; drop; weapon ak47; drop; weapon sg552; drop; weapon rpg;

drop; weapon flamethrower; drop; weapon m249; drop; weapon p90;

drop")
parse("equip "..id.." 32")
end
end
end

if (title == "Stakeout Menu") then
if (key == 1) then
local money = player(id,"money")
if money>1799 then
parse("setmoney "..id.." "..(player(id,"money") - 1800))
parse("weapon m3; drop; weapon mp5; drop; weapon scout; drop; weapon

sg550; drop; weapon ak47; drop; weapon sg552; drop; weapon rpg;

drop; weapon flamethrower; drop; weapon m249; drop; weapon p90;

drop")
parse("equip "..id.." 10")
end
end
end

if (title == "MPL Menu") then
if (key == 1) then
local money = player(id,"money")
if money>999 then
parse("setmoney "..id.." "..(player(id,"money") - 1000))
parse("weapon m3; drop; weapon mp5; drop; weapon scout; drop; weapon

sg550; drop; weapon ak47; drop; weapon sg552; drop; weapon rpg;

drop; weapon flamethrower; drop; weapon m249; drop; weapon p90;

drop")
parse("equip "..id.." 23")
end
end
end

if (title == "PM63 Menu") then
if (key == 1) then
local money = player(id,"money")
if money>999 then
parse("setmoney "..id.." "..(player(id,"money") - 1000))
parse("weapon m3; drop; weapon mp5; drop; weapon scout; drop; weapon

sg550; drop; weapon ak47; drop; weapon sg552; drop; weapon rpg;

drop; weapon flamethrower; drop; weapon m249; drop; weapon p90;

drop")
parse("equip "..id.." 24")
end
end
end

if (title == "MP5k Menu") then
if (key == 1) then
local money = player(id,"money")
if money>999 then
parse("setmoney "..id.." "..(player(id,"money") - 1000))
parse("weapon m3; drop; weapon mp5; drop; weapon scout; drop; weapon

sg550; drop; weapon ak47; drop; weapon sg552; drop; weapon rpg;

drop; weapon flamethrower; drop; weapon m249; drop; weapon p90;

drop")
parse("equip "..id.." 20")
end
end
end
end - this needed to be added
addhook("kill","no_money")
function no_money(id)
parse("setmoney "..id.." "..(player(id,"money")-200))
end




EDIT:nvm, have found the bug
there were 3 'ends' not 4 (have highlighted the mistake in bold)
edited 1×, last 15.12.10 12:46:05 pm

old Re: Lua Scripts/Questions/Help

JONY
User Off Offline

Quote
FN_Nemesis has written
@Jony sould try with this one
1
parse('hudtxt2 '..id..' 2 "©255000000 Red message" 40 415')


Just tried. Still the same result. How do i fix it?

old Re: Lua Scripts/Questions/Help

J4x
User Off Offline

Quote
Maybe with parse
1
('hudtxt2 '..id..' 2 "©255000000Red message" 40 415')

if this dont work try to Pm flacko

old Re: Lua Scripts/Questions/Help

Yasday
User Off Offline

Quote
1
2
copyright = string.char(0169)
parse('hudtxt2 '..id..' 2 "'..copyright..'255000000 Red message" 40 415')
maybe in your pc © doesnt work try this
edited 1×, last 16.12.10 12:14:01 am

old Re: Lua Scripts/Questions/Help

JONY
User Off Offline

Quote
Yasday has written
1
2
copyright = string.char(0169)
parse('hudtxt2 '..id..' 2 ""..copyright.."255000000 Red message" 40 415')
maybe in your pc © doesnt work try this


Hey, it worked! Thanks a lot btw it should be like this:
1
parse('hudtxt2 '..id..' 0 "'..copyright..'255000000 Red message" 40 415')

Really helped me, man!
J.

old Re: Lua Scripts/Questions/Help

Yasday
User Off Offline

Quote
Yeah.. sry didn't look at it just copied from nemesis and put a " there

just using string.char was the first thing i thought about when i saw your posts

old Re: Lua Scripts/Questions/Help

Starkkz
Moderator Off Offline

Quote
Can anyone help me with this pathfinding AI script?

Spoiler >


I want to make him find a way to go to a position, but he comes back to the same tile because it's on his way.
I know what's the problem, but i don't know how to fix it.
I want to make it like the bot's pathfinder.
To the start Previous 1 2326 327 328338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview