Forum

> > CS2D > Scripts > Steal Money
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Steal Money

2 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Steal Money

StrikerD2000
BANNED Off Offline

Zitieren
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

alt Re: Steal Money

Baloon
GAME BANNED Off Offline

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

alt Re: Steal Money

Yates
Reviewer Off Offline

Zitieren
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])
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht