Jump to content

(لم تتم الافادة بعد)xطلب تصحيح كود


Recommended Posts

لو قتل لاعب شخص يجي كلام في الشات

لو قتل شخصين نفس الشي يعني المفروض يتعرف على عدد القتلى بس به مشكلة

Server

function resetAll() 
    local players = getElementsByType("player") 
    for i,player in ipairs (players) do 
        setElementData(player,"killnumber",0) 
    end 
end 
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),resetAll) 
  
function checkKills(ammo,killer,weapon, player) 
   local killerkills = getElementData(killer,"killnumber") 
   if  killer ~= source  then 
                    if killerkills == false then 
                    killerkills = 0 
                            elseif killerkills == 1 then 
                                           outputChatBox ( "#00ff00ThePlayer".. getPlayerName(killer) .." #ff0000Killed 1", root, 255, 0, 0, true ) 
        elseif killerkills == 2 then 
               outputChatBox ( "#00ff00ThePlayer".. getPlayerName(killer) .." #ff0000Killed 2", root, 255, 0, 0, true ) 
       triggerClientEvent ("next",player) 
    end 
  end 
end 
                                                                                                         
addEventHandler("onPlayerWasted",getRootElement(),checkKills) 

Client

addEvent("next",true) 
function showit( ) 
    local sound = playSound("dominating.mp3") 
 function textRender_ (  ) 
       dxDrawText("Nomniet!! Next Map",337.0,130.0,967.0,265.0,tocolor(0,0,255,0),1.0,"bankgothic","center","center",false,false,false) 
 end 
 addEventHandler ( "onClientRender", root, textRender_ ) 
 setTimer ( function (   ) 
   removeEventHandler ( "onClientRender", root, textRender_ ) 
 end, 5000, 1 ) 
end 
addEventHandler ( "next", root, showit) 

وش المشكلة؟ وشكرا

Edited by Guest
Link to comment

على اي اساس حاط بلاير في سطر 9 و مستخدمه ل التريقر؟

على حسب ترتيب البارتمر بلاير رح يكون رقم البودي بارت الي اللاعب انضرب فيه و مات

ارقمنت السورس بالتريقر لازم يكون المنت ما يصير تحط رقم

!يفترض ذا يكون خطأ واضح بالدي بق، هذا إذا فتحت الدي بق اصلاً

دائماً لما تبرمج لازم تخلي الدي بق مفتوح

Link to comment

الديق بق يقول بس

Bad Argument @ setElementData السطر العاشر

يعني الحين اخلي الترايقر سورس لاني ماني فاهم كلامك المعرب فوق كله :/

ارجو ان توضح اكثر

Link to comment

setElementData مو getElementData الي بسطر 10

يفترض انك تتحقق ان فيه قاتل عشان لما تنتحر ما رح يكون فيه قاتل و رح يجي خطأ بالدي بق

+

ترا انت ما حطيت المنت داتا عشان تجيب الألمنت داتا

+

التحقق الي بسطر 12 و 13 ما له معنى

Link to comment

سويت شف ما يعطيني الدي بق مشاكل

function resetAll() 
    local players = getElementsByType("player") 
    for i,player in ipairs (players) do 
        setElementData(player,"killnumber",0) 
    end 
end 
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),resetAll) 
  
function checkKills(ammo,killer,weapon, player) 
if killer then 
  if ( killer ~= source and getElementType ( killer ) == "player" ) then 
      local killerkills = getElementData(killer,"killnumber") 
                if killerkills == false then 
                    killerkills = 0 
                            if killerkills == 1 then 
                            outputChatBox ( "#00ff00ThePlayer".. getPlayerName(killer) .." #ff0000Killed 1", root, 255, 0, 0, true ) 
        elseif killerkills == 2 then 
               outputChatBox ( "#00ff00ThePlayer".. getPlayerName(killer) .." #ff0000Killed 2", root, 255, 0, 0, true ) 
       triggerClientEvent ("next",killer) 
                killerkills = killerkills + 1 
            setElementData(killer,"killnumber",killerkills) 
                end 
             end 
         end 
     end  
   end 
addEventHandler("onPlayerWasted",getRootElement(),checkKills) 

Link to comment
addEventHandler("onPlayerWasted",getRootElement(), 
function ( ammo, attacker, weapon, bodypart ) 
    if killer then 
        if ( killer ~= source and getElementType ( killer ) == "player" ) then 
            local killerkills = getElementData( killer, "killnumber" ) 
                if ( killerkills == false ) then 
                    killerkills = 0 
                        if ( killerkills == 1 ) then 
                            outputChatBox ( "#00ff00ThePlayer".. getPlayerName(killer) .." #ff0000Killed 1", root, 255, 0, 0, true ) 
                                elseif ( killerkills >= 2 ) then 
                                    outputChatBox ( "#00ff00ThePlayer".. getPlayerName(killer) .." #ff0000Killed 2", root, 255, 0, 0, true ) 
                                    triggerClientEvent ( "next" ,source ) 
                                    killerkills = killerkills + 1 
                                    setElementData( killer, "killnumber", tonumber ( killerkills ) ) 
                    end 
                end 
            end 
        end 
    end 
 ) 

Link to comment

شكرا على المساعدة لاكن مو شغال ما يجي شي في الشات الدي بق ما يقول شي

تم تجربته في السيرفر المجاني قتلت اخوي عدة مرات

Link to comment

outputChatBox ابي مثلا انا في سيرفر تكتيك اذا قتلت الاول عادي اذا قتلت الثاني عادي اذا قتلت ثلاثة يجي كلام في الشات

+

dxDrawText انا مسوي ترايقر انو تجي اغنية بسيطة+ كلام في الشاشة

شوف فووق اول كود

بس المشكلة كانو شي مو شغال ما يجي كلام في الشات ولا في الشاشة و لا اغنية

Link to comment
-- #Server Side 
  
addEventHandler("onPlayerWasted",getRootElement(), 
function ( ammo, attacker, weapon, bodypart ) 
    if killer then 
        if ( killer ~= source and getElementType ( killer ) == "player" ) then 
            if ( getElementData ( killer, "Kills" ) == 3 ) then 
                outputChatBox ( "#00ff00ThePlayer".. getPlayerName(killer) .." #ff0000Killed 3", root, 255, 0, 0, true ) 
                triggerClientEvent ( "next" , getRootElement() ) 
                end 
            end 
        end 
    end 
) 
  
-- #Client Side 
function textRender_ (  ) 
    dxDrawText("Nomniet!! Next Map",337.0,130.0,967.0,265.0,tocolor(0,0,255,0),1.0,"bankgothic","center","center",false,false,false) 
end 
  
addEvent("next",true) 
addEventHandler ( "next", root, 
    function ( ) 
    if isElement ( sound ) then destroyElement ( sound ) end 
        local sound = playSound("dominating.mp3") 
        addEventHandler ( "onClientRender", root, textRender_ ) 
        setTimer ( function (   ) 
        removeEventHandler ( "onClientRender", root, textRender_ ) 
        end, 5000, 1 ) 
    end 
) 

تفضل مآجربته

Link to comment
addEventHandler("onPlayerWasted",getRootElement(), 
function ( ammo, attacker, weapon, bodypart ) 
    if attacker then 
        if ( attacker ~= source and getElementType ( attacker ) == "player" ) then 
            if ( getElementData ( attacker, "kills" ) == 3 ) then 
                outputChatBox ( "#00ff00ThePlayer".. getPlayerName(attacker) .." #ff0000Killed 3", root, 255, 0, 0, true ) 
                triggerClientEvent ( attacker, "next" , attacker ) 
                end 
            end 
        end 
    end 
) 

-- Client 
local screenW, screenH = guiGetScreenSize() 
function textRender_ (  ) 
    dxDrawText("Nomniet!! Next Map", (screenW - 259) / 2, (screenH - 93) / 2, ((screenW - 259) / 2) + 259, ( (screenH - 93) / 2) + 93, tocolor(0, 0, 255, 255), 3.00, "pricedown", "left", "top", false, false, true, false, false) 
end 
  
addEvent("next",true) 
addEventHandler ( "next", root, 
    function ( ) 
    if isElement ( sound ) then destroyElement ( sound ) end 
    local sound = playSound("music.mp3") 
        addEventHandler ( "onClientRender", root, textRender_ ) 
        setTimer ( function (   ) 
        removeEventHandler ( "onClientRender", root, textRender_ ) 
        end, 5000, 1 ) 
    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...