Forum

> > CS2D > Scripts > Steal Money
Forums overviewCS2D overview Scripts overviewLog in to reply

English Steal Money

2 replies
To the start Previous 1 Next To the start

old Steal Money

StrikerD2000
BANNED Off Offline

Quote
dudes i don't need script i just need fix

!steal <id> <amount>

1
2
3
4
5
6
7
8
addhook("say", "say")
function say(id,t)
     if t:sub(1,6)=="!steal" then
		  	parse("setmoney "..t:sub(8,9).." "..player(id,"money")-"..t:sub(11,12)..")
		  	parse("setmoney "..id.." "..player(id,"money")+"..t:sub(11,12)..")
			return 1
			end
			end
this is like when you say !steal <id> <amount>
you will steal some money from a player and then that player will get -<amount> and you will get +<amount>

hope u understand cuz my english hate me

old Re: Steal Money

Baloon
GAME BANNED Off Offline

Quote
Consider to use totable function instead of t:sub function, because Lua cannot calculate ID number length and money amount length.

old Re: Steal Money

Yates
Reviewer Off Offline

Quote
1
2
3
4
5
6
7
8
function toTable(str, mch)
    local tmp = {}
    if not mch then mch = "[^%s]+" else mch = "[^"..mch.."]+" end
    for wrd in string.gmatch(str, mch) do
        table.insert(tmp, wrd)
    end
    return tmp
end

Carry on my wayward son, for there will be peace when you are done.

To test and understand its use:
1
2
3
tbl = toTable(t)
print(tbl[1])
print(tbl[2])
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview