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 2318 319 320338 339 Next To the start

old Re: Lua Scripts/Questions/Help

CmDark
User Off Offline

Quote
@Redneck iono Can I?

just add

Spoiler >


It's not very hard if you made that script

@Yasday
you don't need for for that
id 0 strips everything besides the main melee wep.
parse('strip '..id..' 0')
^ Works
^
TDShuft read that^
edited 2×, last 27.11.10 11:09:05 pm

old Re: Lua Scripts/Questions/Help

TDShuft
User Off Offline

Quote
Yasday has written
@batlaizys
no it won't, it will just strip sth like this:
1
parse([[strip ]]..id..[[ ]]..wpnid) --wpnid must be the id of the waepon ;)
for stripping all weps use this (errors but you can remove em, still works):
1
2
3
for wpnid = 1,88 do
	parse([[strip ]]..id..[[ ]]..wpnid)
end

well for no lag and no errors
i think (i didnt test):
1
2
3
for wpnid = 1,playerweapons(id) do
	parse([[strip ]]..id..[[ ]]..wpnid)
end
sorry but my pc is laggy now and i cant enter cs2d
//edit : lol i didnt see sorry ..
edited 1×, last 27.11.10 11:17:44 pm

old Re: Lua Scripts/Questions/Help

Yasday
User Off Offline

Quote
@TDShuft
lol yours couldn't even work i think
you have to put a # before the table (playerweapons(id)) to get the number of ... ühhm values
idk but could it work like this?
sry not tabbed, on ipod
1
2
3
4
local pwp = playerweapons(id)
for i = 1,#pwp do
parse([[strip ]]..id..[[ ]]..pwp[i])
end
and a question:
what you didn't see? lol

READ THIS FIRST!:

omg and now i read the post of CmDark..
thx dark now forget evrything i wrote

old Re: Lua Scripts/Questions/Help

Redneck
BANNED Off Offline

Quote
Someone make this please when i move on a tile it teleports me to a place (for team4)
example: from tile 12 1 to tile 14 1
thank you
Spoiler >

old Re: Lua Scripts/Questions/Help

CmDark
User Off Offline

Quote
@Redneck, done [Check your messages]
but it uses normal X and Y.(counts 32 as a single tile)

Not the TileX and TileY(the one that counts 1 as a tile)

old Re: Lua Scripts/Questions/Help

archmage
User Off Offline

Quote
Image color is not the same as an image mask. That would make my image pinkish. A mask is used to hide a color (make it fully transparent).

old Re: Lua Scripts/Questions/Help

Kurumi
User Off Offline

Quote
[/code]if sample==nil then sample={} end
sample.classes={}

-----------------------
-- INITIAL SETUP --
-----------------------
function initArray(m)
     local array = {}
     for i = 1, m do
          array[i]=0
     end
     return array
end
sample.classes.class=initArray(32)
function sample.classes.classmenu(id)
     menu(id,"Modern Warfare 2 Character,Shepherd|Deagle-Armor,Ghost|UMP45,Cpt.Price|MP5,Soap Mactavish|AUG,James Ramirez|M4A1+Fast,Captain MacMillan|Scout+TMPSD")     
end


-----------------------
-- TEAM -> CLASS --
-----------------------
addhook("team","sample.classes.team")
function sample.classes.team(id,team)
     if (team>0) then
          sample.classes.classmenu(id)
     end
end


-----------------------
-- SERVERACTION --
-----------------------
addhook("serveraction","sample.classes.serveraction")
function sample.classes.serveraction(id)
     sample.classes.classmenu(id)
end


-----------------------
-- CLASS SELECTION --
-----------------------
addhook("menu","sample.classes.menu")
function sample.classes.menu(id,menu,sel)
     if (menu=="Select Your Modern Warfare 2 Character") then
          if (sel>=0 and sel<=6) then
               sample.classes.class[id]=sel
               if (player(id,"health")>0) then
                    parse("killplayer "..id)
               end
          end
     end
end


-----------------------
-- SPAWN --
-----------------------
addhook("spawn","sample.classes.spawn")
function sample.classes.spawn(id)
     -- Shepherd
     if (sample.classes.class[id]==1) then
          parse ("setmaxhealth "..id.." 200")
          parse ("setarmor "..id.." 0")
          parse ("speedmod "..id.." 5")
          return "3";
     end
     -- Ghost
     if (sample.classes.class[id]==2) then
          parse ("setmaxhealth "..id.." 125")
          parse ("setarmor "..id.." 150")
          parse ("speedmod "..id.." 7")
          return "24,5";
     end
     -- Cpt. Price
     if (sample.classes.class[id]==3) then
          parse ("setmaxhealth "..id.." 100")
          parse ("setarmor "..id.." 50")
parse ("speedmod "..id.." -2")
          return "4,20";
     end
     -- Soap MacTavish
     if (sample.classes.class[id]==4) then
          parse ("setmaxhealth "..id.." 150")
          parse ("setarmor "..id.." 75")
          return "33,6";
     end
     -- James Ramirez
     if (sample.classes.class[id]==5) then
          parse ("setmaxhealth "..id.." 75")
          parse ("setarmor "..id.." 0")
          parse ("speedmod "..id.." 13")
          return "32,1";
     end
     -- Captain MacMillan
     if (sample.classes.class[id]==6) then
          parse ("setmaxhealth "..id.." 50")
          parse ("setarmor "..id.." 125")
parse ("speedmod "..id.." 10")
          return "34,21";
     end
end

Help! I Allways Get Stats And Weapons, choosing other classes doesnt help:
     [/code]-- Shepherd
     if (sample.classes.class[id]==1) then
          parse ("setmaxhealth "..id.." 200")
          parse ("setarmor "..id.." 0")
          parse ("speedmod "..id.." 5")
          return "3";

old Re: Lua Scripts/Questions/Help

Rainoth
Moderator Off Offline

Quote
I tried to fix the code
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
function initArray(m)
local array = {}
for i = 1, m do
array[i]=0
end
return array
end
level=initArray(32)
exp=initArray(32)
credits=initArray(32)
points=initArray(32)
streak=initArray(32)
hacker=initArray(32)
medikit=initArray(32)

function string.split(text,b)
local cmd = {}
if b then
b = b
else
b = "%s"
end
b = "[^"..b.."]+"
for o in string.gmatch(text,b) do
table.insert(cmd,o)
end
return cmd
end

if hacker==nil then hacker={} end
hacker={}

addhook("second","hack")
function hack()
for p = 1,32 do
if (hacker[p]==1) then
credits[id]=credits[id]+15
	end
end
end

addhook("spawn","class")
function class(id)
parse("equip "..id.." 56") -- Equips Ct's with defuse kit.
hacker[id] = 1 -- The Hacker Special is on
	parse("strip "..id)

But i get error every second and when i press "Buy Credits"
Screenshots

edited 1×, last 28.11.10 05:40:08 pm

old Re: Lua Scripts/Questions/Help

_Ultimate_
User Off Offline

Quote
LoLz can some one repair that

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
Colors = { green = "000255000", red = "255000000", blue = "000000255", yellow = "255255000" }
VipTable = { Rank = {} }
btimer={}
for i=1,32 do
btimer[i]=0
end

addhook("say","AdminSay")
addhook("second", "startsec")

function NewVip(USGN,COLOR,RANK)
VipTable[USGN] = { C = COLOR, R = RANK}
local A = VipTable[USGN]
end
end

function GiveCookie(P,T)
if string.sub (T,1,5)=="@givecookie" then
local A = VipTable[player(P,"usgn")]
	if A then 
	     if player(tmpid, "exists") then
		     msg(Color(0, 0, 0), player(P, "name").." Gave a cookie to "..player(tmpid, "name")..".")
	         parse("gavecookie"..tmpid)
	        end	  
        end
    end		
end
end
end


NewVip(20104,"Red","Vip") 
NewVip(010101,"green","Vip")

old Re: Lua Scripts/Questions/Help

C0ast
User Off Offline

Quote
Help me?
It doesnt give me m4
thank you
addhook("say","team4say4")
function team4say4(p,t)
if yourteam[p]==4 and t=="!m4" then
parse("equip "..id.." 32")
end
end

old Re: Lua Scripts/Questions/Help

RyceR
User Off Offline

Quote
1
2
3
4
5
addhook("objectdamage","zm_hit")
function zm_hit(id)
sx=player(id,"money")
	parse("setmoney "..id.." "..(sx+25))
end
whats bad here?

old Re: Lua Scripts/Questions/Help

archmage
User Off Offline

Quote
@batlaizys
that would fail

1
parse("setmoney "..id.." "..player(id, "money") + 25);

Which is essentially the same as what he wrote.

@RyceR
The problem with your code is that you are using the hook incorrectly.
Its' parameters are
1
2
3
id -- building not player
amt -- amount of damage
player -- the players id

So you should re-write it like
1
2
3
function zm_hit(bld, dmg, id)
	...
end

old Re: Lua Scripts/Questions/Help

Kurumi
User Off Offline

Quote
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
92
93
94
95
96
97
98
99
100
101
102
if sample==nil then sample={} end
sample.classes={}

-----------------------
-- INITIAL SETUP     --
-----------------------
function initArray(m)
	local array = {}
	for i = 1, m do
		array[i]=0
	end
	return array
end
sample.classes.class=initArray(32)
function sample.classes.classmenu(id)
	menu(id,"Modern Warfare 2 Character,Shepherd|Deagle-Armor,Ghost|UMP45,Cpt.Price|MP5,Soap Mactavish|AUG,James Ramirez|M4A1+Fast,Captain MacMillan|Scout+TMPSD")	
end


-----------------------
-- TEAM -> CLASS     --
-----------------------
addhook("team","sample.classes.team")
function sample.classes.team(id,team)
	if (team>0) then
		sample.classes.classmenu(id)
	end
end


-----------------------
-- SERVERACTION      --
-----------------------
addhook("serveraction","sample.classes.serveraction")
function sample.classes.serveraction(id)
	sample.classes.classmenu(id)
end


-----------------------
-- CLASS SELECTION   --
-----------------------
addhook("menu","sample.classes.menu")
function sample.classes.menu(id,menu,sel)
	if (menu=="Select Your Modern Warfare 2 Character") then
		if (sel>=0 and sel<=6) then
			sample.classes.class[id]=sel
			if (player(id,"health")>0) then
				parse("killplayer "..id)
			end
		end
	end
end


-----------------------
-- SPAWN             --
-----------------------
addhook("spawn","sample.classes.spawn")
function sample.classes.spawn(id)
	-- Shepherd
	if (sample.classes.class[id]==1) then
		parse ("setmaxhealth "..id.." 200")
		parse ("setarmor "..id.." 0")
		parse ("speedmod "..id.." 5")
		return "3";
	end
	-- Ghost
	if (sample.classes.class[id]==2) then
		parse ("setmaxhealth "..id.." 125")
		parse ("setarmor "..id.." 150")
		parse ("speedmod "..id.." 7")
		return "24,5";
	end
	-- Cpt. Price
	if (sample.classes.class[id]==3) then
		parse ("setmaxhealth "..id.." 100")
		parse ("setarmor "..id.." 50")
                parse ("speedmod "..id.." -2")
		return "4,20";
	end
	-- Soap MacTavish
	if (sample.classes.class[id]==4) then
		parse ("setmaxhealth "..id.." 150")
		parse ("setarmor "..id.." 75")
		return "33,6";
	end
	-- James Ramirez
	if (sample.classes.class[id]==5) then
		parse ("setmaxhealth "..id.." 75")
		parse ("setarmor "..id.." 0")
		parse ("speedmod "..id.." 13")
		return "32,1";
	end
	-- Captain MacMillan
	if (sample.classes.class[id]==6) then
		parse ("setmaxhealth "..id.." 50")
		parse ("setarmor "..id.." 125")
                parse ("speedmod "..id.." 10")
		return "34,21";
	end
end
Help! I Allways Get 200hp And deagle, choosing other classes doesnt help [code]--Shepherd
     if (sample.classes.class[id]==1) then
          parse ("setmaxhealth "..id.." 200")
          parse ("setarmor "..id.." 0")
          parse ("speedmod "..id.." 5")
          return "3";

old Re: Lua Scripts/Questions/Help

Casper-
User Off Offline

Quote
Can somebody tell me how to make that bots destroy buildings ? I dont know lua much I only know some of 'em but this command confuses me a little
1
ai_goto(id,x,y,[walk])
i mean i know how to make them walk to that position but i dont know how to make them when they're at that position they rotate to south and start to attack

old Re: Lua Scripts/Questions/Help

archmage
User Off Offline

Quote
Well you could force the bot move near the building. Then set the rotation using math.atan or math.atan2 then use the command that signals the bot to attack.

Edit
if you do not know how to use atan just use ai_aim(id,x,y)

old Re: Lua Scripts/Questions/Help

RyceR
User Off Offline

Quote
I triyed to change the "objectdamage" to "objectkill" hook and it dont work... please help!
1
2
3
4
5
addhook("objectkill","zm_hit")
function zm_hit(p,id)
money=player(p,"money")
	parse("setmoney "..p.." "..(money+15))
end

old Re: Lua Scripts/Questions/Help

archmage
User Off Offline

Quote
RyceR has written
I triyed to change the "objectdamage" to "objectkill" hook and it dont work... please help!
1
2
3
4
5
addhook("objectkill","zm_hit")
function zm_hit(p,id)
money=player(p,"money")
	parse("setmoney "..p.." "..(money+15))
end

Change
1
function zm_hit(p,id)

to
1
function zm_hit(id,p)
To the start Previous 1 2318 319 320338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview