Help with LUA Scripts
+9
ZxC
_Yank
Nighthawk
zAzz
Soushiant.iR
Mommy123
piWi.
cracker22
alaa
13 posters
Page 1 of 2
Page 1 of 2 • 1, 2
Help with LUA Scripts
Do not make new topics. If you require help with scripts post them here and anyone who's willing can help you right here.
Re: Help with LUA Scripts
here it is.
alaa- Site user
- Gender : Posts : 1072
Points : 1209
Join date : 2015-01-24
Age : 23
Location : ramallah
Re: Help with LUA Scripts
How do you make the free day system?
It's so difficult lol, alot of breakable and dynwalls..
It's so difficult lol, alot of breakable and dynwalls..
Re: Help with LUA Scripts
zAzz LeL
ITS Not script ...
ITS Not script ...
cracker22- Site user
- Gender : Posts : 298
Points : 384
Join date : 2015-09-16
Location : in Your cs2d :P
Re: Help with LUA Scripts
u can put the freeday randomly from the editor not from a script, but the scan needs a script tho, and soushi gave it for you.
alaa- Site user
- Gender : Posts : 1072
Points : 1209
Join date : 2015-01-24
Age : 23
Location : ramallah
Re: Help with LUA Scripts
@zAzz, i rate you to ask someone who you know that he know this stuff. If you have to ask for every small function in the editor, how is it to read the tutorial about creating maps in the editor of cs:2d. I know that you are already able to make some stuff but it will help surely, so you can read it before you ask here. If you are interested click on this.
Also you can learn more if you take a look on california jail, like cracker said, it isnt a script and you are able to create it with the trigger_if.
The freeday system gets triggered by a trigger_if and a random function. fill in this:
Than create a trigger_start, which trigger the trigger_if where you filled this in. Than chose the stuff what should get triggered by a probability of 10% to 100 %, you can change the 10 to every number.
Anyway i would rate you to think about another system instead of a Freeday because it is the idea of lubo and it would be better if it is unique.
Regards
Also you can learn more if you take a look on california jail, like cracker said, it isnt a script and you are able to create it with the trigger_if.
The freeday system gets triggered by a trigger_if and a random function. fill in this:
- Code:
math.random(1, 100) <= 10
Than create a trigger_start, which trigger the trigger_if where you filled this in. Than chose the stuff what should get triggered by a probability of 10% to 100 %, you can change the 10 to every number.
Anyway i would rate you to think about another system instead of a Freeday because it is the idea of lubo and it would be better if it is unique.
Regards
Re: Help with LUA Scripts
Nighthawk wrote:@se7en, m8.Nighthawk wrote:
And here
LUA ERROR: sys/lua/autorun/stats.lua:3: '=' expected near 'initArray'
-> [C]: in function 'dofile'
-> [string "dofile("sys/lua/autorun/stats.lua")"]:1: in main chunk
pls?
Edit: nvm u typed fucntion instead of function
Edit2:
LUA ERROR: sys/lua/autorun/stats.lua:32: attempt to index field '?' (a number value)
-> sys/lua/autorun/stats.lua:32: in function
-> in Lua hook 'endround', params: 5
image show when i join but disappear when i restart :c
Edit3: I fixed it c:
Re: Help with LUA Scripts
You does't need lua script. First time, i have same question. But, now i have one jail map which have freeday system : http://www.unrealsoftware.de/files_show.php?file=16608. It need lot of NPC, dyn_wall, and explosion. But, you can also use script to make freeday system with math.random.zAzz wrote:How do you make the free day system?
It's so difficult lol, alot of breakable and dynwalls..
Mommy123- Site user
- Gender : Posts : 102
Points : 116
Join date : 2015-08-06
Age : 23
Location : Indonesia
Re: Help with LUA Scripts
piWi. wrote:@zAzz, i rate you to ask someone who you know that he know this stuff. If you have to ask for every small function in the editor, how is it to read the tutorial about creating maps in the editor of cs:2d. I know that you are already able to make some stuff but it will help surely, so you can read it before you ask here. If you are interested click on this.
Also you can learn more if you take a look on california jail, like cracker said, it isnt a script and you are able to create it with the trigger_if.
The freeday system gets triggered by a trigger_if and a random function. fill in this:
- Code:
math.random(1, 100) <= 10
Than create a trigger_start, which trigger the trigger_if where you filled this in. Than chose the stuff what should get triggered by a probability of 10% to 100 %, you can change the 10 to every number.
Anyway i would rate you to think about another system instead of a Freeday because it is the idea of lubo and it would be better if it is unique.
Regards
Thanks! Thanks Aloot!!, i suck sh*t at scripting lmao
Btw, anyone knows how to make the func_hit compatible with snowballs?
Or can anyone make a fast script for it if it isn't a pain in the ass?
Re: Help with LUA Scripts
http://pastie.org/private/pygpbb9sudcuhhhtksl5w
Hi I made this level and exp system, I only have one problem, I dont know how to make it save since I have no idea how io. stuff work so... unless you want to teach me I need you to add it in the missing functions.
This code is already in there so you shouldnt recreate it!
Also I need the best saving system you can make, that mean anti lag + map change + leaving + any other way to quit the server because my last saving system... rip
Hi I made this level and exp system, I only have one problem, I dont know how to make it save since I have no idea how io. stuff work so... unless you want to teach me I need you to add it in the missing functions.
- Code:
function load(id)
end
function save(id)
for id = 1,32 do
end
end
This code is already in there so you shouldnt recreate it!
Also I need the best saving system you can make, that mean anti lag + map change + leaving + any other way to quit the server because my last saving system... rip
Re: Help with LUA Scripts
Hi guys! I hope you can help me with 2 scripts :/
1:
How to make it that a mod can't kick a other mod or higher? If you can do that then pls send the full code here! Thank you!
PS: Add a error msg like "You can't kick Mod1 or higher."
2:
where i put this parse code for make it work? O.o
1:
- Code:
function hc.moderation.kick_say_command(p, id)
local array = {}
local kick_reason = ""
array = explode(" ", id)
for i=2, #array do
kick_reason = kick_reason.." "..array[i]
end
hc.exec(p, "kick " .. array[1]..' "'..kick_reason..'"')
end
function explode(div,str)
if (div=='') then return false end
local pos,arr = 0,{}
for st,sp in function() return string.find(str,div,pos,true) end do
table.insert(arr,string.sub(str,pos,st-1))
pos = sp + 1
end
table.insert(arr,string.sub(str,pos))
return arr
end
How to make it that a mod can't kick a other mod or higher? If you can do that then pls send the full code here! Thank you!
PS: Add a error msg like "You can't kick Mod1 or higher."
2:
- Code:
hc.add_menu_command("-[IFwsI]- Jail", hc.moderation.rero, hc.REROUT, hc.COMMAND_MENU_KEY, { category = "Friend Server" })
function hc.moderation.rero(p,func)
local entries = {
{ title = "Yes: Connect -[IFwsI]- Jail!", value = true },
{ title = "No: Don't connect -[IFwsI]- Jail!", value = false }
}
hc.show_menu(p, "Connect -[IFwsI]- Jail?", entries, func)
end
where i put this parse code for make it work? O.o
- Code:
function hc.moderation.rero(p, _, item)
parse("reroute "..p.." 149.202.65.171:36532")
end
Re: Help with LUA Scripts
Replace
with
- Code:
hc.exec(p, "kick " .. array[1]..' "'..kick_reason..'"')
with
- Code:
if hc.is_moderator(array[1]) then
msg2(p,"NOPE")
else
hc.exec(p, "kick " .. array[1]..' "'..kick_reason..'"')
end
Re: Help with LUA Scripts
Can someone help me?, It doesn't work
What's wrong?
- Code:
triggers = {
freeday = {cell1, cell2, cell3, cell4, cell5, cell6, cell7, cell8, cell9, cell10, itemz, freeday, freedayz, freedaysecret, startsecret, thedelayz2, itemz2},
warzone = {warz, thedelayz, warzs, rain}
}
addhook(startround, roundstart)
function roundstart()
local const_rand = math.random(1,100)
if const_rand > 90 then
for i=1,#triggers.freeday do
parse('trigger '..triggers.freeday[i])
end
elseif const_rand <= 5 then
for i=1,#triggers.warzone do
parse('trigger '..triggers.warzone[i])
end
for k,v in pairs (player(0,"tableliving")) do
if player(v,"team") == 1 then
parse("setpos "..v.." 5520 "..math.random(54,65)*32+16)
else
parse("setpos "..v.." 6384 "..math.random(54,65)*32+16)
end
end
end
end
--
-- Scan Script
--
scanners = {
{119,137,'hasWeapons','hasNoWeapons'}
{53,129,'hasWeapons1','hasNoWeapons1'}
}
addhook(movetile,movetile_hook)
function movetile_hook(id, x, y)
for _,i in pairs (scanners) do
if x == scanners[_][1] and y == scanners[_][2] then
if #playerweapons(id) 1 then
parse(trigger ..scanners[_][3])
else
parse(trigger ..scanners[_][4])
end
end
end
end
What's wrong?
Re: Help with LUA Scripts
- Code:
triggers = {
freeday = {'cell1', 'cell2', 'cell3',
'cell4', 'cell5', 'cell6',
'cell7', 'cell8', 'cell9',
'cell10', 'itemz', 'freeday',
'freedayz', 'freedaysecret',
'startsecret', 'thedelayz2', 'itemz2'},
warzone = {'warz', 'thedelayz', 'warzs', 'rain'}
}
addhook("startround", "roundstart")
function roundstart()
local const_rand = math.random(1,100)
parse("msg "..const_rand)
if const_rand > 90 then
for i=1,#(triggers.freeday) do
parse('trigger '..triggers.freeday[i])
end
elseif const_rand <= 5 then
for i=1,#(triggers.warzone) do
parse('trigger '..triggers.warzone[i])
end
for k,v in pairs (player(0,"tableliving")) do
if player(v,"team") == 1 then
parse("setpos "..v.." 5520 "..math.random(54,65)*32+16)
else
parse("setpos "..v.." 6384 "..math.random(54,65)*32+16)
end
end
end
end
Re: Help with LUA Scripts
1.Don't put it in autorun. Link it via server.lua.
2. Check the console for errors.
3. If errors, report here else check if the hooks in the script are being called
4. If the hooks are being called, something is wrong in the universe or you have multiple hooks clashing else you have the wrong file encoding set for the lua script.
5. Change file encoding: http://www.unrealsoftware.de/forum_posts.php?post=374427
2. Check the console for errors.
3. If errors, report here else check if the hooks in the script are being called
4. If the hooks are being called, something is wrong in the universe or you have multiple hooks clashing else you have the wrong file encoding set for the lua script.
5. Change file encoding: http://www.unrealsoftware.de/forum_posts.php?post=374427
Re: Help with LUA Scripts
It worked for me so idk mb there are some other part of your code is interfering with it
Re: Help with LUA Scripts
It's always best practice to tell how you fixed it incase others have the same problem.
Re: Help with LUA Scripts
- Code:
hudtxt2(id,ar.hudids[2],"255255255","NEXT WEAPON:",635,380,2)
What is wrong with this line?
It will place the hud at the top left of the screen
Re: Help with LUA Scripts
@Se7en: hudtxt2 is CS2D console command not a lua function. You can use the lua function called "parse" to execute CS2D commands:
Note: \" is used to "tell" the script that " is the character " itself and not a script keyword.
- Code:
parse("hudtxt2 "..id.." "..ar.hudids[2].." \"©255255255NEXT WEAPON:\" 635 380 2")
Note: \" is used to "tell" the script that " is the character " itself and not a script keyword.
Re: Help with LUA Scripts
Edit: NVM I found out that there's two of these lines and I replaced only one of them
thanks
I need help to convert these two into what Yank made but I failed because of the mass strings
thanks
- Code:
hudtxt2(id,ar.hudids[1],"255255255",itemtype(ar.weapons[ar.level[id]+1],"name").." ("..ar.level[id].."/"..#ar.weapons..")",635,430,2)
hudtxt(ar.hudids[3],""..tm[player(id,"team")].."","Lead: ("..ar.level[id]..") "..player(id,"name").."",5,110,0)
I need help to convert these two into what Yank made but I failed because of the mass strings
Page 1 of 2 • 1, 2
Page 1 of 2
Permissions in this forum:
You cannot reply to topics in this forum
|
|