Jump to content

مساعدة في كود


Recommended Posts

الحين انا سويت الكود ذا لمن شخص يجي يكتب الامر يطلع له مين قتله و باي سلاح 

تفهمون من الكود 

Server Side --
function player_Wasted ( ammo, attacker, weapon, bodypart )
	if ( attacker ) then
		local tempString
    timer = setTimer(function () 
		if ( getElementType ( attacker ) == "player" ) then
			tempString = getPlayerName ( attacker ).." killed "..getPlayerName ( source ).." ("..getWeaponNameFromID ( weapon )..")"
		elseif ( getElementType ( attacker ) == "vehicle" ) then
			tempString = getPlayerName ( getVehicleController ( attacker ) ).." killed "..getPlayerName ( source ).." ("..getWeaponNameFromID ( weapon )..")"
		end
    
		if ( bodypart == 9 ) then
			tempString = tempString.." (HEADSHOT!)"
		else
			tempString = tempString.." ("..getBodyPartName ( bodypart )..")"
		end
		outputChatBox ( tempString )
	else
		outputChatBox ( getPlayerName ( source ).." died. ("..getWeaponNameFromID ( weapon )..") ("..getBodyPartName ( bodypart )..")" )
	end
	local team = {
	 getTeamFromName "Los Santos Fire Department"
	     }
		 
		 getElementData ( thePlayer, "onPlayerWasted" )
      end,6000, 1)
end	
end
addEventHandler ( "onPlayerWasted", getRootElement(), player_Wasted )
addCommandHandler ( "getfinger", player_Wasted ,false ,true )

-----
Client Side

GUIEditor = {
    progressbar = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
    function()
        progressbar = guiCreateProgressBar(569, 519, 212, 27, false )
        guiSetVisible(progressbar,false)
         local timee = guiProgressBarGetProgress(progressbar)
 setTimer( guiProgressBarSetProgress, 500, 1,progressbar,timee+10 )
 setTimer( guiProgressBarSetProgress, 1000, 1,progressbar,timee+20 )
 setTimer( guiProgressBarSetProgress, 1500, 1,progressbar,timee+30 )
 setTimer( guiProgressBarSetProgress, 2000, 1,progressbar,timee+40 )
 setTimer( guiProgressBarSetProgress, 2500, 1,progressbar,timee+50 )
 setTimer( guiProgressBarSetProgress, 3000, 1,progressbar,timee+60 )
 setTimer( guiProgressBarSetProgress, 3500, 1,progressbar,timee+70 )
 setTimer( guiProgressBarSetProgress, 4000, 1,progressbar,timee+80 )
 setTimer( guiProgressBarSetProgress, 4500, 1,progressbar,timee+90 )
 setTimer( guiProgressBarSetProgress, 5000, 1,progressbar,timee+100 )
 timer = setTimer(function ()     
     guiSetVisible(progressbar, false)
	guiProgressBarSetProgress(progressbar, 0)

end,5000, 1)
end		

)

و لمن يكتب الامر يطلع    progressbar

و لمن يخلص يطلع البيانات مين قتل الشخص و كذا

في اغلاط بالاكواد ولا كويسة؟

Link to comment

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

ثم سوي بالكوماند

triggerClientEvent
setTimer
guiProgressBarSetProgress
guiProgressBarGetProgress
getElementData
outputChatBox

 

Link to comment
function finger ( playerSource, commandName, playerName )
    if playerName then
        local thePlayer = getPlayerFromName ( playerName )
        if thePlayer then
            triggerClientEvent ( thePlayer, "onPlayerWasted", thePlayer, )
        else
            -- invalid player name specified
        end
    else
        -- No player name specified
    end 
end

function finger1(thePlayer, commandName, ...)
	if (...) then
		local message = table.concat({...}, " ")
		finger1(thePlayer, 1, message)
	else
		outputChatBox("SYNTAX: /" .. commandName .. " [ID/Player Name]", thePlayer, 255, 194, 14)
	end
end

addCommandHandler ( "getfinger", finger )

 

Edited by Ghost-Gamer
Link to comment

لا والله ابي اتعلم بس مبتدا ف يعني ما افهم كثير كثير 

--Client Side#
GUIEditor = {
    progressbar = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
    function()
        progressbar = guiCreateProgressBar(569, 519, 212, 27, false )
        guiSetVisible(progressbar,false)
         local timee = guiProgressBarGetProgress(progressbar)
 setTimer( guiProgressBarSetProgress, 500, 1,progressbar,timee+10 )
 setTimer( guiProgressBarSetProgress, 1000, 1,progressbar,timee+20 )
 setTimer( guiProgressBarSetProgress, 1500, 1,progressbar,timee+30 )
 setTimer( guiProgressBarSetProgress, 2000, 1,progressbar,timee+40 )
 setTimer( guiProgressBarSetProgress, 2500, 1,progressbar,timee+50 )
 setTimer( guiProgressBarSetProgress, 3000, 1,progressbar,timee+60 )
 setTimer( guiProgressBarSetProgress, 3500, 1,progressbar,timee+70 )
 setTimer( guiProgressBarSetProgress, 4000, 1,progressbar,timee+80 )
 setTimer( guiProgressBarSetProgress, 4500, 1,progressbar,timee+90 )
 setTimer( guiProgressBarSetProgress, 5000, 1,progressbar,timee+100 )
 timer = setTimer(function ()     
     guiSetVisible(progressbar, false)
	guiProgressBarSetProgress(progressbar, 0)

end,5000, 1)
end		

)


----Server Side#

function player_Wasted ( ammo, attacker, weapon, bodypart )
	if ( attacker ) then
		local tempString
		if ( getElementType ( attacker ) == "player" ) then
			tempString = getPlayerName ( attacker ).." killed "..getPlayerName ( source ).." ("..getWeaponNameFromID ( weapon )..")"
		elseif ( getElementType ( attacker ) == "vehicle" ) then
			tempString = getPlayerName ( getVehicleController ( attacker ) ).." killed "..getPlayerName ( source ).." ("..getWeaponNameFromID ( weapon )..")"
		end
		if ( bodypart == 9 ) then
			tempString = tempString.." (HEADSHOT!)"
		else
			tempString = tempString.." ("..getBodyPartName ( bodypart )..")"
		end
		outputChatBox ( tempString )
	else
		outputChatBox ( getPlayerName ( source ).." died. ("..getWeaponNameFromID ( weapon )..") ("..getBodyPartName ( bodypart )..")" )
	end
	
	local team = {
	 getTeamFromName "Los Santos Fire Department"
	     }
       thePlayer = getPlayerFromName ( playerName )
        if thePlayer then
            triggerClientEvent ( thePlayer, "onPlayerWasted", thePlayer )
          outputChatBox ( ..thePlayer "Was Killed By"..attacker.., source )	 
		 getElementData ( thePlayer, "onPlayerWasted", true )
end

function finger ( playerSource, commandName, playerName )
    if playerName then
        local thePlayer = getPlayerFromName ( playerName )
        if thePlayer then
            triggerClientEvent ( thePlayer, "onPlayerWasted", thePlayer )
        else
            -- invalid player name specified
        end
    else
        -- No player name specified
    end 
end
addCommandHandler ( "getfinger", finger )
addEventHandler ( "onPlayerWasted", getRootElement(), player_Wasted

هذا الي انا مسويه بس مدري ليه ا يشتغل

Edited by Ghost-Gamer
Link to comment
On 7/31/2017 at 08:44, Ghost-Gamer said:

الحين انا سويت الكود ذا لمن شخص يجي يكتب الامر يطلع له مين قتله و باي سلاح 

تفهمون من الكود 

و لمن يخلص يطلع البيانات مين قتل الشخص و كذا

في اغلاط بالاكواد ولا كويسة؟

ابدا من جديد احذف اكوادك المخربطه ذي

'onClientPlayerWasted'--اول ما يموت الاعب نعطيه داتا باسم القاتل 
setElementData--لاعطاء الداتا
getPlayerName--نعطي الاعب داتا باسم القاتل

addCommandHandler--نسوي امر علشان يطلع للاعب التحميل
guiCreateProgressBar , guiProgressBarSetProgress , setTimer -- الوظائف يلي رح تستخدمها للتحميل
outputChatBox -- (بعد ما يخلص التايمر حق التحميل تجيب بالشات داتا يلي مع الاعب ( الداتا يلي باسم القاتل

 

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...