Jump to content

مساعدة


Recommended Posts

السلام عليكم , طبعأ عندي هذي المشكلة

 

function checkPlrs ()
        c = 0
for i,p in pairs(getElementsByType("player"))do
    if theyinmatch(p) then
        c = c+1
    end end
if tonumber(c) > 1 then
for i,p in pairs(getElementsByType("player"))do
    if theyinmatch(p) then
        outputChatBox("روح اسحك روح",p,0,255,0,true)
        triggerClientEvent(p,'gui', p)
        setElementHealth(p, 200)
        setPlayerArmor(p, 100)
        takeAllWeapons( p )
        setElementFrozen(p, false)
        setPlayerHudComponentVisible ( p, "radar", false ) 
    end 
    end
    else
        burnthemall()
    end
end

function burnthemall()
    for i,p in pairs(getElementsByType("player"))do
        if theyinmatch(p) then
            killPed(p)
            outputChatBox('جيبلك واحد حتى تكدر تلعب!',p,0,255,0,true)
        end 
    end
end

انه مايستدعي الـ فانكشن burnthemall 
جربت اسوي

killPed( source )

يقول لي nil

في حل وشكراً

Link to comment
  On 16/05/2019 at 21:09, JustP said:

السلام عليكم , طبعأ عندي هذي المشكلة

 


function checkPlrs ()
        c = 0
for i,p in pairs(getElementsByType("player"))do
    if theyinmatch(p) then
        c = c+1
    end end
if tonumber(c) > 1 then
for i,p in pairs(getElementsByType("player"))do
    if theyinmatch(p) then
        outputChatBox("روح اسحك روح",p,0,255,0,true)
        triggerClientEvent(p,'gui', p)
        setElementHealth(p, 200)
        setPlayerArmor(p, 100)
        takeAllWeapons( p )
        setElementFrozen(p, false)
        setPlayerHudComponentVisible ( p, "radar", false ) 
    end 
    end
    else
        burnthemall()
    end
end

function burnthemall()
    for i,p in pairs(getElementsByType("player"))do
        if theyinmatch(p) then
            killPed(p)
            outputChatBox('جيبلك واحد حتى تكدر تلعب!',p,0,255,0,true)
        end 
    end
end

انه مايستدعي الـ فانكشن burnthemall 
جربت اسوي


killPed( source )

يقول لي nil

في حل وشكراً

Expand  

ipairs بـ pairs استبدل

Link to comment
  On 16/05/2019 at 21:44, NX_CI said:

ipairs بـ pairs استبدل

Expand  

نفس الشيء..

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

  On 16/05/2019 at 21:44, NX_CI said:

ipairs بـ pairs استبدل

Expand  
marker = createMarker(2159.54297, 943.37616, 9.82031,"cylinder", 1.5)
blip = createBlip(2159.54297, 943.37616, 10.82031,41)

positions = { 
  {-2145.67310, -2297.88965, 30.62500},
  {-2110.29370, -2326.92236, 46.57813},
  {-2098.56860, -2401.86328, 30.62500},
  {-2094.41064, -2454.47412, 46.57813},
  {-2175.17822, -2536.86670, 30.61719},
  {-2220.07153, -2505.76782, 30.73003},
  {-2151.32471, -2463.63232, 30.84375},
  {-2146.31616, -2375.85156, 30.62500},
  {-2154.75439, -2370.47974, 30.68164},
}

addEventHandler('onMarkerHit',marker,
function( hitElement )
if hitElement and getElementType( hitElement ) == 'player' and not isPedInVehicle( hitElement ) then
        online = getplayers()
    if tonumber(online)+1 < 10 then
        local num = math.random (#positions)
        x, y, z = positions [num][1], positions [num][2], positions [num][3]
        setElementPosition(hitElement, x, y, z)
        setElementFrozen(hitElement, true)
        setElementData(hitElement,"dm",hitElement)
        outputChatBox('انتظر ريثماً يدخُل شخصاً', hitElement,0,255,0,true)
        setElementDimension(hitElement, 530)
        setTimer(checkPlrs,15000,1)
    else
        outputChatBox("اذهب وأحضر معك شخصاً لتستطيع اللعب.",hitElement,0,255,0,true)
        end
    end
end )

addEventHandler('onPlayerChat',root,
function(message)
if tostring(message) == 'قتال' then
       setElementPosition(source ,2139.64502, 945.49158, 10.81252)
     end
end )

function asdf( ammo, attacker, weapon, bodypart )
if getElementData(source , 'dm')  then
    if attacker then
            mon = math.random(1500,15000)
            armor = getPlayerArmor(attacker)
            hea = getElementHealth(attacker)
            setPlayerArmor(attacker, armor + 50 )
            setElementHealth(attacker, hea + 50 )
            givePlayerMoney(attacker, mon)
            setElementData(source, 'dm', false)
            setElementData(source, 'undamagable', false)
            setPlayerHudComponentVisible ( source, "radar", true )
       else
            setPlayerHudComponentVisible ( source, "radar", true )
            setElementData(source, 'dm', false)
            setElementData(source, 'undamagable', false)
       end
   end
end 
addEventHandler('onPlayerWasted',root, asdf)


addEventHandler('onPlayerJoin',root,
function ()
       setElementData(source, 'dm', false)
       setElementData(source, 'undamagable', false)
end )

addEvent('giveWeaponme',true)
addEventHandler('giveWeaponme',root,
function( Data )
       giveWeapon(source, Data , 9999)
       setElementFrozen(source, false)
       setElementData(source, 'undamagable', false)
end)

function getplayers()
            c = -1
    for i,p in pairs(getElementsByType("player"))do
        if theyinmatch(p) then
            c = c+1
            end
        end 
    return tonumber(c)
end

function theyinmatch(p)
    per = getElementData(p,"dm")
    if tostring(per) == true then
        return true
    else
        return false
    end
end

function checkPlrs ()
        c = 0
for i,p in pairs(getElementsByType("player"))do
    if theyinmatch(p) then
        c = c+1
    end end
if tonumber(c) > 1 then
for i,p in pairs(getElementsByType("player"))do
    if theyinmatch(p) then
        outputChatBox("روح اسحك روح",p,0,255,0,true)
        triggerClientEvent(p,'gui', p)
        setElementHealth(p, 200)
        setPlayerArmor(p, 100)
        takeAllWeapons( p )
        setElementFrozen(p, false)
        setPlayerHudComponentVisible ( p, "radar", false ) 
    end 
    end
    else
        burnthemall()
    end
end

function burnthemall()
    for i,p in ipairs(getElementsByType("player"))do
        if theyinmatch(p) then
            killPed(p)
            outputChatBox('جيبلك واحد حتى تكدر تلعب!',p,0,255,0,true)
        end 
    end
end

 

Link to comment

انصحك تسوي جدول تحط فيه اللاعبين رح يوفر عليك الشغل كثير من الداتات والوظائف اللي مستعملهم ورح يكون اسهل تتحقق من عدد اللاعبين

 

Link to comment
  On 16/05/2019 at 22:17, #BrosS said:

انصحك تسوي جدول تحط فيه اللاعبين رح يوفر عليك الشغل كثير من الداتات والوظائف اللي مستعملهم ورح يكون اسهل تتحقق من عدد اللاعبين

 

Expand  

كيف يعني؟

Link to comment
  On 16/05/2019 at 22:19, JustP said:

كيف يعني؟

Expand  

رح يساعدوك

function getPlayer(player, Table)
for i, v in ipairs (Table) do
if (v == player) then
return true
end
end
end

function addPlayer(player, Table)
if not getPlayerTable(player, Players) then
table.insert(Table, player)
end
end

function removePlayer(player, Table)
for i, v in ipairs (Table) do
if (v == player) then
table.remove(Table, i)
end
end
end

 

Link to comment
  On 16/05/2019 at 22:23, NX_CI said:

theyinmatch(p) 

tostring(per)????

per = element 

المتغير يساوي عنصر كيف تحوله لسترنق  , اكيد الوظيفة راح تعطيك قيمة خاطئة

theyinmatch تأكد من دالة

Expand  
function theyinmatch(p)
    per = getElementData(p,"dm")
    if tostring(per) == true then
        return true
    else
        return false
    end
end

وش الخطأ هنا؟ هي كانت مكان true

كذا

'true'

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

تمام حليتها
 

Link to comment
  • N3xT locked this topic
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...