Szczerze to tak, zapewne lepiej by?oby zablokowa? wej?cie 2 graczy na to samo konto, ale to ju?, za wysokie progi dla mnie Ja sam jeszcze si? ucz?, wi?c p?ki co postaram si? pom?c w miar? moich mo?liwo?ci.
Jak masz
function zaplacPieniadze(plr, cmd, cel, value)
local target = znajdzGracza(plr, cel)
if target == plr then return
outputChatBox('Nie mo?esz wysy?a? pieni?dzy samemu sobie', plr)
end
To zamie? to na
function zaplacPieniadze(plr, cmd, target, value)
if target == plr then return
outputChatBox('Nie mo?esz wysy?a? pieni?dzy samemu sobie', plr)
end
Dalej nie dzia?a,
DB3:
ogrpg-core/cmd.lua:57: attempt to concatenate a boolean value
Kod:
--[[
Resource: OURGame v2
Developers: Split <split.programista@gmail.com>
You have no right to use this code without my permission.
(c) 2015 <split.programista@gmail.com>. All rights reserved.
]]
function onPrivateMessage(plr, cmd, target, ...)
if not target or not {...} then
outputChatBox('* U?yj /pm <nick/ID> <tre??>', plr)
return
end
local text=table.concat({...}, ' ')
local target=findPlayer(plr, target)
if not target then
outputChatBox('* Nie znaleziono podanego gracza.', plr, 255, 0, 0)
return
end
outputChatBox("#FFFFFF>> #BABABA"..getPlayerName(target).."["..getElementData(target,"id").."]: #ffffff"..text.."", plr, _, _, _, true)
outputChatBox("#FFFFFF<< #BABABA"..getPlayerName(plr).."["..getElementData(plr,"id").."]: #ffffff"..text.."", target, _, _, _, true)
local pm_text=('PM> %s(%d) >> %s(%d): %s'):format(getPlayerName(plr), getElementData(plr,"id"), getPlayerName(target), getElementData(target,"id"), text)
triggerClientEvent(root, "admin:addText", root, pm_text)
end
addCommandHandler('pw', onPrivateMessage)
addCommandHandler('pm', onPrivateMessage)
function zaplacPieniadze(plr, cmd, target, value)
if target == plr then return
outputChatBox('Nie mo?esz wysy?a? pieni?dzy samemu sobie', plr)
end
if not(value or cel) then
outputChatBox("#FF007E* U?yj: /przelej <nick/ID> <kwota>", plr,255,0,0,true)
return
end
if not(target) then
outputChatBox("#FF007E* Nie znaleziono gracza o podanym ID/nicku!", plr,255,0,0,true)
return
end
if tonumber(value) < 0 then return end
if (not tonumber(value)) then return end
if getPlayerMoney(plr) < tonumber(value) then
outputChatBox("#FF007E* Nie posiadasz wystarczaj?cej ilo?ci pieni?dzy!", plr, 255, 0, 0,true)
return
end
takePlayerMoney(plr, tonumber(value))
givePlayerMoney(target, tonumber(value))
outputChatBox("#FF007E* Gracz #DDDDDD"..getPlayerName(plr).." #FF007Eprzekazuje Ci #DDDDDD"..tonumber(value).." #FF007EZ?.", target,255,0,0,true)
outputChatBox("* #FF007EPrzekazujesz #DDDDDD"..tonumber(value).." #FF007EZ? graczowi #DDDDDD"..getPlayerName(target).."", plr ,255,0,0,true)
end
addCommandHandler("przelej", zaplacPieniadze)
addCommandHandler("zaplac", zaplacPieniadze)
addCommandHandler("dajkase", zaplacPieniadze)
setTimer(function()
local vehicles=getElementsByType('vehicle')
for _, vehicle in pairs(vehicles) do
if getElementHealth(vehicle)<300 then
setVehicleDamageProof(vehicle, true)
elseif getElementHealth(vehicle)>301 then
setVehicleDamageProof(vehicle, false)
end
end
end, 500, 0)
Oczywi?cie to b?dzie dzia?a?o, je?eli dw?ch graczy b?dzie na jednym koncie i chcieli by bugowa? to nie b?d? mogli sobie przesy?a? tak?
Ok, zr?bmy inaczej, wr??my do pierwszej mojej wersji
function zaplacPieniadze(plr, cmd, cel, value)
if getPlayerName(cel) == getPlayerName(plr) then return
outputChatBox('Nie mo?esz wysy?a? pieni?dzy samemu sobie', plr)
end
if not(value or cel) then
outputChatBox("#FF007E* U?yj: /przelej <nick/ID> <kwota>", plr,255,0,0,true)
return
end
if not(cel) then
outputChatBox("#FF007E* Nie znaleziono gracza o podanym ID/nicku!", plr,255,0,0,true)
return
end
if tonumber(value) < 0 then return end
if (not tonumber(value)) then return end
if getPlayerMoney(plr) < tonumber(value) then
outputChatBox("#FF007E* Nie posiadasz wystarczaj?cej ilo?ci pieni?dzy!", plr, 255, 0, 0,true)
return
end
takePlayerMoney(plr, tonumber(value))
givePlayerMoney(cel, tonumber(value))
outputChatBox("#FF007E* Gracz #DDDDDD"..getPlayerName(plr).." #FF007Eprzekazuje Ci #DDDDDD"..tonumber(value).." #FF007EZ?.", cel,255,0,0,true)
outputChatBox("* #FF007EPrzekazujesz #DDDDDD"..tonumber(value).." #FF007EZ? graczowi #DDDDDD"..getPlayerName(cel).."", plr ,255,0,0,true)
end
addCommandHandler("przelej", zaplacPieniadze)
addCommandHandler("zaplac", zaplacPieniadze)
addCommandHandler("dajkase", zaplacPieniadze)
Poszukaj czy w innych plikach tego zasobu jest zadeklarowana/opisana zmienna znajdzGracza.
BTW. kod kt?ry poda? Ci kolega przede mn? (elementdatanauid) by?by najlepszym wyj?ciem, a nie dzia?a? Ci, bo trzebaby by?o do niego zrobi? dodatkowy kod, kt?ry przy wej?ciu nadaje graczowi ID
function zaplacPieniadze(plr, cmd, komu, value
local cel = getPlayerFromName(komu)
if plr == cel then
outputChatBox('Nie mo?esz wysy?a? pieni?dzy samemu sobie', plr)
return
end
if (not value) or (not cel) then
outputChatBox("#FF007E* U?yj: /przelej <nick/ID> <kwota>", plr,255,0,0,true)
return
end
if (not cel) then
outputChatBox("#FF007E* Nie znaleziono gracza o podanym ID/nicku!", plr,255,0,0,true)
return
end
if tonumber(value) < 0 then return end
if (not tonumber(value)) then return end
if getPlayerMoney(plr) < tonumber(value) then
outputChatBox("#FF007E* Nie posiadasz wystarczaj?cej ilo?ci pieni?dzy!", plr, 255, 0, 0,true)
return
end
takePlayerMoney(plr, tonumber(value))
givePlayerMoney(cel, tonumber(value))
outputChatBox("#FF007E* Gracz #DDDDDD"..getPlayerName(plr).." #FF007Eprzekazuje Ci #DDDDDD"..tonumber(value).." #FF007EZ?.", cel,255,0,0,true)
outputChatBox("* #FF007EPrzekazujesz #DDDDDD"..tonumber(value).." #FF007EZ? graczowi #DDDDDD"..getPlayerName(cel).."", plr ,255,0,0,true)
end
addCommandHandler("przelej", zaplacPieniadze)
addCommandHandler("zaplac", zaplacPieniadze)
addCommandHandler("dajkase", zaplacPieniadze)
--[[
Resource: OURGame v2
Developers: Split <split.programista@gmail.com>
You have no right to use this code without my permission.
(c) 2015 <split.programista@gmail.com>. All rights reserved.
]]
function onPrivateMessage(plr, cmd, target, ...)
if not target or not {...} then
outputChatBox('* U?yj /pm <nick/ID> <tre??>', plr)
return
end
local text=table.concat({...}, ' ')
local target=findPlayer(plr, target)
if not target then
outputChatBox('* Nie znaleziono podanego gracza.', plr, 255, 0, 0)
return
end
outputChatBox("#FFFFFF>> #BABABA"..getPlayerName(target).."["..getElementData(target,"id").."]: #ffffff"..text.."", plr, _, _, _, true)
outputChatBox("#FFFFFF<< #BABABA"..getPlayerName(plr).."["..getElementData(plr,"id").."]: #ffffff"..text.."", target, _, _, _, true)
local pm_text=('PM> %s(%d) >> %s(%d): %s'):format(getPlayerName(plr), getElementData(plr,"id"), getPlayerName(target), getElementData(target,"id"), text)
triggerClientEvent(root, "admin:addText", root, pm_text)
end
addCommandHandler('pw', onPrivateMessage)
addCommandHandler('pm', onPrivateMessage)
function zaplacPieniadze(plr, cmd, komu, value
local cel = getPlayerFromName(komu)
if plr == cel then
outputChatBox('Nie mo?esz wysy?a? pieni?dzy samemu sobie', plr)
return
end
if (not value) or (not cel) then
outputChatBox("#FF007E* U?yj: /przelej <nick/ID> <kwota>", plr,255,0,0,true)
return
end
if (not cel) then
outputChatBox("#FF007E* Nie znaleziono gracza o podanym ID/nicku!", plr,255,0,0,true)
return
end
if tonumber(value) < 0 then return end
if (not tonumber(value)) then return end
if getPlayerMoney(plr) < tonumber(value) then
outputChatBox("#FF007E* Nie posiadasz wystarczaj?cej ilo?ci pieni?dzy!", plr, 255, 0, 0,true)
return
end
takePlayerMoney(plr, tonumber(value))
givePlayerMoney(cel, tonumber(value))
outputChatBox("#FF007E* Gracz #DDDDDD"..getPlayerName(plr).." #FF007Eprzekazuje Ci #DDDDDD"..tonumber(value).." #FF007EZ?.", cel,255,0,0,true)
outputChatBox("* #FF007EPrzekazujesz #DDDDDD"..tonumber(value).." #FF007EZ? graczowi #DDDDDD"..getPlayerName(cel).."", plr ,255,0,0,true)
end
addCommandHandler("przelej", zaplacPieniadze)
addCommandHandler("zaplac", zaplacPieniadze)
addCommandHandler("dajkase", zaplacPieniadze)
setTimer(function()
local vehicles=getElementsByType('vehicle')
for _, vehicle in pairs(vehicles) do
if getElementHealth(vehicle)<300 then
setVehicleDamageProof(vehicle, true)
elseif getElementHealth(vehicle)>301 then
setVehicleDamageProof(vehicle, false)
end
end
end, 500, 0)
--[[
Resource: OURGame v2
Developers: Split <split.programista@gmail.com>
You have no right to use this code without my permission.
(c) 2015 <split.programista@gmail.com>. All rights reserved.
]]
function onPrivateMessage(plr, cmd, target, ...)
if not target or not {...} then
outputChatBox('* U?yj /pm <nick/ID> <tre??>', plr)
return
end
local text=table.concat({...}, ' ')
local target=findPlayer(plr, target)
if not target then
outputChatBox('* Nie znaleziono podanego gracza.', plr, 255, 0, 0)
return
end
outputChatBox("#FFFFFF>> #BABABA"..getPlayerName(target).."["..getElementData(target,"id").."]: #ffffff"..text.."", plr, _, _, _, true)
outputChatBox("#FFFFFF<< #BABABA"..getPlayerName(plr).."["..getElementData(plr,"id").."]: #ffffff"..text.."", target, _, _, _, true)
local pm_text=('PM> %s(%d) >> %s(%d): %s'):format(getPlayerName(plr), getElementData(plr,"id"), getPlayerName(target), getElementData(target,"id"), text)
triggerClientEvent(root, "admin:addText", root, pm_text)
end
addCommandHandler('pw', onPrivateMessage)
addCommandHandler('pm', onPrivateMessage)
function zaplacPieniadze(plr, cmd, komu, value)
local cel = getPlayerFromName(komu)
if plr == cel then
outputChatBox('Nie mo?esz wysy?a? pieni?dzy samemu sobie', plr)
return
end
if (not value) or (not cel) then
outputChatBox("#FF007E* U?yj: /przelej <nick/ID> <kwota>", plr,255,0,0,true)
return
end
if (not cel) then
outputChatBox("#FF007E* Nie znaleziono gracza o podanym ID/nicku!", plr,255,0,0,true)
return
end
if tonumber(value) < 0 then return end
if (not tonumber(value)) then return end
if getPlayerMoney(plr) < tonumber(value) then
outputChatBox("#FF007E* Nie posiadasz wystarczaj?cej ilo?ci pieni?dzy!", plr, 255, 0, 0,true)
return
end
takePlayerMoney(plr, tonumber(value))
givePlayerMoney(cel, tonumber(value))
outputChatBox("#FF007E* Gracz #DDDDDD"..getPlayerName(plr).." #FF007Eprzekazuje Ci #DDDDDD"..tonumber(value).." #FF007EZ?.", cel,255,0,0,true)
outputChatBox("* #FF007EPrzekazujesz #DDDDDD"..tonumber(value).." #FF007EZ? graczowi #DDDDDD"..getPlayerName(cel).."", plr ,255,0,0,true)
end
addCommandHandler("przelej", zaplacPieniadze)
addCommandHandler("zaplac", zaplacPieniadze)
addCommandHandler("dajkase", zaplacPieniadze)
setTimer(function()
local vehicles=getElementsByType('vehicle')
for _, vehicle in pairs(vehicles) do
if getElementHealth(vehicle)<300 then
setVehicleDamageProof(vehicle, true)
elseif getElementHealth(vehicle)>301 then
setVehicleDamageProof(vehicle, false)
end
end
end, 500, 0)
Je?li Ci tak pokazuje to znaczy ?e gracz do kt?rego chcesz wys?a? wiadomo?? nie jest na serwerze czyli go nie ma albo druga opcja je?li gracz ma w nicku nawiasy albo inne znaki to ich nie wpisa?e?. Musisz poda? pe?en nick np [LOL]=DC=
Nie możesz pisać nowych tematów Nie możesz odpowiadać w tematach Nie możesz zmieniać swoich postów Nie możesz usuwać swoich postów Nie możesz głosować w ankietach