and how i can remove some money from player?
Forum
CS2D Scripts Lua Scripts/Questions/Helpand how i can remove some money from player?
1
2
3
4
2
3
4
money=player(ID,"money") --get the money money=money-100 --decrease it by 100 if money<0 then money=0 end --you probably don't need that line parse("setmoney "..ID.." "..money) --set the new money value
will subtract 100$ for example. ID has to be replaced with the player id of course.
DC has written
This code can of course be made much shorter:with setmoney
will subtract 100$ for example. ID has to be replaced with the player id of course.
1
2
3
4
2
3
4
money=player(ID,"money") --get the money money=money-100 --decrease it by 100 if money<0 then money=0 end --you probably don't need that line parse("setmoney "..ID.." "..money) --set the new money value
will subtract 100$ for example. ID has to be replaced with the player id of course.
1
parse("setmoney "..ID.." "..player(id, "money")-100)
TheKilledDeath has written
DC has written
This code can of course be made much shorter:with setmoney
will subtract 100$ for example. ID has to be replaced with the player id of course.
1
2
3
4
2
3
4
money=player(ID,"money") --get the money money=money-100 --decrease it by 100 if money<0 then money=0 end --you probably don't need that line parse("setmoney "..ID.." "..money) --set the new money value
will subtract 100$ for example. ID has to be replaced with the player id of course.
1
parse("setmoney "..ID.." "..player(id, "money")-100)
big thx)
1
2
3
4
5
6
2
3
4
5
6
addhook("type","example_type") function example_type(id,type) 	if(type=="L") then 		parse("strip "..id.." 32") 	end end
playa slaya has written
is there a hook for typing keys for example:
also is my spacing correct for script?
1
2
3
4
5
6
2
3
4
5
6
addhook("type","example_type") function example_type(id,type) 	if(type=="L") then 		parse("strip "..id.." 32") 	end end
Yep your tabbing is right, however, CS2D doesn't have such a hook, you can use the "use" key, serveractions and reload instead
- = subtraction
+ = adding
* = multiply
/ = division
> = below a number
< = above a number
is that right?
http://www.lua.org/pil/3.1.html
1
hudtext(id,1,"forgot what i put")
also is it possible to increase stuff like this:
1
example = 98
playa slaya has written
No. the 3 serveraction keys should be enough. It's good that DC made this because people would get very surprised if their config suddenly does something else than what they told it to do well that sucks maybe DC will make that.
Quote
1
2
3
4
5
2
3
4
5
Code: variable = {0,0} function readValues() ...
I think it's a bit better this way:
1
2
3
4
2
3
4
variable = {0,0} function readValues() ...
thanks lilcoder and flacko
I download "Checpoint!" script...
I need help to only save in XXX position!
Here is the script: http://unrealsoftware.de/files_show.php?file=1944
Why should you only save the position in x?
Can someone script a unban script so you can unban a certain person?
like @unbanusgn 35385
@unbanip 1.1.1.1
@unbanname pwned
wups has written
@Fehuziom
Why should you only save the position in x?
Why should you only save the position in x?
XXX = Y and X
"XXX" an example!
1
2
3
4
5
6
2
3
4
5
6
addhook("join","my_join") function my_join() 	for i=1,32 do 		parse('hudtxt2 '..i..' 1 "©255000000example"225 455') 	end end
playa slaya has written
i cant have hud i tried:
1
2
3
4
5
6
2
3
4
5
6
addhook("join","my_join") function my_join() 	for i=1,32 do 		parse('hudtxt2 '..i..' 1 "©255000000example"225 455') 	end end
you forget this?
1
if player(i,"exists") then
I don't know if it not working
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
color = {red = "©255000000", green = "©000255000", blue = "©000000255"} function hudtxt2(id,slot,clr,txt,x,y,a) 	parse('hudtxt2 '..id..' '..slot..' "'..color[clr]..''..txt..'" '..x..' '..y..' '..a..'') end addhook("join","my_join") function my_join(id) 	--for p in ipairs(player(0,"table")) do 	hudtxt2(id, 1, "red", "Welcome to my server!", 225, 455, 0) 	--end end
Your code will print a message to everybody's screen whenever a player has joined.
which is possible too with your for loop, if that's what you want You should then remove the --.