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 282 83 84338 339 Next To the start

old Re: Lua Scripts/Questions/Help

NozliW
User Off Offline

Quote
maybe this works
i didn't tested it but it might work
Spoiler >

it heals victim both hp and armor so it would just damage the buildings

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
-WiLSoN-, wouldn't be that faster?
1
2
3
addhook("hit","hitt") 
	return 1
end

N-B-K,
Haven't you tried Break?

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
Blazzingxx has written
N-B-K,
Haven't you tried Break?


"break" breaks a loop, I think he wants to stop the execution of a function. IDK. You could also try "return 0"

old Re: Lua Scripts/Questions/Help

Heartless Soldier
User Off Offline

Quote
Flacko has written
Blazzingxx has written
N-B-K,
Haven't you tried Break?


"break" breaks a loop, I think he wants to stop the execution of a function. IDK. You could also try "return 0"


ok, thanks both; i'll try it

edit:

it works


but works very fast, im searching something to do it a bit slower, it is with os.time no?


EDIT 2:

i did it

mark = os.time
if(xxx and mark > mark + 0.2) thn

but the console says something like aritmethic attempt...

helpp

old Re: Lua Scripts/Questions/Help

HiddenSuprise
User Off Offline

Quote
How To Create Menu which has options to choose.

-Pokemons
-Pokecenter
-Pokemart
-Inventory
----------------------------
If you chosse Pokemons Show Pokemons to chosse -Pikachu Charmander Bulbasaur Squirtlle Psyduck...

-If you chosse PokeCenter Show Heal--For 500 Credits

-If you chosse Pokecenter Show Items To Buy -Potion For 50 Credits -Give 10 Hp,Regen Give 5 Hp in 5 sec -For 700 Credits,Bomb Explode In Range 15x15 -For 600 Credits

If you chosse Inventory Shows Your Buyed Items.


Please Help...

old Re: Lua Scripts/Questions/Help

Heartless Soldier
User Off Offline

Quote
HiddenSuprise has written
How To Create Menu which has options to choose.

-Pokemons
-Pokecenter
-Pokemart
-Inventory
----------------------------
If you chosse Pokemons Show Pokemons to chosse -Pikachu Charmander Bulbasaur Squirtlle Psyduck...

-If you chosse PokeCenter Show Heal--For 500 Credits

-If you chosse Pokecenter Show Items To Buy -Potion For 50 Credits -Give 10 Hp,Regen Give 5 Hp in 5 sec -For 700 Credits,Bomb Explode In Range 15x15 -For 600 Credits

If you chosse Inventory Shows Your Buyed Items.


Please Help...


it is too easy, search some code for an example...
i'll help u
another thing, isnt buyed is bought

------------------

1
2
3
4
5
addhook("serveraction","pokemenu")
function pokemenu(id,action)
		menu(id,"Select your action,Pokemons,Pokecenter,Pokemart,Inventory")
	end
end

ITs the main menu, works when you press F2.

1
2
3
4
5
6
7
8
9
10
11
addhook("menu","seconmenu")
function seconmenu(id,xmenu,select)
	if (xmenu=="Select your action") then
		if (select == 1) then
			menu(id,"Pokemons,Pikachu|Electric,Charmander|Fire,Squartle|Agua") else
		if (select == 2) then
			menu(id,"Select item,The Cure|Cost : 500") else
		end
		end
	end
end

U make the rest ;).

old Re: Lua Scripts/Questions/Help

NozliW
User Off Offline

Quote
I'm still having problems with these:
1
2
3
4
5
6
7
8
9
10
11
12
13
function kills(vic,id,wpn,hp,ap)
	local s
	for s = 1, 10 do
		local p
		for p= 1, 7 do
			if (player(vic,class) == [s]) then
				if (player(p,class) == [p]) then
				--rest of the script--
				end
			end
		end
	end
end
still got the unexpected symbol near "]" ;S
edited 1×, last 07.11.09 07:56:11 pm

old Re: Lua Scripts/Questions/Help

Heartless Soldier
User Off Offline

Quote
-WiLSoN- has written
I'm still having problems with these:
1
2
3
4
5
6
7
8
9
10
11
12
13
function kills(vic,id,wpn,hp,ap)
     local s
     for s = 1, 10 do
          local p
          for p= 1, 7 do
               if (player(vic,class) == [s]) then
                    if (player(p,class) == [p]) then
                    --rest of the script--
                    end
               end
          end
     end
end
still got the unexpected symbol near "]" ;S


i have a question, if u change:
1
2
3
4
local s
     for s = 1, 10 do
          local p
          for p= 1, 7 do

for:

1
2
s = 1, 10 do
p = 1, 7 do

and then when u put
if (player(vic,class) == [s])
change for
if (player(vic,class) == s)

isnt the same?, or u have to do it?

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
[] - mostly means table.

1
2
3
4
5
6
value = {5,4,3,2,1}
value[1] = 5
value[2] = 4
value[3] = 3
value[4] = 2
value[5] = 1

old Re: Lua Scripts/Questions/Help

Heartless Soldier
User Off Offline

Quote
-WiLSoN- has written
i dont know too much about lua but i know that i need that []
and the "for"


Try this:

1
2
3
4
5
6
7
8
9
10
11
function kills(vic,id,wpn,hp,ap)
super = 1, 10 do
pipo = 1, 7 do
if (player(vic,class)==super) then
if (player(p,class) ==pipo) then
--rest of the script--
end
end
end
end
end

i dont know if it will work but u dont lose nothing trying...

good luck

@Blazzing
can u help me with a little thing?
i have a code but it runs very very fast like all of codes i want to do something like:
if(bla bla bla and time > pipo + 0.2 secs) then

ITS just an example of course xD, i hope u undestood me

old Re: Lua Scripts/Questions/Help

Heartless Soldier
User Off Offline

Quote
Blazzingxx has written
N-B-K,
Just what action you want to make?


oh thanks for ur attention, i have made it.

i had a mistake but i solved it


edit:: is there a half second hook? xd

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
N-B-K has written
edit:: is there a half second hook? xd

No, just possible to script 0.5 sec function.

old Re: Lua Scripts/Questions/Help

CmDark
User Off Offline

Quote
guys

isn't it funny that when i released my

luax scripts

Sasha just coincidently released:

"!mypos" -(its in my luax scripts as @positions)

in the unrealsoftware files

not suggesting anything just stating this

in fact the script is about 90% similar to it


btw im gonna make a gigantic rpg map with lua scripts
feel free to suggest stuff to me

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
@CmDark,
Don't start that, fact is that everyone wants to make scripts easiest way.

Ect, I see my scripts everywhere, without my credits >.>
To the start Previous 1 282 83 84338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview