Hi everyone! I have a radio script, but it not works, i got this error message:
attempt to call local 'thePlayer' (a userdata value)
function kozosradio(thePlayer, commandName, ...)
local theFrakcio = getPlayerTeam(thePlayer)
if (theFrakcio) then
local frakcioID = tonumber(getElementData(theFrakcio, "id"))
if (frakcioID==1 or frakcioID==2 or frakcioID==3 or frakcioID == 4 or frakcioID == 5 or frakcioID == 6) then
if (...) then
local message = trunklateText( thePlayer, table.concat({...}, " ") )
local PDFrakcio = getPlayersInTeam(thePlayer("Rendőrség"))
local OMSZFrakcio = getPlayersInTeam(getTeamFromName("Országos Mentő Szolgálat"))
local NNIFrakcio = getPlayersInTeam(getTeamFromName("Nemzeti Nyomozó Iroda"))
local GOVFrakcio = getPlayersInTeam(getTeamFromName("Önkormányzat"))
local NAVFrakcio = getPlayersInTeam(getTeamFromName("Nemzeti Adó Vámhivatal"))
local playerName = getPlayerName(thePlayer)
for key, value in ipairs(PDFrakcio) do
outputChatBox("[#PD] " .. playerName .. " mondja: " .. message, value, 0, 102, 255)
end
for key, value in ipairs(OMSZFrakcio) do
outputChatBox("[#OMSZ] " .. playerName .. " mondja: " .. message, value, 0, 102, 255)
end
for key, value in ipairs(NNIFrakcio) do
outputChatBox("[#NNI] " .. playerName .. " mondja: " .. message, value, 0, 102, 255)
end
for key, value in ipairs(GOVFrakcio) do
outputChatBox("[#GOV] " .. playerName .. " mondja: " .. message, value, 0, 102, 255)
end
for key, value in ipairs(NAVFrakcio) do
outputChatBox("[#NAV] " .. playerName .. " mondja: " .. message, value, 0, 102, 255)
end
end
end
end
end
addCommandHandler("d", kozosradio, false, false)
I hope, someone can help me