Hello people, i'm new to lua and scripting
I'm trying to write a rob script.
I want , when a player targets a ped , a timer starts and after timer ends player receive a random amount of money.
This is what i wrote.
local shops = {
{name="Clucking Bell", px=368.11337, py=-4.49257, pz=1001.85156, mx=368.12790, my=-6.02016, mz=1001.85156, dim=5, int=9, skin=167, rot=180},
}
function ped ()
for index, shop in pairs(shops) do
local ped = createPed(shop.skin, shop.px, shop.py, shop.pz)
setElementInterior(ped, shop.int)
setElementDimension(ped, shop.dim)
setPedRotation(ped, shop.rot)
setElementFrozen(ped, true)
setElementData(ped,"shopPed",true)
end
end
addEventHandler ( "onResourceStart", root , ped )
function onPlayerTarget ( targetElem )
if ped then
setPedAnimation ( targetElem, "ped", "handsup",-1, false, false, false, true)
triggerEvent("robtimer",root,player)
end
end
addEventHandler ( "onPlayerTarget", getRootElement(), onPlayerTarget )
function givemoney (player)
local ran = math.random(1000, 2000)
givePlayerMoney(player, ran)
end
addEvent("robtimer",true)
addEventHandler("robtimer",root,givemoney)
after pointing gun at the ped this is what i get in console:
[2017-07-01 11:13:07] WARNING: Rob\s_rob.lua:22: Bad argument @ 'setPedAnimation' [Expected element at argument 1, got boolean] --(but the Ped Animation changes!)
[2017-07-01 11:13:13] WARNING: Rob\s_rob.lua:32: Bad argument @ 'givePlayerMoney' [Expected element at argument 1, got boolean]
i really would appreciate the help