English Steal Money

2 replies
Goto Page
To the start Previous 1 Next To the start
17.02.17 08:43:17 am
Up
StrikerD2000
BANNED
Offline Off
dudes i don't need script i just need fix

!steal <id> <amount>

Code:
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
@user StrikerD2000 | I love DC
17.02.17 09:42:20 am
Up
Prototype x20
GAME BANNED
Offline Off
Consider to use totable function instead of t:sub function, because Lua cannot calculate ID number length and money amount length.
17.02.17 10:19:46 am
Up
Yates
Reviewer
Offline Off
Code:
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:
Code:
1
2
3
tbl = toTable(t)
print(tbl[1])
print(tbl[2])
To the start Previous 1 Next To the start