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 2154 155 156338 339 Next To the start

old Re: Lua Scripts/Questions/Help

RAVENOUS
BANNED Off Offline

Quote
Maybe he should say what he removed from the script? Btw. pack the script in a spoiler. Please. That's nearly spam when it's that big to scroll a half minute to top of the screen...

old Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

Quote
Skipper has written
Maybe he should say what he removed from the script? Btw. pack the script in a spoiler. Please. That's nearly spam when it's that big to scroll a half minute to top of the screen...


I totally agree!
...And good idea (: I had never thought of that

old Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Quote
Anders4000 i have question for that fog code.
If i say !NOFOG, then all players will see on map? or only i?
pls tell.

old Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

Quote
DRoNe has written
Anders4000 i have question for that fog code.
If i say !NOFOG, then all players will see on map? or only i?
pls tell.


I'm sorry. But the fog will change for all!

If you set it to off -> There wouldn't be any fog (For all)
If you set it to on -> There would be fog for all.

It is not enabled to let 1 player have no fog, and the others have.


So the answer to your question is: All players will se on map (:

old Re: Lua Scripts/Questions/Help

Crazyx
User Off Offline

Quote
Could someone fix me this:
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
--[[
Made by the Unrealsoftware.de User "Heavy"
Rule no 1: Do what ever you want with this script. But dont claim this as your own!

» Changelog:
[ADDED] disabling/enabling money
[FIXED] mines didn't work
[FIXED] building sometimes didn't work (if this still doesn't work ,try disabling other buildingluascripts)
[FIXED] you weren't able to see whose building it is/was
[CHANGED] code cleaned up a bit


ENABLE/DISABLE Stuff (Note: 1 means enabled and 0 means disabled ]]
fastbuild=1
unlimitedbuild=1
money=0


-- FastBuild:

addhook("build","fb")
    function fb(id,type,x,y)

		function spawnobject()
			parse("spawnobject "..type.." "..x.." "..y.." 0 0 "..player(id,"team").." "..id);
		end

		function checkmoney(mmoney)
			if(money==1) then
				parse("setmoney "..id.." "..player(id,"money")-mmoney);
			end
		end

        if (fastbuild==1) then
			if(type==1) and (player(id,"money")>=300) then
				spawnobject()
				checkmoney(300)
			elseif(type==2) and (player(id,"money")>=500) then
				spawnobject()
				checkmoney(500)
			elseif(type==3) and (player(id,"money")>=1000) then
				spawnobject()
				checkmoney(1000)
			elseif(type==4) and (player(id,"money")>=2000) then
				spawnobject()
				checkmoney(2000)
			elseif(type==5) and (player(id,"money")>=3000) then
				spawnobject()
				checkmoney(3000)
			elseif(type==6) and (player(id,"money")>=1500) then
				spawnobject()
				checkmoney(1500)
			elseif(type==7) and (player(id,"money")>=5000) then
				spawnobject()
				checkmoney(5000)
			elseif(type==8) and (player(id,"money")>=5000) then
				spawnobject()
				checkmoney(5000)
			elseif(type==9) and (player(id,"money")>=5000) then
				spawnobject()
				checkmoney(5000)
			elseif(type==13) and (player(id,"money")>=3000) then
				spawnobject()
				checkmoney(3000)
			elseif(type==14) and (player(id,"money")>=3000) then
				spawnobject()
				checkmoney(5000)
			elseif(type==20) then -- Mines...
				spawnobject()
			end
            return 1
		else
			return 0
        end
    end

-- UnlimitedBuild:

if (unlimitedbuild==1) then
    parse('mp_building_limit "Barricade" 10000');
    parse('mp_building_limit "Barbed Wire" 10000');
    parse('mp_building_limit "Wall I" 10000');
    parse('mp_building_limit "Wall II" 10000');
    parse('mp_building_limit "Wall III" 10000');
    parse('mp_building_limit "Gate Field" 10000');
    parse('mp_building_limit "Turret" 10000');
    parse('mp_building_limit "Dispenser" 10000');
    parse('mp_building_limit "Supply" 10000');
    parse('mp_building_limit "Teleporter Entrance" 10000');
    parse('mp_building_limit "Teleporter Exit" 10000');
end

Error: it says "unexpected string on line 4):

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
Error on Lua comment? It's not possible.

I think you should try to close Lua comment with this:
1
--]]

Too bad, I can't test it right now.
edited 1×, last 30.01.10 11:33:36 pm

old Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

Quote
Are you sure it has o be a "--]]"? i think it shall be "]]--" (:

Like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
--[[ 
Made by the Unrealsoftware.de User "Heavy" 
Rule no 1: Do what ever you want with this script. But dont claim this as your own! 

» Changelog: 
[ADDED] disabling/enabling money 
[FIXED] mines didn't work 
[FIXED] building sometimes didn't work (if this still doesn't work ,try disabling other buildingluascripts) 
[FIXED] you weren't able to see whose building it is/was 
[CHANGED] code cleaned up a bit 


ENABLE/DISABLE Stuff (Note: 1 means enabled and 0 means disabled ]]--

old Re: Lua Scripts/Questions/Help

Lee
Moderator Off Offline

Quote
Anders4000 has written
Are you sure it has o be a "--]]"? i think it shall be "]]--" (:


All Lua string type blocks are closed off by ]], therefore it doesn't really matter if it's --]] or]]--. For Consistency however, use --]] as the statements after ]] are still evaluated. For example

print(--[[OMG]]":D") is a valid expression.

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
@Heavy
You should make a table of buildings money thought.
In that case, you could change many ifs.
But I guess you know that already...

old Re: Lua Scripts/Questions/Help

Homer
User Off Offline

Quote
@flacko Your script isn't working, Only reading one of the table values. I copiied it exactly and tried and it still didn't work.

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
@Homer
If it's not working, you shouldn't be mad or upset anyway.
I don't get most of people here, why don't they try to make it first instead of asking all the time same questions?
edited 1×, last 31.01.10 03:10:28 am

old Re: Lua Scripts/Questions/Help

Homer
User Off Offline

Quote
Blazzing, I did make my own version of this, Yet it didn't loop through the table either, I asked for help, And he gave me a script. It worked but now it isn't.. The reason I asked again is because I want to know why it isn't. And I'm not mad, I'm just curious.

EDIT: Never Mind, Sorry guys, I had to trick the script, I fixed it now Weird though, I had to make it instead of ~= I had to use if not. To get it to print both value's.

And, Another question, should ~= say that if it is not equal to the specified value then it returns true?
edited 2×, last 31.01.10 04:30:43 am

old Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

Quote
leegao has written
Anders4000 has written
Are you sure it has o be a "--]]"? i think it shall be "]]--" (:


All Lua string type blocks are closed off by ]], therefore it doesn't really matter if it's --]] or]]--. For Consistency however, use --]] as the statements after ]] are still evaluated. For example

print(--[[OMG]]":D") is a valid expression.


Hm.. (:

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

Blazzingxx has written
~= - Not equal
== - Equal
>= - Greater or equal
<= - Lower or equal

Thanks for that!
- Very useful (:

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
Homer has written
@flacko Your script isn't working, Only reading one of the table values. I copiied it exactly and tried and it still didn't work.

You were suppossed to read what I wrote, not the script.
I just tabbed your script and you would fix it using my suggestion:

Me has written
Your problem is that you return 1 if the first item in the table isn't equal to your USGN, returning cuts the execution of a function.
So you might want to move the return 1 right before the last end. This way it will only return 1 if the USGN hasn't been found in your table after your loop.

old Re: Lua Scripts/Questions/Help

Homer
User Off Offline

Quote
Oh sorry, My bad, And, now it's giving a new error.. I'll try to fix it.. Thanks. But, A weird thing happens, I do ~= and return 1 at the end, yet it won't let me join the team. I don't know why? Also give's a nil value fuond, but I don't know what could be nil. I printed everything there.. But It still says nil. And why isn't the ~= working.. is it because of the nil value?
But, It might be the player(id,"usgn") thingy, since I don't know for sure, but when I print it, it returns 2 value's of the persons usgn. And it only return the first value 2 times. Could that be it? And if so.. how could I fix it, if your suggestion fixed only the comparision of the equal?
edited 2×, last 31.01.10 11:43:41 pm

old Re: Lua Scripts/Questions/Help

Homer
User Off Offline

Quote
It's not even just the not equal, It doesn't work if I use the equal. But, i was also curious about why that doesn't work, but I only "need" the solution to nil and this problem
1
2
3
4
5
6
7
8
9
10
11
addhook("team","Team1")
function Team1(id,team)
     for index, value in ipairs(ADMINS.S) do
          if (team == 1) then
		  print(player(id,"usgn"))
               if (player(id,"usgn") == value) then
               end
          end
     end
	return 0
end
To the start Previous 1 2154 155 156338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview