Jump to content

Help Pls fast


orcun99

Recommended Posts

armorTeams = {["Squads"] = true, ["Admins"] = true, ["Freedom Revolutionary Front"] = true, ["Desert Force"] = true, ["The Punishers"] = true} 
  
local isMayhemEnabled = false 
  
local spawnFreeGroups = "fd,fdn,nf,nfr,unionsoldier,confedsoldier,sahpmember,sahper,fbcmember,usocmember,eimember" 
local free1 = split(spawnFreeGroups, ",") 
local free2 = {} 
for i,v in ipairs(free1) do 
    free2[v] = true 
end 
  
function initializeSpawns (resourceStarted) 
    if getResourceName(resourceStarted) == "SpawnP" or getResourceName(resourceStarted) == "SpawnP" then 
        startResource(getResourceFromName("SpawnP")) 
        local xml = xmlLoadFile(":SpawnP/spawns.xml")             -- open the XML file 
        local cityNodes = xmlNodeGetChildren(xml)       -- get all child nodes of the root node (<messages>) 
        local cities = {}                             -- create a new global variable to store the welcome messages 
        for i,node in ipairs(cityNodes) do 
            local classnodes = xmlNodeGetChildren(node) 
            for i2,node2 in ipairs(classnodes) do 
                local name = xmlNodeGetAttribute(node2, "name") 
                local r = xmlNodeGetAttribute(node2, "r") 
                local g = xmlNodeGetAttribute(node2, "g") 
                local b = xmlNodeGetAttribute(node2, "b") 
                if not getTeamFromName(name) then 
                    createTeam( name , r , g , b) 
                end 
            end 
        end 
        xmlUnloadFile(xml) 
    end 
end 
addEventHandler("onResourceStart", root, initializeSpawns) 
  
function logAllOut() 
    local players = getElementsByType ( "player" ) 
    for k, player in ipairs(players) do 
        account = getPlayerAccount(player) 
        if not isGuestAccount(account) then 
            logOut(player) -- Log them out. 
        end 
    end 
    addEventHandler("onPlayerLogout",getRootElement(),loggedOut) 
end 
addEventHandler("onResourceStart", resourceRoot, logAllOut) 
  
function playerSpawn (spawnX, spawnY, spawnZ, team, permission, skin, weapons, player, skinName, sR, sG, sB, rot, dim, int) 
    local playerAccount = getPlayerAccount(player) 
    local hasPermission = false 
    if getAccountData(playerAccount, "override") then 
        hasPermission = true     
    else 
        if permission:lower() == "none" then 
            hasPermission = true 
        end 
        local outerPerm = split(permission, ";") or {permission} 
        for i,v in ipairs(outerPerm) do 
            local permArray = split(v, ",") 
            if #permArray == 2 then 
                local permType = permArray[1] 
                local permTo = permArray[2] 
                if permType:lower() == "group" then 
                    if exports.SpawnPacl:isPlayerInGroup(player, permTo) then hasPermission = true end 
                    if isMayhemEnabled and free2[permTo] then hasPermission = true end 
                elseif permType:lower() == "gang" then 
                    local gang = getAccountData(playerAccount, "gang") 
                    if gang and gang:lower() == permTo:lower() then hasPermission = true end 
                end 
            end 
        end 
    end 
    if hasPermission then  
        local spawnTeam = getTeamFromName(team) 
        if not rot then rot = 0 end 
        spawnPlayer (player, spawnX , spawnY, spawnZ + 1, rot, skin, 0, 0, spawnTeam) 
        setElementDimension(player, dim or 0) 
        setElementInterior(player, int or 0) 
        fadeCamera (player, true) 
        setCameraInterior (player, int or 0 ) 
        setCameraTarget (player, player) 
        local tR , tG , tB = getTeamColor(spawnTeam) 
        local r = sR or tR 
        local g = sG or tG 
        local b = sB or tB 
        local blip = createBlipAttachedTo(player, 0, 2, r, g, b, 255, 0, 300, getRootElement()) 
        setElementVisibleTo(blip, player, false) 
        setPlayerNametagColor(player, r, g, b) 
        if(weapons) then 
            local weps = split(weapons, ",") 
            for i, node in ipairs(weps) do 
                --outputConsole(node) 
                local wepinfo = split(node, ".") 
                local wepid = wepinfo[1] 
                --outputConsole(wepid) 
                local wepammo = wepinfo[2] 
                --outputConsole(wepammo) 
                giveWeapon ( player, wepid, wepammo ) 
            end 
        end 
        setAccountData(playerAccount, "lastSpawnPerm", permission) 
        setElementData(player, "class", skinName) 
         
        if getResourceState(getResourceFromName("orcunGhud")) == "running" then 
            showPlayerHudComponent(player, "all", false) 
            showPlayerHudComponent(player, "crosshair", true) 
        end 
         
        if armorTeams[team] then 
            setPedArmor(player, 100) 
        end 
         
        triggerClientEvent(player, "onSpawnSuccessful", getRootElement()) 
    else 
        triggerClientEvent(player, "onSpawnError", getRootElement() , "You are not in this Gang/Squad/Company") 
    end 
end 
  
addEvent("onPlayerSpawnButton", true) 
addEventHandler("onPlayerSpawnButton", getRootElement(), playerSpawn) 
  
  
function playerDespawn() 
    local player = source 
    for i,v in ipairs(getAttachedElements(player)) do 
        if getElementType(v) == "blip" and getElementParent(getElementParent(v)) == resourceRoot then 
            destroyElement(v) 
        end 
    end 
end 
addEventHandler("onPlayerWasted", getRootElement(), playerDespawn) 
addEventHandler("onPlayerQuit", getRootElement(), playerDespawn) 
  
function saveProperty(a, b, c, playah) 
    local player = playah or source 
    local playeraccount = getPlayerAccount(player) 
    if not isPedDead(player) then 
        local x, y, z = getElementPosition(player) 
        local rot = getPedRotation(player) 
         
        setAccountData(playeraccount, "x", x) 
        setAccountData(playeraccount, "y", y) 
        setAccountData(playeraccount, "z", z) 
        setAccountData(playeraccount, "rot", rot) 
         
        local skin = getElementModel(player) 
        setAccountData(playeraccount, "skin", skin) 
         
        local team = getTeamName(getPlayerTeam(player)) 
        setAccountData(playeraccount, "team", team) 
         
        local weaponsarray = {} 
        for i=1, 12 do 
            if(getPedWeapon(player, i) ~= 0 and getPedTotalAmmo(player, i) > 0) then 
                table.insert(weaponsarray, getPedWeapon(player, i) .. "." .. getPedTotalAmmo(player, i)) 
            end 
        end 
         
        local weaponstring = table.concat(weaponsarray,",") 
        setAccountData(playeraccount, "weapons", weaponstring) 
        setAccountData(playeraccount, "aliveonquit", true) 
        setAccountData(playeraccount, "class", getElementData(player, "class")) 
         
        local r,g,b = getPlayerNametagColor(player) 
        setAccountData(playeraccount, "r", r) 
        setAccountData(playeraccount, "g", g) 
        setAccountData(playeraccount, "b", b) 
         
        local dimension = getElementDimension(player) 
        local interior = getElementInterior(player) 
        setAccountData(playeraccount, "interior", interior) 
        setAccountData(playeraccount, "dimension", dimension) 
    else 
        setAccountData(playeraccount, "aliveonquit", false) 
        setAccountData(playeraccount, "x", nil) 
        setAccountData(playeraccount, "y", nil) 
        setAccountData(playeraccount, "z", nil) 
        setAccountData(playeraccount, "permission", nil) 
        setAccountData(playeraccount, "team", nil) 
        setAccountData(playeraccount, "skin", nil) 
        setAccountData(playeraccount, "weapons", nil) 
        setAccountData(playeraccount, "class", nil) 
        setAccountData(playeraccount, "r", nil) 
        setAccountData(playeraccount, "g", nil) 
        setAccountData(playeraccount, "b", nil) 
        setAccountData(playeraccount, "rot", nil) 
        setAccountData(playeraccount, "dimension", nil) 
        setAccountData(playeraccount, "interior", nil) 
    end 
end 
addEventHandler("onPlayerQuit", getRootElement(), saveProperty) 
  
function wasPlayerAlive() 
    if getAccountData(getPlayerAccount(source), "aliveonquit") then 
        --outputConsole("Seems like playah wus alive!") 
        local playerAccount = getPlayerAccount(source) 
        local x = getAccountData(playerAccount, "x") 
        local y = getAccountData(playerAccount, "y") 
        local z = getAccountData(playerAccount, "z") 
        local rot = getAccountData(playerAccount, "rot") 
        local team = getAccountData(playerAccount, "team") 
        local permission = getAccountData(playerAccount, "lastSpawnPerm") 
        local skin = getAccountData(playerAccount, "skin") 
        local weps = getAccountData(playerAccount, "weapons") 
        local skinName = getAccountData(playerAccount, "class") 
        local r = getAccountData(playerAccount, "r") 
        local g = getAccountData(playerAccount, "g") 
        local b = getAccountData(playerAccount, "b") 
        local dim = getAccountData(playerAccount, "dimension") 
        local int = getAccountData(playerAccount, "interior") 
         
        playerSpawn(x , y , z, team, permission, skin, weps, source, skinName, r, g, b, rot, dim, int) 
    else 
        showSpawnScreen(source) 
    end 
end 
  
addEvent("wasPlayerAliveEvent", true) 
addEventHandler("wasPlayerAliveEvent", getRootElement(), wasPlayerAlive) 
  
function loggedOut() 
    cancelEvent() 
    outputChatBox("You can't log out!", source, 255, 0 ,0) 
end 
  
function stopdown() 
    local players = getElementsByType("player") 
    for i, player in ipairs(players) do 
        saveProperty(nil, nil, nil, player) 
        killPed(player) 
        logOut(player) 
    end 
end 
addEventHandler("onResourceStop", resourceRoot, stopdown) 
  
function showSpawnScreen(player) 
    local account = getPlayerAccount(player) 
    local houses = exports.Ohousing:getAccountHouses(account) 
    triggerClientEvent(player, "showSpawn", player, houses) 
end 
addEventHandler("onPlayerWasted", root, function() showSpawnScreen(source) end) 

if permission:lower() == "none" then  --line53 
            hasPermission = true    --line54 

GE2ddN.png

Link to comment
armorTeams = {["Squads"] = true, ["Admins"] = true, ["Freedom Revolutionary Front"] = true, ["Desert Force"] = true, ["The Punishers"] = true} 
  
local isMayhemEnabled = false 
  
local spawnFreeGroups = "fd,fdn,nf,nfr,unionsoldier,confedsoldier,sahpmember,sahper,fbcmember,usocmember,eimember" 
local free1 = split(spawnFreeGroups, ",") 
local free2 = {} 
for i,v in ipairs(free1) do 
    free2[v] = true 
end 
  
function initializeSpawns (resourceStarted) 
    if getResourceName(resourceStarted) == "SpawnP" or getResourceName(resourceStarted) == "SpawnP" then 
        startResource(getResourceFromName("SpawnP")) 
        local xml = xmlLoadFile(":SpawnP/spawns.xml")             -- open the XML file 
        local cityNodes = xmlNodeGetChildren(xml)       -- get all child nodes of the root node () 
        local cities = {}                             -- create a new global variable to store the welcome messages 
        for i,node in ipairs(cityNodes) do 
            local classnodes = xmlNodeGetChildren(node) 
            for i2,node2 in ipairs(classnodes) do 
                local name = xmlNodeGetAttribute(node2, "name") 
                local r = xmlNodeGetAttribute(node2, "r") 
                local g = xmlNodeGetAttribute(node2, "g") 
                local b = xmlNodeGetAttribute(node2, "b") 
                if not getTeamFromName(name) then 
                    createTeam( name , r , g , b) 
                end 
            end 
        end 
        xmlUnloadFile(xml) 
    end 
end 
addEventHandler("onResourceStart", root, initializeSpawns) 
  
function logAllOut() 
    local players = getElementsByType ( "player" ) 
    for k, player in ipairs(players) do 
        account = getPlayerAccount(player) 
        if not isGuestAccount(account) then 
            logOut(player) -- Log them out. 
        end 
    end 
    addEventHandler("onPlayerLogout",getRootElement(),loggedOut) 
end 
addEventHandler("onResourceStart", resourceRoot, logAllOut) 
  
function playerSpawn (spawnX, spawnY, spawnZ, team, permission, skin, weapons, player, skinName, sR, sG, sB, rot, dim, int) 
    local playerAccount = getPlayerAccount(player) 
    local hasPermission = false 
    if getAccountData(playerAccount, "override") then 
        hasPermission = true    
    else 
        if permission:lower() == "none" then 
            hasPermission = true 
        end 
        if type(permission) == "string" then 
        local outerPerm = split(permission, ";") or {permission} 
            if type(outerPerm) == "table" then 
                for i,v in ipairs(outerPerm) do 
                    local permArray = split(v, ",") 
                    if #permArray == 2 then 
                        local permType = permArray[1] 
                        local permTo = permArray[2] 
                        if permType:lower() == "group" then 
                            if exports.SpawnPacl:isPlayerInGroup(player, permTo) then hasPermission = true end 
                            if isMayhemEnabled and free2[permTo] then hasPermission = true end 
                        elseif permType:lower() == "gang" then 
                            local gang = getAccountData(playerAccount, "gang") 
                            if gang and gang:lower() == permTo:lower() then hasPermission = true end 
                        end 
                    end 
                end 
            end 
        end 
    end 
    if hasPermission then 
        local spawnTeam = getTeamFromName(team) 
        if not rot then rot = 0 end 
        spawnPlayer (player, spawnX , spawnY, spawnZ + 1, rot, skin, 0, 0, spawnTeam) 
        setElementDimension(player, dim or 0) 
        setElementInterior(player, int or 0) 
        fadeCamera (player, true) 
        setCameraInterior (player, int or 0 ) 
        setCameraTarget (player, player) 
        local tR , tG , tB = getTeamColor(spawnTeam) 
        local r = sR or tR 
        local g = sG or tG 
        local b = sB or tB 
        local blip = createBlipAttachedTo(player, 0, 2, r, g, b, 255, 0, 300, getRootElement()) 
        setElementVisibleTo(blip, player, false) 
        setPlayerNametagColor(player, r, g, b) 
        if(weapons) then 
            local weps = split(weapons, ",") 
            for i, node in ipairs(weps) do 
                --outputConsole(node) 
                local wepinfo = split(node, ".") 
                local wepid = wepinfo[1] 
                --outputConsole(wepid) 
                local wepammo = wepinfo[2] 
                --outputConsole(wepammo) 
                giveWeapon ( player, wepid, wepammo ) 
            end 
        end 
        setAccountData(playerAccount, "lastSpawnPerm", permission) 
        setElementData(player, "class", skinName) 
        
        if getResourceState(getResourceFromName("orcunGhud")) == "running" then 
            showPlayerHudComponent(player, "all", false) 
            showPlayerHudComponent(player, "crosshair", true) 
        end 
        
        if armorTeams[team] then 
            setPedArmor(player, 100) 
        end 
        
        triggerClientEvent(player, "onSpawnSuccessful", getRootElement()) 
    else 
        triggerClientEvent(player, "onSpawnError", getRootElement() , "You are not in this Gang/Squad/Company") 
    end 
end 
  
addEvent("onPlayerSpawnButton", true) 
addEventHandler("onPlayerSpawnButton", getRootElement(), playerSpawn) 
  
  
function playerDespawn() 
    local player = source 
    for i,v in ipairs(getAttachedElements(player)) do 
        if getElementType(v) == "blip" and getElementParent(getElementParent(v)) == resourceRoot then 
            destroyElement(v) 
        end 
    end 
end 
addEventHandler("onPlayerWasted", getRootElement(), playerDespawn) 
addEventHandler("onPlayerQuit", getRootElement(), playerDespawn) 
  
function saveProperty(a, b, c, playah) 
    local player = playah or source 
    local playeraccount = getPlayerAccount(player) 
    if not isPedDead(player) then 
        local x, y, z = getElementPosition(player) 
        local rot = getPedRotation(player) 
        
        setAccountData(playeraccount, "x", x) 
        setAccountData(playeraccount, "y", y) 
        setAccountData(playeraccount, "z", z) 
        setAccountData(playeraccount, "rot", rot) 
        
        local skin = getElementModel(player) 
        setAccountData(playeraccount, "skin", skin) 
        
        local team = getTeamName(getPlayerTeam(player)) 
        setAccountData(playeraccount, "team", team) 
        
        local weaponsarray = {} 
        for i=1, 12 do 
            if(getPedWeapon(player, i) ~= 0 and getPedTotalAmmo(player, i) > 0) then 
                table.insert(weaponsarray, getPedWeapon(player, i) .. "." .. getPedTotalAmmo(player, i)) 
            end 
        end 
        
        local weaponstring = table.concat(weaponsarray,",") 
        setAccountData(playeraccount, "weapons", weaponstring) 
        setAccountData(playeraccount, "aliveonquit", true) 
        setAccountData(playeraccount, "class", getElementData(player, "class")) 
        
        local r,g,b = getPlayerNametagColor(player) 
        setAccountData(playeraccount, "r", r) 
        setAccountData(playeraccount, "g", g) 
        setAccountData(playeraccount, "b", b) 
        
        local dimension = getElementDimension(player) 
        local interior = getElementInterior(player) 
        setAccountData(playeraccount, "interior", interior) 
        setAccountData(playeraccount, "dimension", dimension) 
    else 
        setAccountData(playeraccount, "aliveonquit", false) 
        setAccountData(playeraccount, "x", nil) 
        setAccountData(playeraccount, "y", nil) 
        setAccountData(playeraccount, "z", nil) 
        setAccountData(playeraccount, "permission", nil) 
        setAccountData(playeraccount, "team", nil) 
        setAccountData(playeraccount, "skin", nil) 
        setAccountData(playeraccount, "weapons", nil) 
        setAccountData(playeraccount, "class", nil) 
        setAccountData(playeraccount, "r", nil) 
        setAccountData(playeraccount, "g", nil) 
        setAccountData(playeraccount, "b", nil) 
        setAccountData(playeraccount, "rot", nil) 
        setAccountData(playeraccount, "dimension", nil) 
        setAccountData(playeraccount, "interior", nil) 
    end 
end 
addEventHandler("onPlayerQuit", getRootElement(), saveProperty) 
  
function wasPlayerAlive() 
    if getAccountData(getPlayerAccount(source), "aliveonquit") then 
        --outputConsole("Seems like playah wus alive!") 
        local playerAccount = getPlayerAccount(source) 
        local x = getAccountData(playerAccount, "x") 
        local y = getAccountData(playerAccount, "y") 
        local z = getAccountData(playerAccount, "z") 
        local rot = getAccountData(playerAccount, "rot") 
        local team = getAccountData(playerAccount, "team") 
        local permission = getAccountData(playerAccount, "lastSpawnPerm") 
        local skin = getAccountData(playerAccount, "skin") 
        local weps = getAccountData(playerAccount, "weapons") 
        local skinName = getAccountData(playerAccount, "class") 
        local r = getAccountData(playerAccount, "r") 
        local g = getAccountData(playerAccount, "g") 
        local b = getAccountData(playerAccount, "b") 
        local dim = getAccountData(playerAccount, "dimension") 
        local int = getAccountData(playerAccount, "interior") 
        
        playerSpawn(x , y , z, team, permission, skin, weps, source, skinName, r, g, b, rot, dim, int) 
    else 
        showSpawnScreen(source) 
    end 
end 
  
addEvent("wasPlayerAliveEvent", true) 
addEventHandler("wasPlayerAliveEvent", getRootElement(), wasPlayerAlive) 
  
function loggedOut() 
    cancelEvent() 
    outputChatBox("You can't log out!", source, 255, 0 ,0) 
end 
  
function stopdown() 
    local players = getElementsByType("player") 
    for i, player in ipairs(players) do 
        saveProperty(nil, nil, nil, player) 
        killPed(player) 
        logOut(player) 
    end 
end 
addEventHandler("onResourceStop", resourceRoot, stopdown) 
  
function showSpawnScreen(player) 
    local account = getPlayerAccount(player) 
    local houses = exports.Ohousing:getAccountHouses(account) 
    triggerClientEvent(player, "showSpawn", player, houses) 
end 
addEventHandler("onPlayerWasted", root, function() showSpawnScreen(source) end) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...