Jump to content

beamer

Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by beamer

  1. beamer

    team system

    its done, i fixed it. thx @Platin
  2. beamer

    team system

    @Platin the command when the player exits still remains in the tab and when a player login on - he is not added to the team in the tab
  3. beamer

    team system

    good afternoon! help me please! when a player leaves the server, the team in which he was a member remains in the tab how to make it so that when ALL team members exit, its name is removed from the tab? below is a snippet of code that might help you local inPlayerTeam = {} addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() executeSQLQuery("CREATE TABLE IF NOT EXISTS tab_team(name TEXT, login TEXT, level NUMERIC, r NUMERIC, g NUMERIC, b NUMERIC)") local res = executeSQLQuery("SELECT * FROM tab_team WHERE level = ?", 1) if #res > 0 then for _, t in ipairs(res) do createTeam(t.name, t.r, t.g, t.b) end end outputDebugString("Create "..(#res).." teams") end ) addEventHandler('onClientRender', root, function() for i, team in ipairs(getElementsByType('team')) do local players = getPlayersInTeam(team) if (#players == 0) then destroyElement(team) endendend) addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), function() for _, t in ipairs(getElementsByType("team")) destroyElement(t) outputDebugString("All teams are removed") end ) addEventHandler("onPlayerLogin", getRootElement(), function(_, account) local login = getAccountName(account) setElementData(source, "tab_team:login", login) local res = executeSQLQuery("SELECT name FROM tab_team WHERE login = ?", login) if #res > 0 then setPlayerTeam(source, getTeamFromName(res[1].name)) end end ) addEventHandler("onPlayerQuit", getRootElement(), function() if inPlayerTeam[source] then inPlayerTeam[source] = destroyElement(team) endend)
  4. beamer

    team system

    good afternoon! help me please! when a player leaves the server, the team in which he was a member remains in the tab how to make it so that when ALL team members exit, its name is removed from the tab? below is a snippet of code that might help you local inPlayerTeam = {} addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() executeSQLQuery("CREATE TABLE IF NOT EXISTS tab_team(name TEXT, login TEXT, level NUMERIC, r NUMERIC, g NUMERIC, b NUMERIC)") local res = executeSQLQuery("SELECT * FROM tab_team WHERE level = ?", 1) if #res > 0 then for _, t in ipairs(res) do createTeam(t.name, t.r, t.g, t.b) end end outputDebugString("Создано "..(#res).." групп") end ) addEventHandler('onClientRender', root, function() for i, team in ipairs(getElementsByType('team')) do local players = getPlayersInTeam(team) if (#players == 0) then destroyElement(team) end end end) addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), function() for _, t in ipairs(getElementsByType("team")) do destroyElement(t) end outputDebugString("Все группы удалены") end ) addEventHandler("onPlayerLogin", getRootElement(), function(_, account) local login = getAccountName(account) setElementData(source, "tab_team:login", login) local res = executeSQLQuery("SELECT name FROM tab_team WHERE login = ?", login) if #res > 0 then setPlayerTeam(source, getTeamFromName(res[1].name)) end end ) addEventHandler("onPlayerQuit", getRootElement(), function() if inPlayerTeam[source] then inPlayerTeam[source] = destroyElement(team) end end )
  5. beamer

    flip vehicle

    big thanks friend! it works. have a nice day
  6. beamer

    flip vehicle

    hello please help me. according to the example below, the flip works for me - but not the way I need it. I need that when the player use the flip - the car is slightly above the ground, at zero coordinates (it stands exactly), and stops any movement, like a frieze, but not constant, it would immediately fall back to the ground Thank you function flip ( ) local theVehicle = getPedOccupiedVehicle ( localPlayer ) if ( theVehicle and getVehicleController ( theVehicle ) == localPlayer ) then local rx, ry, rz = getVehicleRotation ( theVehicle ) local x, y, z = getElementPosition ( theVehicle ) setVehicleRotation ( theVehicle, rx, ry, rz ) setElementPosition ( theVehicle, x, y, z + 5 ) end end addCommandHandler("flip",flip) function flip ( ) local theVehicle = getPedOccupiedVehicle ( localPlayer ) if ( theVehicle and getVehicleController ( theVehicle ) == localPlayer ) then local rx, ry, rz = getVehicleRotation ( theVehicle ) local x, y, z = getElementPosition ( theVehicle ) setVehicleRotation ( theVehicle, rx, ry, rz ) setElementPosition ( theVehicle, x, y, z + 5 ) end end sorry i first time here
×
×
  • Create New...