-[IFwsI]-
You need an account to view all sections/topics

Join the forum, it's quick and easy

-[IFwsI]-
You need an account to view all sections/topics
-[IFwsI]-
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Help with LUA Scripts

+9
ZxC
_Yank
Nighthawk
zAzz
Soushiant.iR
Mommy123
piWi.
cracker22
alaa
13 posters

Page 1 of 2 1, 2  Next

Go down

Help with LUA Scripts Empty Help with LUA Scripts

Post by Nighthawk Fri Oct 30, 2015 9:44 am

Do not make new topics. If you require help with scripts post them here and anyone who's willing can help you right here.
Nighthawk
Nighthawk
-[IFwsI]- Co-Leader
-[IFwsI]- Co-Leader

Gender : Male Posts : 2426
Points : 2902
Join date : 2014-01-02
Age : 25
Location : Outside The Gates Of Your Mind

http://bit.ly/irfandahir

Back to top Go down

Help with LUA Scripts Empty Re: Help with LUA Scripts

Post by Se7en Fri Oct 30, 2015 4:03 pm

Se7en
Se7en
Site user
Site user

Gender : Male Posts : 1163
Points : 1342
Join date : 2013-12-07
Age : 23
Location : Israel

http://slowpoke101.forum.st/

Back to top Go down

Help with LUA Scripts Empty Re: Help with LUA Scripts

Post by alaa Fri Oct 30, 2015 4:50 pm

here it is.
alaa
alaa
Site user
Site user

Gender : Male Posts : 1072
Points : 1209
Join date : 2015-01-24
Age : 23
Location : ramallah

Back to top Go down

Help with LUA Scripts Empty Re: Help with LUA Scripts

Post by zAzz Fri Oct 30, 2015 5:34 pm

How do you make the free day system?
It's so difficult lol, alot of breakable and dynwalls..
zAzz
zAzz
Site user
Site user

Gender : Male Posts : 287
Points : 362
Join date : 2015-10-17
Age : 24
Location : Argentina

http://unrealsoftware.de/profile.php?userid=99264

Back to top Go down

Help with LUA Scripts Empty Re: Help with LUA Scripts

Post by cracker22 Fri Oct 30, 2015 6:06 pm

zAzz LeL
ITS Not script ...
cracker22
cracker22
Site user
Site user

Gender : Male Posts : 298
Points : 384
Join date : 2015-09-16
Location : in Your cs2d :P

Back to top Go down

Help with LUA Scripts Empty Re: Help with LUA Scripts

Post by alaa Fri Oct 30, 2015 6:24 pm

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
alaa
Site user
Site user

Gender : Male Posts : 1072
Points : 1209
Join date : 2015-01-24
Age : 23
Location : ramallah

Back to top Go down

Help with LUA Scripts Empty Re: Help with LUA Scripts

Post by piWi. Fri Oct 30, 2015 6:49 pm

@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
piWi.
piWi.
Site user
Site user

Gender : Male Posts : 1312
Points : 1450
Join date : 2015-07-13
Age : 107
Location : Germany

http://unrealsoftware.de/profile.php?userid=144441

Back to top Go down

Help with LUA Scripts Empty Re: Help with LUA Scripts

Post by Nighthawk Fri Oct 30, 2015 8:47 pm

@se7en, m8.
Nighthawk wrote:
And here
Nighthawk
Nighthawk
-[IFwsI]- Co-Leader
-[IFwsI]- Co-Leader

Gender : Male Posts : 2426
Points : 2902
Join date : 2014-01-02
Age : 25
Location : Outside The Gates Of Your Mind

http://bit.ly/irfandahir

Back to top Go down

Help with LUA Scripts Empty Re: Help with LUA Scripts

Post by Se7en Sat Oct 31, 2015 7:20 pm

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:
Se7en
Se7en
Site user
Site user

Gender : Male Posts : 1163
Points : 1342
Join date : 2013-12-07
Age : 23
Location : Israel

http://slowpoke101.forum.st/

Back to top Go down

Help with LUA Scripts Empty Re: Help with LUA Scripts

Post by Mommy123 Sun Nov 01, 2015 3:40 am

zAzz wrote:How do you make the free day system?
It's so difficult lol, alot of breakable and dynwalls..
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.
Mommy123
Mommy123
Site user
Site user

Gender : Male Posts : 102
Points : 116
Join date : 2015-08-06
Age : 23
Location : Indonesia

Back to top Go down

Help with LUA Scripts Empty Re: Help with LUA Scripts

Post by zAzz Wed Nov 04, 2015 6:06 am

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?
zAzz
zAzz
Site user
Site user

Gender : Male Posts : 287
Points : 362
Join date : 2015-10-17
Age : 24
Location : Argentina

http://unrealsoftware.de/profile.php?userid=99264

Back to top Go down

Help with LUA Scripts Empty Re: Help with LUA Scripts

Post by Se7en Wed Nov 04, 2015 7:59 am

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.

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
Se7en
Se7en
Site user
Site user

Gender : Male Posts : 1163
Points : 1342
Join date : 2013-12-07
Age : 23
Location : Israel

http://slowpoke101.forum.st/

Back to top Go down

Help with LUA Scripts Empty Re: Help with LUA Scripts

Post by Frªncis Tue Jan 26, 2016 9:54 am

Hi guys! I hope you can help me with 2 scripts :/

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
Frªncis
Frªncis
Site user
Site user

Gender : Male Posts : 163
Points : 229
Join date : 2014-06-16
Age : 24
Location : Jail

http://dr2d.omgforum.net/

Back to top Go down

Help with LUA Scripts Empty Re: Help with LUA Scripts

Post by Soushiant.iR Wed Jan 27, 2016 9:22 pm

Replace
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
Soushiant.iR
Soushiant.iR
Moderator
Moderator

Gender : Male Posts : 1266
Points : 1419
Join date : 2011-12-21
Age : 26
Location : Earthend

http://project-extract.site50.net/Download/gui.html

Back to top Go down

Help with LUA Scripts Empty Re: Help with LUA Scripts

Post by Frªncis Wed Jan 27, 2016 10:21 pm

Thanks! and with the rerout script ehm just forgot it, I have it already. Razz
Frªncis
Frªncis
Site user
Site user

Gender : Male Posts : 163
Points : 229
Join date : 2014-06-16
Age : 24
Location : Jail

http://dr2d.omgforum.net/

Back to top Go down

Help with LUA Scripts Empty Re: Help with LUA Scripts

Post by zAzz Sat Feb 06, 2016 2:16 am

Can someone help me?, It doesn't work Crying or Very sad
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?
zAzz
zAzz
Site user
Site user

Gender : Male Posts : 287
Points : 362
Join date : 2015-10-17
Age : 24
Location : Argentina

http://unrealsoftware.de/profile.php?userid=99264

Back to top Go down

Help with LUA Scripts Empty Re: Help with LUA Scripts

Post by Soushiant.iR Sat Feb 06, 2016 5:37 am

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
Soushiant.iR
Soushiant.iR
Moderator
Moderator

Gender : Male Posts : 1266
Points : 1419
Join date : 2011-12-21
Age : 26
Location : Earthend

http://project-extract.site50.net/Download/gui.html

Back to top Go down

Help with LUA Scripts Empty Re: Help with LUA Scripts

Post by zAzz Sat Feb 06, 2016 9:23 am

Still doesn't work o_O
zAzz
zAzz
Site user
Site user

Gender : Male Posts : 287
Points : 362
Join date : 2015-10-17
Age : 24
Location : Argentina

http://unrealsoftware.de/profile.php?userid=99264

Back to top Go down

Help with LUA Scripts Empty Re: Help with LUA Scripts

Post by Nighthawk Sat Feb 06, 2016 10:47 am

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
Nighthawk
Nighthawk
-[IFwsI]- Co-Leader
-[IFwsI]- Co-Leader

Gender : Male Posts : 2426
Points : 2902
Join date : 2014-01-02
Age : 25
Location : Outside The Gates Of Your Mind

http://bit.ly/irfandahir

Back to top Go down

Help with LUA Scripts Empty Re: Help with LUA Scripts

Post by Soushiant.iR Sat Feb 06, 2016 9:04 pm

It worked for me so idk mb there are some other part of your code is interfering with it
Soushiant.iR
Soushiant.iR
Moderator
Moderator

Gender : Male Posts : 1266
Points : 1419
Join date : 2011-12-21
Age : 26
Location : Earthend

http://project-extract.site50.net/Download/gui.html

Back to top Go down

Help with LUA Scripts Empty Re: Help with LUA Scripts

Post by zAzz Sat Feb 06, 2016 10:38 pm

Thanks guys i fixed it Very Happy
zAzz
zAzz
Site user
Site user

Gender : Male Posts : 287
Points : 362
Join date : 2015-10-17
Age : 24
Location : Argentina

http://unrealsoftware.de/profile.php?userid=99264

Back to top Go down

Help with LUA Scripts Empty Re: Help with LUA Scripts

Post by Nighthawk Sun Feb 07, 2016 4:08 pm

It's always best practice to tell how you fixed it incase others have the same problem.
Nighthawk
Nighthawk
-[IFwsI]- Co-Leader
-[IFwsI]- Co-Leader

Gender : Male Posts : 2426
Points : 2902
Join date : 2014-01-02
Age : 25
Location : Outside The Gates Of Your Mind

http://bit.ly/irfandahir

Back to top Go down

Help with LUA Scripts Empty Re: Help with LUA Scripts

Post by Se7en Sun Feb 07, 2016 6:07 pm

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 Sad
Se7en
Se7en
Site user
Site user

Gender : Male Posts : 1163
Points : 1342
Join date : 2013-12-07
Age : 23
Location : Israel

http://slowpoke101.forum.st/

Back to top Go down

Help with LUA Scripts Empty Re: Help with LUA Scripts

Post by _Yank Sun Feb 07, 2016 7:08 pm

@Se7en: hudtxt2 is CS2D console command not a lua function. You can use the lua function called "parse" to execute CS2D commands:
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.
_Yank
_Yank
Site user
Site user

Gender : Male Posts : 394
Points : 654
Join date : 2012-06-01
Age : 23
Location : Under your bed

http://ares2d.tk

Back to top Go down

Help with LUA Scripts Empty Re: Help with LUA Scripts

Post by Se7en Sun Feb 07, 2016 7:21 pm

Edit: NVM I found out that there's two of these lines and I replaced only one of them
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 Sad
Se7en
Se7en
Site user
Site user

Gender : Male Posts : 1163
Points : 1342
Join date : 2013-12-07
Age : 23
Location : Israel

http://slowpoke101.forum.st/

Back to top Go down

Help with LUA Scripts Empty Re: Help with LUA Scripts

Post by Sponsored content


Sponsored content


Back to top Go down

Page 1 of 2 1, 2  Next

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum