Wysłany: 2018-11-16, 21:41
kuba43
Wiek: 45 Na forum: 3225 dni Posty: 166
Nick w MP: definitly
Piwa : 17
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)
Kod: 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():gsub("#%x%x%x%x%x%x",""), cash, reason))
targetElement:outputChat(('* Otrzymano mandat od %s, na kwot? %d PLN. Pow?d: %s'):format(plr:getName():gsub("#%x%x%x%x%x%x",""), cash, reason))
takePlayerMoney(targetElement, cash)
givePlayerMoney(plr, cash/4)
plr:outputChat(('* Dosta?e?(a?) kwot? %d PLN za wystawiony mandat dla %s'):format(cash/4, targetElement:getName():gsub("#%x%x%x%x%x%x","")))
--triggerClientEvent(root, "admin:addText", root, "MANDAT> "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").." wystawil mandat "..getPlayerName(targetElement):gsub("#%x%x%x%x%x%x","").." w kwocie "..cash:gsub("#%x%x%x%x%x%x","")..", powod: "..reason:gsub("#%x%x%x%x%x%x","")..".")
local desc = "[MANDAT] "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").." wystawi?(a) mandat "..getPlayerName(targetElement):gsub("#%x%x%x%x%x%x","").." w kwocie "..cash..", powod: "..reason.."."
triggerEvent("admin:addText", resourceRoot, desc:gsub("#%x%x%x%x%x%x",""))
outputServerLog(desc)
else
plr:outputChat(('* %s nie posiada pieni?dzy, na op?at? mandatu.'):format(targetElement:getName()))
end
else
plr:outputChat('* Jeste? za daleko gracza, ?eby m?c wystawi? mandat.')
end
end
end
end
end
addCommandHandler('mandat', mandat)
Wysłany: 2018-11-16, 22:07
_Haze
Peace Yo!
Wiek: 24 Na forum: 4184 dni Posty: 1648
Nick w MP: Haze
Piwa : 2628
1. Daj znaczniki lua, ?eby lepiej by?o widoczne.
2. Masz opp na true w mecie?
3. Dlaczego niekt?re funkcje s? obiektywne a inne nie?
4. Radze ci tabowa?, ?eby p?zniej si? w nich odnajdywa?.
Więcej szczegółów
Wystawiono 1 piw(a):kuba43
Wysłany: 2018-11-16, 23:44
kuba43
Wiek: 45 Na forum: 3225 dni Posty: 166
Nick w MP: definitly
Piwa : 17
A no tak, nie ma oop w mecie, skrypt dzia?a, a teraz zasadnicze pytanie co to funkcja obiektywna??
Podpis
„(…) wystarczy, że odpowiesz sobie na jedno zajebiście, ale to zajebiście, ważne pytanie: co lubię w życiu robić. A potem zacznij to robić.”.
Wysłany: 2018-11-16, 23:48
Avenged
Młodszy Szkrypter
Wiek: 23 Na forum: 3510 dni Posty: 654
Nick w MP: Avenged
Piwa : 1570
Podpis
LUA, JS, PHP
Zapraszam do skorzystania z moich usług: Klik
Więcej szczegółów
Wystawiono 1 piw(a):kuba43
Tagi: nie :: moge :: wystawic :: mandatu :: db3
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: