function getAlivePlayersInTeam(theTeam)
local theTable = { }
local players = getPlayersInTeam(theTeam)
for i,v in pairs(players) do
if not isPedDead(v) then
theTable[#theTable+1]=v
end
end
return theTable
end
function isPlayerInTeam(player, team)
assert(isElement(player) and getElementType(player) == "player", "Bad argument 1 @ isPlayerInTeam [player expected, got " .. tostring(player) .. "]")
assert((not team) or type(team) == "string" or (isElement(team) and getElementType(team) == "team"), "Bad argument 2 @ isPlayerInTeam [nil/string/team expected, got " .. tostring(team) .. "]")
return getPlayerTeam(player) == (type(team) == "string" and getTeamFromName(team) or (type(team) == "userdata" and team or (getPlayerTeam(player) or true)))
end
addEvent( "pdd", true )
addEventHandler( "pdd", root,
function (player)
local count = #getAlivePlayersInTeam(getTeamFromName("Mechanik")) or 0
if count == 0 then
outputChatBox("Przykro mi, ale aktualnie na serwerze nie ma mechanik?w, ktorzy sa obecni!", p, 0, 255, 0)
else
outputChatBox("Wezwales Mechanika ! Czekaj cierpliwie!", player, 0, 255, 0)
for id, playeritem in ipairs(getElementsByType("player")) do
if isPlayerInTeam(playeritem, "Mechanik") then
outputChatBox("Gracz " .. string.gsub(getPlayerName(p), "#%x%x%x%x%x%x", "") .. " wezwal Mechanika", pdd[ddd],0, 255, 0)
end
end
end
end)
C:
function laweta_pd ()
if (source == pomocdrogowa) then
guiSetVisible(pomocdrogowa, false)
guiSetVisible(policja, false)
guiSetVisible(zamknij, false)
showCursor(false)
removeEventHandler("onClientRender", root,tele)
triggerServerEvent ( "pdd", getRootElement(), getLocalPlayer())
end
end
addEventHandler("onClientGUIClick", pomocdrogowa, laweta_pd)
function isPlayerInTeam(player, team)
assert(isElement(player) and getElementType(player) == "player", "Bad argument 1 @ isPlayerInTeam [player expected, got " .. tostring(player) .. "]")
assert((not team) or type(team) == "string" or (isElement(team) and getElementType(team) == "team"), "Bad argument 2 @ isPlayerInTeam [nil/string/team expected, got " .. tostring(team) .. "]")
return getPlayerTeam(player) == (type(team) == "string" and getTeamFromName(team) or (type(team) == "userdata" and team or (getPlayerTeam(player) or true)))
end
addEvent( "pdd", true )
addEventHandler( "pdd", root,
function (player)
local count = countPlayersInTeam ( getTeamFromName("Mechanik" )
if count == 0 then
outputChatBox("Przykro mi, ale aktualnie na serwerze nie ma mechanik?w, ktorzy sa obecni!", p, 0, 255, 0)
else
outputChatBox("Wezwales Mechanika ! Czekaj cierpliwie!", player, 0, 255, 0)
for id, playeritem in ipairs(getElementsByType("player")) do
if isPlayerInTeam(playeritem, "Mechanik") then
outputChatBox("Gracz " .. string.gsub(getPlayerName(p), "#%x%x%x%x%x%x", "") .. " wezwal Mechanika", pdd[ddd],0, 255, 0)
end
end
end
end)
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