Jump to content

[Solved] مشكلة بالكود


Recommended Posts

السلام عليكم

سويت كود لعمل سباون للاعب عندما يموت لكن ما يعمل

  
    Grove = createTeam("Grove", 0, 255, 0) 
    Ballas = createTeam("Ballas", 255, 0, 255) 
    Medic = createTeam("Medic", 0, 255, 255) 
    Police = createTeam("Police", 0, 0, 255) 
    Aztecas = createTeam("Aztecas", 0, 204, 204) 
    NoTeam = createTeam("NoTeam", 255, 0, 0) 
      
local rnd = { 
        -- los 
        {2047.8, -1899.8, 14.5}, 
        {958.1, -1356.7, 14.3}, 
        {1128.7, -1490.5, 23.8}, 
        {2144.1, -1803.2, 17.1}, 
        {1716.9, -1682.1, 21.2}, 
        {1975.6, -1284.7, 29.5}, 
        -- las 
        {2027, 1916.7, 13.3}, 
        {2565.1, 1212.8, 15.3}, 
        {2535.5, 997.8, 15.3}, 
        {2542.3, 2213.5, 15.1}, 
        {2261.4, 2333.3, 11.8}, 
        {1954.2, 2323.9, 11.8}, 
        -- san 
        {-1838.9, 1085, 46.1 }, 
        {-1685.6, 1109.7, 54.7}, 
        {-1951.5, 692.7, 46.6}, 
        {-2055, 457, 35.2}, 
        {-1812.3, 574.3, 35.2}, 
        {-2563, 220, 13}, 
} 
  
local rmd = { 
{1178.1999511719, -1323.8000488281, 15.10000038147}, 
{2040, -1417.3000488281, 18.200000762939}, 
{1607.1999511719, 1822.3000488281, 11.800000190735}, 
{-2643.3999023438, 603.09997558594, 15.5}, 
} 
  
local rpd = { 
{1572.9000244141, -1635.4000244141, 13.60000038147}, 
{1563.9000244141, -1635.1999511719, 13.60000038147}, 
{1555.5999755859, -1635.0999755859, 13.60000038147}, 
{1572.8000488281, -1620.3000488281, 13.5}, 
{1564.4000244141, -1620.4000244141, 13.5}, 
{1557.9000244141, -1620.1999511719, 13.5}, 
} 
  
addEventHandler("onPlayerWasted", getRootElement(), function( source ) 
    if isElement( source ) and getElementType( source ) == "player" then 
    local iad = getElementModel ( source ) 
    local x, y, z = getElementPosition ( source ) 
    local city = getZoneName ( x, y, z, true ) 
    local tma = getPlayerTeam(source) 
    if (tma == "NoTeam") or (tma == "Ballas") or (tma == "Aztecas") or (tma == "Grove") then 
        if (city == "Los Santos") then 
            local xne, yne, zne = unpack(rnd[math.random(1, 6)]) 
            spawnPlayer (source, xne, yne, zne, 0, iad, 0, 0 ) 
        elseif (city == "Las Venturas") then 
            local xna, yna, zna = unpack(rnd[math.random(6, 12)]) 
            spawnPlayer (source, xna, yna, zna, 0, iad, 0, 0) 
        elseif (city == "San Fierro") then 
            local xnc, ync, znc = unpack(rnd[math.random(12, 18)]) 
            spawnPlayer (source, xnc, ync, znc, 0, iad, 0, 0) 
        end 
    elseif (tma == "Medic") then 
        if (city == "Los Santos") then 
            local xme, yme, zme = unpack(rmd[math.random(1, 2)]) 
            spawnPlayer (source, xme, yme, zme, 0, iad, 0, 0 ) 
        elseif (city == "Las Venturas") then 
            local xma, yma, zma = unpack(rmd[math.random(3, 3)]) 
            spawnPlayer (source, xma, yma, zma, 0, iad, 0, 0) 
        elseif (city == "San Fierro") then 
            local xmc, ymc, zmc = unpack(rmd[math.random(4, 4)]) 
            spawnPlayer (source, xmc, ymc, zmc, 0, iad, 0, 0) 
        end 
    elseif (tma == "Police") then 
        local xp, yp, zp = unpack(rpd[math.random(1,6)]) 
        spawnPlayer(source, xp, yp, zp, 0, iad, 0, 0) 
    end 
    end 
end 
) 

ما بيظهر شئ بالدي بق وما يحدث سباون للاعب مرة أخري وتستمر الكاميرا في الصعود :D

أرجو الحل

Edited by Guest
Link to comment

سويت هيك وبرضو ما أشتغل

addEventHandler("onPlayerWasted", getRootElement(), function() 
    if isElement( source ) and getElementType( source ) == "player" then 
    local iad = getElementModel ( source ) 
    local x, y, z = getElementPosition ( source ) 
    local city = getZoneName ( x, y, z, true ) 
    local tma = getPlayerTeam(source) 
    local Ballaso = getTeamFromName ("Ballas") 
    local NoTeamo = getTeamFromName ("NoTeam") 
    local Aztecaso = getTeamFromName ("Aztecas") 
    local Groveo = getTeamFromName ("Grove") 
    local Medico = getTeamFromName ("Medic") 
    local Policeo = getTeamFromName ("Police") 
    if tma == NoTeamo or tma == Ballaso or tma == Aztecaso or tma == Groveo then 
        if (city == "Los Santos") then 
            local xne, yne, zne = unpack(rnd[math.random(1, 6)]) 
            spawnPlayer (source, xne, yne, zne, 0, iad, 0, 0 ) 
        elseif (city == "Las Venturas") then 
            local xna, yna, zna = unpack(rnd[math.random(6, 12)]) 
            spawnPlayer (source, xna, yna, zna, 0, iad, 0, 0) 
        elseif (city == "San Fierro") then 
            local xnc, ync, znc = unpack(rnd[math.random(12, 18)]) 
            spawnPlayer (source, xnc, ync, znc, 0, iad, 0, 0) 
        end 
    elseif (tma == Medico) then 
        if (city == "Los Santos") then 
            local xme, yme, zme = unpack(rmd[math.random(1, 2)]) 
            spawnPlayer (source, xme, yme, zme, 0, iad, 0, 0 ) 
        elseif (city == "Las Venturas") then 
            local xma, yma, zma = unpack(rmd[math.random(3, 3)]) 
            spawnPlayer (source, xma, yma, zma, 0, iad, 0, 0) 
        elseif (city == "San Fierro") then 
            local xmc, ymc, zmc = unpack(rmd[math.random(4, 4)]) 
            spawnPlayer (source, xmc, ymc, zmc, 0, iad, 0, 0) 
        end 
    elseif (tma == Policeo) then 
        local xp, yp, zp = unpack(rpd[math.random(1,6)]) 
        spawnPlayer(source, xp, yp, zp, 0, iad, 0, 0) 
    end 
    end 
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...