English Steal Money With Claw

6 replies
Goto Page
To the start Previous 1 Next To the start
28.01.11 04:01:16 pm
Up
WhoAMI
User
Offline Off
Hi all,I have a moneymod lua and,I want to add it steal money hit addhook.I hope you help me :).
28.01.11 04:04:35 pm
Up
DannyDeth
User
Offline Off
How is the money stored? In an array? In several variables? You need to be more precise if you want help!!
28.01.11 04:08:23 pm
Up
WhoAMI
User
Offline Off
Sorry,I can't tell.I write lua.


parse("mp_dispenser_money 200")
parse("sv_friendlyfire 1")



local dir = "sys/lua/city/acc/"
PLAYERS = {}
wings = 0
evil = 0
dragon = 0
motorcycle = 0
oval = 0
panzer = 0

function addmoney(id, amount)
if PLAYERS[id].money + amount >= 0 then
parse(string.format("setmoney %i 0", id))
PLAYERS[id].money = PLAYERS[id].money + amount
parse(string.format("hudtxt2 %i 49 \"©255100100Money : %i\" 520 390", id, PLAYERS[id].money))
return true
end
return false
end

function getmoney(id)
return PLAYERS[id].money
end

function getlicense(id)
return PLAYERS[id].license
end

function buylicense(id, buy)
if PLAYERS[id].license==1 then
return true
end
return false
end

addhook("join", "RPjoin")
function RPjoin(id)
local playerfile = io.open(dir..player(id,"usgn")..".txt","r")
if playerfile then
PLAYERS[id] = {}
for v in playerfile:lines() do
local find = v:find"="
key = v:sub(1,find-1)
key = tonumber(key) or key
val = v:sub(find+1)
val = tonumber(val) or val
PLAYERS[id][key] = val
end
playerfile:close()
else
PLAYERS[id] = {
money = 8000,
license = 0,
vip = 0,
wings = 0,
evil = 0,
dragon = 0,
motorcycle = 0,
oval = 0,
panzer = 0,
}

end






end

addhook("second", "RPsecond")
function RPsecond()
for _, id in ipairs(player(0, "table")) do
if buylicense(id, 1) then
parse(string.format("setmoney %i 5000", id))
else
parse(string.format("setmoney %i 0", id))
end
if PLAYERS[id] then
parse(string.format("hudtxt2 %i 49 \"©000255000Money : %i\" 520 390", id, PLAYERS[id].money))
end
end
end

addhook("minute","RPminute")
function RPminute()
for _, id in ipairs(player(0, 'table')) do

addmoney(id, 500)
end
msg('Payday! Everyone gets 500')

end

addhook("leave", "RPleave")
function RPleave(id)
if PLAYERS[id] and player(id,"usgn") ~= 0 then
local playerfile = io.open(dir .. player(id,"usgn") .. ".txt","w+") or io.tmpfile()
local text = ""
for i, v in pairs(PLAYERS[id]) do
text = text .. i .. "=" .. tostring(v) .. "\n"
end
text = text:sub(1,-2)
playerfile:write(text)
playerfile:close()
end
PLAYERS[id] = nil
end

addhook("collect", "RPcollect")
function RPcollect(id,iid,type,ain,a,mode)
if type == 66 then
addmoney(id, 100)
elseif type == 67 then
addmoney(id, 500)
elseif type == 68 then
addmoney(id, 1000)
end
end

addhook("menu", "RPmenu")
function RPmenu(id, title, button)
if title == "Drop Money" then
if button == 0 then
return
end
if button == 1 then
if addmoney(id, -100) then
parse(string.format("spawnitem 66 %i %i", player(id, "tilex"), player(id, "tiley")))
end
elseif button == 2 then
if addmoney(id, -500) then
local spawn = string.format("spawnitem 67 %i %i", player(id, "tilex"), player(id, "tiley"))
for i = 1, 1 do
parse(spawn)
end
end
elseif button == 3 then
if addmoney(id, -1000) then
parse(string.format("spawnitem 68 %i %i", player(id, "tilex"), player(id, "tiley")))
end
elseif button == 4 then
if addmoney(id, -5000) then
local spawn = string.format("spawnitem 68 %i %i", player(id, "tilex"), player(id, "tiley"))
for i = 1, 5 do
parse(spawn)
end
end
elseif button == 5 then
if buylicense(id, 1) then
msg2 (id,"©000255000You already have a license!@C")
else
if addmoney(id, -250000) then
PLAYERS[id].license=1
msg2 (id,"©000255000License purchase successful!@C")
else
msg2 (id,"©255000000You dont have enough money@C")
end
end

elseif button == 6 then
menu(id, "Add-ons,Wings = 20.000$,Dragon Wings = 30.000$,Evil Wings = 50.000$,Magic-Ring = 70.000$,Tank = 70.000$,Motorcycle = 100.000$") --WINGS MENU ITEMS

end
end

-- WINGS MENU

if title == "Add-ons" then
if button == 0 then
return
end

if button == 1 then
if PLAYERS[id].wings==1 then
if wings==1 then
imagealpha(id1,0)
wings=0
      parse("speedmod "..id.." 0")
else
if dragon==1 or evil==1 or oval==1 or panzer==1 or motorcycle==1 then
msg2 (id,"©255000000You must disable your enabled Add-on first!@C")
else
wings=1
      parse("setmaxhealth "..id.." 120")
      parse("speedmod "..id.." 5")
           parse("equip "..id.." "..2)

freeimage(id)
id1=image("gfx/MC/wings.bmp",1,1,200+id)
imagescale(id1,1,1)
imageblend(id1,0)
imagealpha(id1,1.0)
evil = 0
dragon = 0
motorcycle = 0
oval = 0
panzer = 0
end
end
else
if addmoney(id, -20000) then
PLAYERS[id].wings=1
msg2 (id,"©000255000Wings purchase successful!@C")
else
msg2 (id,"©255000000You dont have enough money@C")
end
end

elseif button == 2 then
if PLAYERS[id].dragon==1 then
if dragon==1 then
imagealpha(id2,0)
dragon=0
      parse("speedmod "..id.." 0")
else
if wings==1 or evil==1 or oval==1 or panzer==1 or motorcycle==1 then
msg2 (id,"©255000000You must disable your enabled Add-on first!@C")
else
dragon=1
      parse("speedmod "..id.." 7")
      parse("setmaxhealth "..id.." 130")
           parse("equip "..id.." "..33)
freeimage(id)
id2=image("gfx/MC/dragon.png",1,1,200+id)
imagescale(id2,1,1)
imageblend(id2,0)
imagealpha(id2,1.0)
wings = 0
evil = 0
motorcycle = 0
oval = 0
panzer = 0
end
end
else
if addmoney(id, -30000) then
PLAYERS[id].dragon=1
msg2 (id,"©000255000Dragon Wings purchase successful!@C")
else
msg2 (id,"©255000000You dont have enough money@C")
end
end

elseif button == 3 then
if PLAYERS[id].evil==1 then
if evil==1 then
imagealpha(id3,0)
evil=0
      parse("speedmod "..id.." 0")
else
if dragon==1 or wings==1 or oval==1 or panzer==1 or motorcycle==1 then
msg2 (id,"©255000000You must disable your enabled Add-on first!@C")
else
evil=1
      parse("speedmod "..id.." 12")
      parse("setmaxhealth "..id.." 150")
           parse("equip "..id.." "..46)
freeimage(id)
id3=image("gfx/MC/evil.png",1,1,200+id)
imagescale(id3,1,1)
imageblend(id3,0)
imagealpha(id3,1.0)
wings = 0
dragon = 0
motorcycle = 0
oval = 0
panzer = 0
end
end
else
if addmoney(id, -50000) then
PLAYERS[id].evil=1
msg2 (id,"©000255000Evil Wings purchase successful!@C")
else
msg2 (id,"©255000000You dont have enough money@C")
end
end

elseif button == 4 then
if PLAYERS[id].oval==1 then
if oval==1 then
imagealpha(id4,0)
oval=0
      parse("speedmod "..id.." 0")
else
if dragon==1 or evil==1 or wings==1 or panzer==1 or motorcycle==1 then
msg2 (id,"©255000000You must disable your enabled Add-on first!@C")
else
oval=1
      parse("setmaxhealth "..id.." 180")
      parse("setarmor "..id.." 150")
           parse("equip "..id.." "..45)
          
freeimage(id)
id4=image("gfx/MC/oval.png",1,1,100+id)
imagescale(id4,1,1)
imageblend(id4,0)
imagealpha(id4,1.0)
-- other shut off
wings = 0
evil = 0
dragon = 0
motorcycle = 0
panzer = 0
end
end
else
if addmoney(id, -70000) then
PLAYERS[id].oval=1
msg2 (id,"©000255000Magic-Ring purchase successful!@C")
else
msg2 (id,"©255000000You dont have enough money@C")
end
end

elseif button == 5 then
if PLAYERS[id].panzer==1 then
if panzer==1 then
imagealpha(id6,0)
panzer=0
      parse("speedmod "..id.." 0")
else
if dragon==1 or evil==1 or oval==1 or wings==1 or motorcycle==1 then
msg2 (id,"©255000000You must disable your enabled Add-on first!@C")
else
panzer=1
      parse("speedmod "..id.." -1")
      parse("setmaxhealth "..id.." 150")
      parse("setarmor "..id.." 200")
           parse("equip "..id.." "..47)
freeimage(id)
id6=image("gfx/MC/tank.bmp",1,1,200+id)
imagescale(id6,1,1)
imageblend(id6,0)
imagealpha(id6,1.0)
wings = 0
evil = 0
dragon = 0
oval = 0
motorcycle = 0
end
end
else
if addmoney(id, -70000) then
PLAYERS[id].panzer=1
msg2 (id,"©000255000Tank purchase successful!@C")
else
msg2 (id,"©255000000You dont have enough money@C")
end
end

elseif button == 6 then
if PLAYERS[id].motorcycle==1 then
if motorcycle==1 then
imagealpha(id5,0)
motorcycle=0
      parse("speedmod "..id.." 0")
else
if dragon==1 or evil==1 or oval==1 or wings==1 or wings==1 then
msg2 (id,"©255000000You must disable your enabled Add-on first!@C")
else
motorcycle=1
      parse("speedmod "..id.." 25")
      parse("setmaxhealth "..id.." 250")
      parse("setarmor "..id.." 200")
           parse("equip "..id.." "..78)
           parse("equip "..id.." "..33)
           parse("equip "..id.." "..88)
           parse("equip "..id.." "..85)
          
freeimage(id)
id5=image("gfx/MC/motorcycle.png",1,1,100+id)
imagescale(id5,1,1)
imageblend(id5,0)
imagealpha(id5,1.0)

wings = 0
evil = 0
dragon = 0
oval = 0
panzer = 0
end
end
else
if addmoney(id, -100000) then
PLAYERS[id].motorcycle=1
msg2 (id,"©000255000Motorcycle purchase successful!@C")
else
msg2 (id,"©255000000You dont have enough money@C")
end
end




end
end
--WINGS MENU END



end

function RPmenu2(id, title, button)

end



addhook("serveraction", "RPserveraction")
function RPserveraction(id,action)
if action == 1 then
menu(id, "Drop Money,100$,500$,1.000$,5.000$,BUY LICENSE: 250.000$,Add-ons")
end
end

addhook("movetile", "RPmovetile")
function RPmovetile(id,x,y)
if PLAYERS[id].x and PLAYERS[id].y and entity(x, y, "typename") ~= "Info_T" and entity(x, y, "typename") ~= "Info_CT" then
PLAYERS[id].x, PLAYERS[id].y = x, y
end
end

addhook("spawn", "RPspawn")
function RPspawn(id)
if PLAYERS[id].x and PLAYERS[id].y then
parse(string.format("setpos %i %i %i", id, PLAYERS[id].x*32+16, PLAYERS[id].y*32+16))
end
return ""
end

addhook("die", "RPdie")
function RPdie(victim,killer,weapon,x,y)
PLAYERS[victim].x, PLAYERS[victim].y = nil, nil
end




-- ------------------------------------------------------------------- TELEPORT!!---------------------------------------------------------------



function array(s,v)
local a = {}
for i = 1, s do
a[i] = v
end
return a
end

xp = array(32)
yp = array(32)
tor = array(32)

addhook ("join","rt")
function rt(p)
xp[p] = 0
yp[p] = 0
tor[p] = 0
end


addhook ("say","bu")
function bu(id,txt)
if (txt=="!teleport") then
if player(id,"health")>0 then
if buylicense(id, 1) then
menu (id,"Teleport menu,Save Position,Teleport to Position,Teleport on Respawn")
else
msg2 (id,"©255000000You need a license for the teleport menü!@C")
end
end
end
end

addhook ("menu","bu2")
function bu2(p,t,s)
if t=="Teleport menu" then
if s==1 then
xp[p]=player(p,"x")
yp[p]=player(p,"y")
msg2 (p,"©000255000Teleport position saved!@C")


elseif s==2 and xp[p]>0 and yp[p]>0 then
msg2 (p,"©000255000You have been teleported!@C")
parse ("setpos "..p.." "..xp[p].." "..yp[p])

elseif s==2 and xp[p]==0 and yp[p]==0 then
msg2 (p,"©255000000There is no spawnpoint saved!@C")

elseif s==3 and tor[p]==0 then
tor[p] = 1
msg2 (p,"©000255000You will now teleport on Spawn@C")

elseif s==3 and tor[p]==1 then
tor[p] = 0
msg2 (p,"You will now spawn on spawnpoint@C")
end
end
end

addhook ("spawn","bu3")
function bu3(p)
if xp[p]>0 and yp[p]>0 and tor[p]==1 then
parse ("setpos "..p.." "..xp[p].." "..yp[p])
msg2 (p,"©000255000You have been spawned at your spawnpoint!@C")
end
end
28.01.11 04:13:30 pm
Up
Refresh
User
Offline Off
It looks like a very bad copy of CC's RP script.
28.01.11 04:24:13 pm
Up
DannyDeth
User
Offline Off
Use this is you want the guy who hits to get money:
Code:
1
2
3
4
5
6
7
addhook("hit","add_claw_money")
function add_claw_money(source,weapon)
     if weapon==78 then
          local P = PLAYER[source]
          P.money = P.money + 30 -- Replace 30 with how much money you want player to get!!!
     end
end


Or this if you want the guy who was hit to get the money:
Code:
1
2
3
4
5
6
7
addhook("hit","add_claw_money")
function add_claw_money(id,weapon)
     if weapon==78 then
          local P = PLAYER[id]
          P.money = P.money + 30 -- Replace 30 with how much money you want player to get!!!
     end
end
28.01.11 04:28:15 pm
Up
WhoAMI
User
Offline Off
DannyDeth has written:
Use this is you want the guy who hits to get money:
Code:
1
2
3
4
5
6
7
addhook("hit","add_claw_money")
function add_claw_money(source,weapon)
     if weapon==78 then
          local P = PLAYER[source]
          P.money = P.money + 30 -- Replace 30 with how much money you want player to get!!!
     end
end


Or this if you want the guy who was hit to get the money:
Code:
1
2
3
4
5
6
7
addhook("hit","add_claw_money")
function add_claw_money(id,weapon)
     if weapon==78 then
          local P = PLAYER[id]
          P.money = P.money + 30 -- Replace 30 with how much money you want player to get!!!
     end
end



Thanks for help me problem solved
28.01.11 04:34:30 pm
Up
DannyDeth
User
Offline Off
It's a pleasure to help you
To the start Previous 1 Next To the start