Forum

> > CS2D > Scripts > making a map script
Forums overviewCS2D overview Scripts overviewLog in to reply

English making a map script

8 replies
To the start Previous 1 Next To the start

moved making a map script

ExEc ExE
User Off Offline

Quote
Hello
Im making new map and need some help about script
I dont know how to set spawn hp 250
And how to make a trigger shop?
plzzz help
I got this so far with my frend

parse("mp_wpndmg wrench 0")
parse("mp_wpndmg knife 0")

addhook("say","say_drop")
function say_drop(id,txt)
     if (txt=="!drop 100") or (txt=="!drop 100") then
          if (player(id,"money")>99) then
          parse("spawnitem 66 "..player(id,"tilex").." "..player(id,"tiley").."")
          parse("setmoney "..id.." "..player(id,"money")-100)
          end
     end
     if (txt=="!drop 500") or (txt=="!drop 500") then
          if (player(id,"money")>499) then
          parse("spawnitem 67 "..player(id,"tilex").." "..player(id,"tiley").."")
          parse("setmoney "..id.." "..player(id,"money")-500)
          end
     end
     if (txt=="!drop 1000") or (txt=="!drop 1000") then
          if (player(id,"money")>999) then
          parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
          parse("setmoney "..id.." "..player(id,"money")-1000)
          end
     end
     if (txt=="!drop 2000") or (txt=="!drop 2000") then
          if (player(id,"money")>1999) then
          parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
          parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
          parse("setmoney "..id.." "..player(id,"money")-2000)
          end
end
     if (txt=="!drop 5000") or (txt=="!drop 5000") then
          if (player(id,"money")>4999) then
          parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
          parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
          parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
          parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
          parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
          parse("setmoney "..id.." "..player(id,"money")-5000)
          end
end
     if (txt=="!drop 10000") or (txt=="!drop 10000") then
          if (player(id,"money")>9999) then
          parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
          parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
          parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
          parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
          parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
          parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
          parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
          parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
          parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
          parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
          parse("setmoney "..id.." "..player(id,"money")-10000)
          end
end
     if (txt=="!drop 16000") or (txt=="!drop 16000") then
          if (player(id,"money")>15999) then
          parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
          parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
          parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
          parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
          parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
          parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("setmoney "..id.." "..player(id,"money")-16000)
          end
end
end

addhook("join","bank_join")
addhook("menu","bank_menu")
addhook("serveraction","bank_serveraction")

function array(m)
local array = {}
for i = 1, m do
array[i] = 0
end
return array
end

bank_money_player = array(32)
bank_table = {100,200,500,1000,2000,5000,10000,16000}

function bank_join(p)
bank_money_player[p] = 0
end

function bank_serveraction(p)
menu(p,"Bank Menu (Your Cash: "..bank_money_player[p].."),Add Cash To Bank,Take Cash From Bank")
end

function bank_cash_add(p)
menu(p,"Add Cash To Bank? (Bank: "..bank_money_player[p].."),$100,$200,$500,$1000,$2000,$5000,$10000,$16000")
end

function bank_cash_take(p)
menu(p,"Take Cash From Bank? (Bank: "..bank_money_player[p].."),$100,$200,$500,$1000,$2000,$5000,$10000,$16000")
end

function bank_menu(p,t,s)
if ("Bank Menu" == string.sub(t, 1, 9)) then
if (s == 1) then
bank_cash_add(p)
elseif (s == 2) then
bank_cash_take(p)
end
end

if ("Add" == string.sub(t, 1, 3)) then
if (bank_table[s] < player(p,"money")) then
bank_money_player[p] = bank_money_player[p] + bank_table[s]
parse('setmoney '..p..' '..player(p,"money") - bank_table[s])
msg2(p,'©000255000You Added '..bank_table[s]..'$ To Bank!@C')
bank_cash_add(p)
else
msg2(p,'©255000000You Added '..player(p,"money")..'$ To Bank!@C')
msg2(p,'©255000000You Dont Have More Money To Add!@C')
bank_money_player[p] = bank_money_player[p] + player(p,"money")
parse('setmoney '..p..' 0')
end
end

if ("Take" == string.sub(t, 1, 4)) then
if (bank_money_player[p] > 0) then
if (player(p,"money") + bank_table[s] < 16001) then
bank_money_player[p] = bank_money_player[p] - bank_table[s]
parse('setmoney '..p..' '..player(p,"money") + bank_table[s])
msg2(p,'©000255000You Took '..bank_table[s]..'$ From Bank!@C')
bank_cash_take(p)
else
msg2(p,'©255000000You Cant Have More Than 16000$ In Hand!@C')
end
else
msg2(p,'©255000000Your Bank Is Empty!@C')
end
end
end

addhook("usebutton","COLA1")

function COLA1(id,x,y)
if x==12 and y==36 then
if player(id, "money")>=49 then
parse("setmoney "..id.." "..player(id, "money")-50)
parse("equip "..id.." 65")
msg2(id, "You buyed a cola!")
else
msg2(id, "Sorry but you do not have enough money. (50$ cost)")
end
end
end

addhook("usebutton","COLA2")

function COLA2(id,x,y)
if x==24 and y==29
if player(id, "money")>=49 then
parse("setmoney "..id.." "..player(id, "money")-50)
parse("equip "..id.." 65")
msg2(id, "You buyed a cola!")
else
msg2(id, "Sorry but you do not have enough money. (50$ cost)")
end
end
end
addhook("usebutton","COLA3")

function COLA3(id,x,y)
if x==39 and y==30 then
if player(id, "money")>=49 then
parse("setmoney "..id.." "..player(id, "money")-50)
parse("equip "..id.." 65")
msg2(id, "You buyed a cola!")
else
msg2(id, "Sorry but you do not have enough money. (50$ cost)")
end
end
end

addhook("usebutton","COLA4")

function COLA4(id,x,y)
if x==56 and y==36 then
if player(id, "money")>=49 then
parse("setmoney "..id.." "..player(id, "money")-50)
parse("equip "..id.." 65")
msg2(id, "You buyed a cola!")
else
msg2(id, "Sorry but you do not have enough money. (50$ cost)")
end
end
end

addhook("usebutton","COLA5")

function COLA5(id,x,y)
if x==66 and y==70 then
if player(id, "money")>=49 then
parse("setmoney "..id.." "..player(id, "money")-50)
parse("equip "..id.." 65")
msg2(id, "You buyed a cola!")
else
msg2(id, "Sorry but you do not have enough money. (50$ cost)")
end
end
end

Admin/mod comment

this is about scripting -> scripts section!

old Re: making a map script

asdbanana
User Off Offline

Quote
Well , if you did it in Wrong section , then moderator can MOVE it!There is no reason to make new topic for it that is the same ...

old Re: making a map script

Kel9290
User Off Offline

Quote
user ExEc ExE has written
I dont know how to set spawn hp 250

1
2
3
4
addhook("spawn","espawn")
function espawn(i)
	parse("setmaxhealth "..i.." 250")
end

old Re: making a map script

KagamineLen
User Off Offline

Quote
that dropmoney is too large you can try 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
addhook("say","say_drop")
function say_drop(id,txt)
if string.find(txt,"!drop") then
local drop1 = txt:sub(1,5)
if drop1 == "!drop" then
local drop2 = txt:sub(7,11)

if drop2 == "100" then
parse("spawnitem 66 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("setmoney "..id.." "..player(id,"money")-"..!drop2)
end

if drop2 == "500" then
parse("spawnitem 67 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("setmoney "..id.." "..player(id,"money")-"..!drop2)
end

if drop2 == "1000" then
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("setmoney "..id.." "..player(id,"money")-"..!drop2)
end

if drop2 == "2000" then
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("setmoney "..id.." "..player(id,"money")-"..!drop2)
end

if drop2 == "5000" then
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("setmoney "..id.." "..player(id,"money")-"..!drop2)
end

if drop2 == "10000" then
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("setmoney "..id.." "..player(id,"money")-"..!drop2)
end

if drop2 == "16000" then
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
parse("setmoney "..id.." "..player(id,"money")-"..!drop2)
end

end
return 1
end

old Re: making a map script

MikuAuahDark
User Off Offline

Quote
@ExEc ExE to use trigger shop just use use hook. here you new script. compressed line, from 216 line to 144:
More >
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview