Witam,
mam problem mianowicie
skopiowa?em kod skryptu z sapd na pysie bo robie inna frakcje na tym gm
i gdy pr?buje wystawic mandat mam taki b??d
s:36 attempt to index local 'plr' (a userdata value)
[code]function mandat(plr, cmd, target, cash, ...)
if getElementData(plr,"player:faction") and getElementData(plr,"player:faction") == "SAPD" then
if not (target) or not (cash) or not (...) then
plr:outputChat('* U?yj: /mandat <nick/ID> <kwota> <pow?d>')
else
if getElementData(plr,"player:rank") < 2 then outputChatBox("* Nie posiadasz uprawnie? !",plr) return end
cash=tonumber(cash)
if cash <= 0 then
plr:outputChat('* Warto?? kwoty mandatu nie mo?e by? ujemna.')
return
elseif cash > 35000 then
plr:outputChat('* Kwota mandatu jest zbyt du?a (max. 35.000 PLN).')
return
end
local targetElement=exports['pystories-core']:findPlayer(plr, target)
if targetElement then
local x, y, z = getElementPosition(plr)
local tx, ty, tz = getElementPosition(targetElement)
local distance = getDistanceBetweenPoints3D(x, y, z, tx, ty, tz)
if (distance<=10) then
local reason=table.concat({...}, ' ')
local money=getPlayerMoney(targetElement)
local takeFromCash = money-cash
if money >= cash then
plr:outputChat(('* Wystawiono mandat dla %s, na kwot? %d PLN. Pow?d: %s'):format(targetElement:getName():g... |