Jump to content

تصحيح خطا


Recommended Posts

شباب معليش وش الخطا هنا

 

سيرفر سايد

 

addEvent("checkPermission",true)
addEventHandler("checkPermission",root,
	function()
		for i,v in ipairs(getElementsByType"player") do
			if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(v)), aclGetGroup("Police")) then
addEventHandler( "onElementClicked",root, masternew)
			
			else
			removeEventHandler( "onElementClicked",root, masternew)

							    triggerClientEvent(v,"noopenpolice",v)

			end
		end
	end
)













  
function masternew ( Target,veh ) 
 local account = getAccountName(getPlayerAccount(source)) 
    local name = getPlayerName(source) 
	local ali88 = getPedOccupiedVehicle(Target)
	local masterfin = getPlayerName(ali88)
        local thePlayer = getElementType( source ) == "player" or getElementType( source ) == veh
  
assasasa = getElementType ( thePlayer ) 
  
  
           if isObjectInACLGroup("user." .. account, aclGetGroup("Police")) then 
            
           if thePlayer then 
  
triggerClientEvent ( source, "openpolice" ,source,Target,masterfin) 
  
end 
end 
end 

 

 

 

كلنت سايد

 

 

 


bindKey ("m", "down",                            -- binds B key to toggle cursor state
        function()
		guiSetVisible(mainwndmaster,false)

		triggerServerEvent ("checkPermission", getLocalPlayer())
					showCursor( not isCursorShowing() )

        end)

		
		
		
		
		addEvent("openpolice",true)
addEventHandler("openpolice",root,
	function(Target,masterfin)
	local ali99 = getPlayerName(Target)
	
	
	if not guiGetVisible(mainwndmaster, true) then
	
		guiSetVisible(mainwndmaster,true)
	guiSetText(mainwndmaster, ali99 or masterfin)

	end
	end
)

 

 

@Abdul KariM

@!#NssoR_)

@3NAD

Edited by Master_MTA
Link to comment

عندك متغيرات زايدة ماهي مستعملة وعندك بعض الاخطاء في استخدام الحدث

onElementClicked راجع

function masternew ( _, _, thePlayer ) 
    local account = getPlayerAccount(thePlayer)
    if account and not isGuestAccount(account) and isObjectInACLGroup("user." .. getAccountName(account), aclGetGroup("Police")) then
        if getElementType( source ) == "player" then 
            triggerClientEvent ( thePlayer, "openpolice" ,thePlayer,getPlayerName(thePlayer),getPlayerName(source))
        end 
    end 
end 
Link to comment
15 minutes ago, said:

عندك متغيرات زايدة ماهي مستعملة وعندك بعض الاخطاء في استخدام الحدث

onElementClicked راجع


function masternew ( _, _, thePlayer ) 
    local account = getPlayerAccount(thePlayer)
    if account and not isGuestAccount(account) and isObjectInACLGroup("user." .. getAccountName(account), aclGetGroup("Police")) then
        if getElementType( source ) == "player" then 
            triggerClientEvent ( thePlayer, "openpolice" ,thePlayer,getPlayerName(thePlayer),getPlayerName(source))
        end 
    end 
end 

اخي هل بكذا الاسم اللي بيطلع باللوحه بيكون

حق الشخص اللي ضغت عليه ولا الشخص اللي داس بالماوس على الشخص

@</Mr.Tn6eL>

Edited by Master_MTA
Link to comment

sourceاذا تبي  اسم الشخص اللي ضغطت عليه استخدم

function masternew ( _, _, thePlayer ) 
    local account = getPlayerAccount(thePlayer)
    if account and not isGuestAccount(account) and isObjectInACLGroup("user." .. getAccountName(account), aclGetGroup("Police")) then
        if getElementType( source ) == "player" then 
            triggerClientEvent ( thePlayer, "openpolice" ,thePlayer,getPlayerName(source))
        end 
    end 
end 

 

Edited by </Mr.Tn6eL>
خطأ املائي
Link to comment
4 minutes ago, said:

sourceاذا تبي  اسم الشخص اللي ضغطت عليه استخدم


function masternew ( _, _, thePlayer )     local account = getPlayerAccount(thePlayer)    if account and not isGuestAccount(account) and isObjectInACLGroup("user." .. getAccountName(account), aclGetGroup("Police")) then        if getElementType( source ) == "player" then             triggerClientEvent ( thePlayer, "openpolice" ,thePlayer,getPlayerName(source))        end     end end 

 

اها اخوي طيب انا سويت تعديل بسيط وابي الشخص اللي يسوق السياره

يعني كذا

 


  function masternew ( _, _, thePlayer ) 
    local account = getPlayerAccount(thePlayer)
    if account and not isGuestAccount(account) and isObjectInACLGroup("user." .. getAccountName(account), aclGetGroup("Police")) then
        if getElementType( source ) == "player" or getElementType( source ) == "vehicle" then 
            triggerClientEvent ( thePlayer, "openpolice" ,thePlayer,getPlayerName(getVhicleController(source)),getPlayerName(source))
        end 
    end 
end 

@</Mr.Tn6eL>

 

وخليت الكلنت كذا

function(Target1,ownerveh1)
	
	
	if not guiGetVisible(mainwndmaster, true) then
	
		guiSetVisible(mainwndmaster,true)
	guiSetText(mainwndmaster,Target1 or ownerveh1)

 

 

Edited by Master_MTA
Link to comment
1 hour ago, Master_MTA said:

اها اخوي طيب انا سويت تعديل بسيط وابي الشخص اللي يسوق السياره

يعني كذا

 


  function masternew ( _, _, thePlayer ) 
    local account = getPlayerAccount(thePlayer)
    if account and not isGuestAccount(account) and isObjectInACLGroup("user." .. getAccountName(account), aclGetGroup("Police")) then
        if getElementType( source ) == "player" or getElementType( source ) == "vehicle" then 
            triggerClientEvent ( thePlayer, "openpolice" ,thePlayer,getPlayerName(getVhicleController(source)),getPlayerName(source))
        end 
    end 
end 

@</Mr.Tn6eL>

 

وخليت الكلنت كذا


function(Target1,ownerveh1)
	
	
	if not guiGetVisible(mainwndmaster, true) then
	
		guiSetVisible(mainwndmaster,true)
	guiSetText(mainwndmaster,Target1 or ownerveh1)

 

 

في انتظار الرد

@Default

@Abdul KariM

Edited by Master_MTA
Link to comment
3 minutes ago, Default said:

سطر 4 انت كاتب

getVhicleController

بدلها بهاذي

getVehicleController

وجرب وفيه اي خطا اكتب رد

هههههههههههه يعطيك العافيه بس معلش طلب ثاني

وهو اخوي الحين

لو بغيت اخر واحد استخدم ايضا يعني لو السياره فاضيه وبغيت اخر واحد استخدمها اكون شاكر

@Default

Link to comment

قصدك كذا اخوي





    local counter = {} 
      
      
    getOcc = function ( plr, veh ) -- plr = player element, veh = vehicle element * 
        if not counter [ plr ] then counter [ plr ] = 0; end 
            for seat, player in pairs(getVehicleOccupants( veh )) do 
                counter[plr] = counter[plr] + 1  
            end 
        return counter [ plr ] 
    end 
      
	  
	  
	  
	  
	  

addEventHandler ( 'onVehicleExit', root, function ( plr, seat, jacked ) 
    local count = getOcc ( plr, source ) 
  
        if count == 0 then 
            setElementData ( plr, 'lastUsed', plr ) 
                counter [ plr ] = 0; 
    end 
end) 
addEventHandler ( 'onVehicleEnter', root, function ( plr, seat, jacked ) 
  
            setElementData ( plr, 'lastCarUsed', plr ) 
end) 

 

@N3xT

Link to comment
10 hours ago, N3xT said:

addEventHandler ( "onVehicleEnter", root,	function ( player , seat )		if seat == 0 then			setElementData(source, "driverName", getPlayerName(player))		end	end)

 

وإذا بغيت تجيب أسمه, تحقق أن الإلمنت سيارة وتجيب أسم السائق كذا


getElementData(source, "driverName") or "Unknown"

 

 

@N3xT

يعني اخوي قصدك كذا

 

?

    getElementData(source, "driverName") or "Unknown"
     
     
    ---------------------------------------------------------------------
    getPlayerName(getElementData(source, "driverName") or "Unknown")

 

 

وتحقق الالمنت بيكون كذا

 

if getElementType(source) == "vehicle" then

 

#Edit:

 

@N3xT

@3NAD

@</Mr.Tn6eL>

اخواني الحين في شي

اللوحه شغاله ومزبوط كل شي

بس لما يخش احد السيرفر ما تفتح ابد حتى لو ضغطت عليه او على نفسي

Edited by Master_MTA
Link to comment
1 hour ago, 3NAD said:

اطرح الأكواد 

تفضل اخوي

 

--***********************************--
--            By MR.S3D             --
--            Server Side            --
--***************please dont remove********************--

----------------------
--Coordinates in the prison and outside prison
----------------------

------ This is Coordinates where the prison

local x, y, z = 198, 162, 1003
local interior_jail = 3

-- this is Coordinates to get out of prison

local interior_unjail = 0 
local x1, y1, z1 = 780, -1327, 13

-------------------------------------------------

rRoot = getResourceRootElement(getThisResource())
local timeLeft = {}
local timeLeftText = {}

local mint = 60 -- this 1 min
local f = 120  -- this 2 min
local s3m = 180 -- this 3 min
local s4m = 240 -- this 4 min
local s5m = 300 -- this 5 min
local s1h = 3600 -- 1 hour

function RemoveFromVeh(plr)
     hisVeh = getPedOccupiedVehicle(plr)
             if hisVeh then
            removePedFromVehicle(plr)
        end
end


addEvent("jail",true) -- Jail
addEventHandler("jail",root,
function(isJailed,text)
if text == "1 min" then
		thePlayer = getPlayerFromName(isJailed)
		if getElementData( thePlayer, "isJailed") then outputChatBox("This player is already in jail.",isJailed,255,0,0) return end   
		RemoveFromVeh(thePlayer)		
	    setElementInterior ( thePlayer, interior_jail )       
		setElementPosition (thePlayer, x, y, z )
		toggleControl (thePlayer, "fire", false)
        toggleControl (thePlayer, "next_weapon", false)
        toggleControl (thePlayer, "previous_weapon", false)
        toggleControl (thePlayer, "sprint", true)
        toggleControl (thePlayer, "aim_weapon", false)
	    toggleControl (thePlayer, "weapon", false)
        toggleControl (thePlayer, "next_weapon", false)
        toggleControl (thePlayer, "vehicle_fire", false)
        toggleControl (thePlayer, "vehicle_secondary_fire", false)	
        showPlayerHudComponent (thePlayer, "ammo", false)
        showPlayerHudComponent (thePlayer, "weapon", false)	 
		setElementData(thePlayer, "Timeleft", tonumber(mint))
        showTimeLeft(thePlayer)
		setElementData(thePlayer,"isJailed",true)
		setElementData(getResourceRootElement(getThisResource()),"".. getPlayerSerial(thePlayer).."-j",true)
        outputChatBox("** You arrested [ "..getPlayerName(thePlayer).." #FFFF00]For 1 min",source,255,255,0,true)
		outputChatBox("** [ "..getPlayerName(thePlayer).." #FF0000] Player has been arrested ",root,255,0,0,true)
elseif text == "2 min" then
		thePlayer = getPlayerFromName(isJailed)
		if getElementData( thePlayer, "isJailed") then outputChatBox("This player is already in jail.",isJailed,255,0,0) return end  
		RemoveFromVeh(thePlayer)		   		
	    setElementInterior ( thePlayer, interior_jail )        
		setElementPosition (thePlayer, x, y, z )
		toggleControl (thePlayer, "fire", false)
        toggleControl (thePlayer, "next_weapon", false)
        toggleControl (thePlayer, "previous_weapon", false)
        toggleControl (thePlayer, "sprint", true)
        toggleControl (thePlayer, "aim_weapon", false)
	    toggleControl (thePlayer, "weapon", false)
        toggleControl (thePlayer, "next_weapon", false)
        toggleControl (thePlayer, "vehicle_fire", false)
        toggleControl (thePlayer, "vehicle_secondary_fire", false)	
        showPlayerHudComponent (thePlayer, "ammo", false)
        showPlayerHudComponent (thePlayer, "weapon", false)			
		setElementData(thePlayer, "Timeleft", tonumber(f))
        showTimeLeft(thePlayer)
        setElementData(thePlayer,"isJailed",true)
        setElementData(getResourceRootElement(getThisResource()),"".. getPlayerSerial(thePlayer).."-j",true)
        outputChatBox("** You arrested [ "..getPlayerName(thePlayer).." #FFFF00]For 2 min",source,255,255,0,true)
		outputChatBox("** [ "..getPlayerName(thePlayer).." #FF0000] Player has been arrested ",root,255,0,0,true)
elseif text == "3 min" then
		thePlayer = getPlayerFromName(isJailed)
		if getElementData( thePlayer, "isJailed") then outputChatBox("This player is already in jail.",isJailed,255,0,0) return end
		RemoveFromVeh(thePlayer)				
	    setElementInterior ( thePlayer, interior_jail )
        setElementPosition (thePlayer, x, y, z )
		toggleControl (thePlayer, "fire", false)
        toggleControl (thePlayer, "next_weapon", false)
        toggleControl (thePlayer, "previous_weapon", false)
        toggleControl (thePlayer, "sprint", true)
        toggleControl (thePlayer, "aim_weapon", false)
	    toggleControl (thePlayer, "weapon", false)
        toggleControl (thePlayer, "next_weapon", false)
        toggleControl (thePlayer, "vehicle_fire", false)
        toggleControl (thePlayer, "vehicle_secondary_fire", false)	
        showPlayerHudComponent (thePlayer, "ammo", false)
        showPlayerHudComponent (thePlayer, "weapon", false)			
        setElementData(thePlayer,"isJailed",true)
	    setElementData(thePlayer, "Timeleft", tonumber(s3m))
        showTimeLeft(thePlayer)
        setElementData(getResourceRootElement(getThisResource()),"".. getPlayerSerial(thePlayer).."-j",true)
        outputChatBox("** You arrested [ "..getPlayerName(thePlayer).." #FFFF00]For 3 min",source,255,255,0,true)
		outputChatBox("** [ "..getPlayerName(thePlayer).." #FF0000] Player has been arrested ",root,255,0,0,true)
elseif text == "4 min" then
		thePlayer = getPlayerFromName(isJailed)
		if getElementData( thePlayer, "isJailed") then outputChatBox("This player is already in jail.",isJailed,255,0,0) return end   
		RemoveFromVeh(thePlayer)		  		
	    setElementInterior ( thePlayer, interior_jail )        
        setElementPosition (thePlayer, x, y, z )
		toggleControl (thePlayer, "fire", false)
        toggleControl (thePlayer, "next_weapon", false)
        toggleControl (thePlayer, "previous_weapon", false)
        toggleControl (thePlayer, "sprint", true)
        toggleControl (thePlayer, "aim_weapon", false)
	    toggleControl (thePlayer, "weapon", false)
        toggleControl (thePlayer, "next_weapon", false)
        toggleControl (thePlayer, "vehicle_fire", false)
        toggleControl (thePlayer, "vehicle_secondary_fire", false)	
        showPlayerHudComponent (thePlayer, "ammo", false)
        showPlayerHudComponent (thePlayer, "weapon", false)			
        setElementData(thePlayer,"isJailed",true)
	    setElementData(thePlayer, "Timeleft", tonumber(s4m))
        showTimeLeft(thePlayer)
        setElementData(getResourceRootElement(getThisResource()),"".. getPlayerSerial(thePlayer).."-j",true)
        outputChatBox("** You arrested [ "..getPlayerName(thePlayer).." #FFFF00]For 4 min",source,255,255,0,true)
		outputChatBox("** [ "..getPlayerName(thePlayer).." #FF0000] Player has been arrested ",root,255,0,0,true)
elseif text == "5 min" then
		thePlayer = getPlayerFromName(isJailed)
		if getElementData( thePlayer, "isJailed") then outputChatBox("This player is already in jail.",isJailed,255,0,0) return end  
		RemoveFromVeh(thePlayer)		   		
	    setElementInterior ( thePlayer, interior_jail )        
		setElementPosition (thePlayer, x, y, z )
		toggleControl (thePlayer, "fire", false)
        toggleControl (thePlayer, "next_weapon", false)
        toggleControl (thePlayer, "previous_weapon", false)
        toggleControl (thePlayer, "sprint", true)
        toggleControl (thePlayer, "aim_weapon", false)
	    toggleControl (thePlayer, "weapon", false)
        toggleControl (thePlayer, "next_weapon", false)
        toggleControl (thePlayer, "vehicle_fire", false)
        toggleControl (thePlayer, "vehicle_secondary_fire", false)	
        showPlayerHudComponent (thePlayer, "ammo", false)
        showPlayerHudComponent (thePlayer, "weapon", false)			
        setElementData(thePlayer,"isJailed",true)
	    setElementData(thePlayer, "Timeleft", tonumber(s5m))
        showTimeLeft(thePlayer)
        setElementData(getResourceRootElement(getThisResource()),"".. getPlayerSerial(thePlayer).."-j",true)
        outputChatBox("** You arrested [ "..getPlayerName(thePlayer).." #FFFF00]For 5 min",source,255,255,0,true)
		outputChatBox("** [ "..getPlayerName(thePlayer).." #FF0000] Player has been arrested ",root,255,0,0,true)
elseif text == "1 hour" then
		thePlayer = getPlayerFromName(isJailed)
		if getElementData( thePlayer, "isJailed") then outputChatBox("This player is already in jail.",isJailed,255,0,0) return end 
		RemoveFromVeh(thePlayer)				
	    setElementInterior ( thePlayer, interior_jail )        
		setElementPosition (thePlayer, x, y, z )
		toggleControl (thePlayer, "fire", false)
        toggleControl (thePlayer, "next_weapon", false)
        toggleControl (thePlayer, "previous_weapon", false)
        toggleControl (thePlayer, "sprint", true)
        toggleControl (thePlayer, "aim_weapon", false)
	    toggleControl (thePlayer, "weapon", false)
        toggleControl (thePlayer, "next_weapon", false)
        toggleControl (thePlayer, "vehicle_fire", false)
        toggleControl (thePlayer, "vehicle_secondary_fire", false)	
        showPlayerHudComponent (thePlayer, "ammo", false)
        showPlayerHudComponent (thePlayer, "weapon", false)			
        setElementData(thePlayer,"isJailed",true)
	    setElementData(thePlayer, "Timeleft", tonumber(s1h))
        showTimeLeft(thePlayer)
        setElementData(getResourceRootElement(getThisResource()),"".. getPlayerSerial(thePlayer).."-j",true)
        outputChatBox("** You arrested [ "..getPlayerName(thePlayer).." #FFFF00]For 1 hour",source,255,255,0,true)
		outputChatBox("** [ "..getPlayerName(thePlayer).." #FF0000] Player has been arrested ",root,255,0,0,true)
	end
end	)

addEvent("unjail",true)-- unJail
addEventHandler("unjail",root,
function(isJailed)
	thePlayer = getPlayerFromName(isJailed)
        if thePlayer then
        if not getElementData( thePlayer, "isJailed") then outputChatBox("This player is not in jail.",isJailed,255,0,0) return end
        setElementInterior ( thePlayer, interior_unjail )
        setElementPosition ( thePlayer, x1, y1, z1 )
		toggleControl (thePlayer, "fire", true)
		toggleControl (thePlayer, "next_weapon",true)
		toggleControl (thePlayer, "previous_weapon", true)
		toggleControl (thePlayer, "sprint", true)
		toggleControl (thePlayer, "aim_weapon", true)
		toggleControl (thePlayer, "weapon", true)
		toggleControl (thePlayer, "next_weapon", true)
		toggleControl (thePlayer, "vehicle_fire", true)
		toggleControl (thePlayer, "vehicle_secondary_fire", true)			
	    setElementData(thePlayer, "Timeleft", false)
        setElementData(thePlayer,"isJailed",false)
        setElementData(thePlayer, "Timeleft", 0)		
	    textDestroyDisplay(timeLeft[thePlayer])
        setElementData(rRoot,"".. getPlayerSerial(thePlayer).."-j",false)
        outputChatBox("** You are Now out of prison [ "..getPlayerName(thePlayer).." #FFFF00] Please respect the rule of server",source,255,255,0,true)
        outputChatBox("** [ "..getPlayerName(thePlayer).." #FFFF00]  has been out of prison ",root,255,255,0,true)
end
end)
	
addEventHandler("onPlayerSpawn",root, -- Check If He Is isJailed [ OnSpawn ]
function()
if getElementData(source,"isJailed") == true then
setElementInterior ( source, interior_jail )        
setElementPosition (source, x, y, z )
RemoveFromVeh(thePlayer)
end
end)

addEventHandler("onPlayoin",root, -- Check If He Is isJailed - By IP [ OnJoin ]
function()
if getElementData(rRoot,""..getPlayerSerial(source).."-j") == true then
setElementData(source,"isJailed",true)
setElementInterior ( source, interior_jail )        
setElementPosition (source, x, y, z )
end
end)

function showTimeLeft(player)
    timeLeft[player] = textCreateDisplay()
    textDisplayAddObserver(timeLeft[player], player)
    timeLeftText[player] = textCreateTextItem("Time Left: " .. getElementData(player, "Timeleft"), 0.45, 0.1, "high", 255, 255, 255, 255)
    textDisplayAddText(timeLeft[player], timeLeftText[player])
    setTimer(updateTimeLeft, 1000, getElementData(player, "Timeleft"), player)
end
 
function updateTimeLeft(player)
    local name = getPlayerName(player)
    setElementData(player, "Timeleft", getElementData(player, "Timeleft") - 1)
    textItemSetText(timeLeftText[player], "Time Left: " .. getElementData(player, "Timeleft"))
   
    if tonumber(getElementData(player, "Timeleft")) == 0 then
        textDestroyDisplay(timeLeft[player])
		setElementInterior ( player, interior_unjail )
		setElementPosition(player, x1, y1, z1)
        outputChatBox("** [ "..name.." #FFFF00]  has been out of prison ",root,255,255,0,true)
		setElementData(rRoot,"".. getPlayerSerial(thePlayer).."-j",false)
		setElementData (player, "isJailed",false)
		toggleControl (player, "fire", true)
		toggleControl (player, "next_weapon",true)
		toggleControl (player, "previous_weapon", true)
		toggleControl (player, "sprint", true)
		toggleControl (player, "aim_weapon", true)
		toggleControl (player, "weapon", true)
		toggleControl (player, "next_weapon", true)
		toggleControl (player, "vehicle_fire", true)
		toggleControl (player, "vehicle_secondary_fire", true)	
    end
end


addEvent( "slap", true) --- slap
addEventHandler( "slap", getRootElement(),
function ( PlayerNick )
	local toWho = getPlayerFromName ( PlayerNick )
	local name = getPlayerName ( source )
	data = 100
	if ( getElementHealth ( toWho ) > 0 ) and ( not isPedDead ( toWho ) ) then
	if ( tonumber ( data ) > getElementHealth ( toWho ) ) then setTimer ( killPed, 50, 1, toWho )
	else setElementHealth ( toWho, getElementHealth ( toWho ) - data ) end
		local x, y, z = getElementVelocity ( toWho )
		setElementVelocity ( toWho, x , y, z + 0.2 )	
		outputChatBox("".. PlayerNick .." has been slapped by " .. name ..". (100 HP)", root, 255, 0, 170, true )
	  end
end)



addEvent( "destroy", true) ----destroy car
addEventHandler( "destroy", getRootElement(),
function ( PlayerNick )
	local toWho = getPlayerFromName ( PlayerNick )
	local name = getElementData(source, "driverName") or "Unknown"
	local theVehicle = getPedOccupiedVehicle ( toWho )
		 destroyElement ( theVehicle )
		 outputChatBox("Your vehicle has been destroyed by ".. name ..".", toWho, 255, 0, 0, true )
	
end )



addEvent( "kickm", true) -- kick
addEventHandler( "kickm", getRootElement(),
function ( PlayerNick )
	local toWho = getPlayerFromName ( PlayerNick )
	local name = getPlayerName ( source )
		 kickPlayer ( toWho, source, "Please respect the laws of the server" )
		 outputChatBox("Player ".. PlayerNick .." has been kick By ".. name ..".", getRootElement(), 255, 0, 0, true )
end )

-----------------
-- on admin login trigger client to make panel
----------------


---------------
-- on start check is theree any admin
---------------

addEvent("checkPermission",true)
addEventHandler("checkPermission",root,
	function()
		for i,v in ipairs(getElementsByType"player") do
			if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(v)), aclGetGroup("Police")) then
addEventHandler( "onElementClicked",getRootElement(), masternew)
			
			else
			removeEventHandler( "onElementClicked",getRootElement(), masternew)

							    triggerClientEvent(v,"noopenpolice",v)

			end
		end
	end
)







   function masternew ( _, _, thePlayer ) 
    local account = getPlayerAccount(thePlayer)
        if getElementType( source ) == "player" or getElementType( source ) == "vehicle" then 
            triggerClientEvent ( thePlayer, "openpolice" ,thePlayer,getPlayerName(getVehicleController(source)),getPlayerName(source),getElementData(source, "driverName") or "Unknown")
        end 
     
end 







 
   
 
addEventHandler ( "onVehicleEnter", root,
	function ( player , seat )
		if seat == 0 then
			setElementData(source, "driverName", getPlayerName(player))
		end
	end
)




والكلنت

 

 

 

 

 

 

 

--***********************************--
--            By MR.S3D             --
--            Client Side            --
--***************please dont remove********************--


--------------------
--Key For Open Panel
-------------------

-----------------
-- when start check Is there any admin
----------------



----------------
--panel for admin only
----------------







local screenW, screenH = guiGetScreenSize()
mainwndmaster = guiCreateWindow(screenW - 393 - 10, (screenH - 562) / 2, 393, 562, "", false)
guiSetAlpha(mainwndmaster,0.89999997615814)
 guiSetVisible(mainwndmaster,false)

  ali1 = guiCreateLabel(24, 524, 78, 19, "Work State :", false, mainwndmaster)
        guiLabelSetColor(ali1, 250, 0, 0)
        ali2 = guiCreateLabel(121, 524, 78, 19, "Work State :2", false, mainwndmaster)
        guiLabelSetColor(ali2, 250, 0, 0)
        ali3 = guiCreateLabel(215, 524, 78, 19, "State : ", false, mainwndmaster)
        guiLabelSetColor(ali3, 250, 0, 0)
        ali4 = guiCreateLabel(303, 524, 78, 19, "Online", false, mainwndmaster)
        guiLabelSetColor(ali4, 38, 238, 11) 




wnd14 = guiCreateButton(24, 431, 349, 35, "Destroy Car", false, mainwndmaster)
   guiSetProperty(wnd14, "NormalTextColour", "FF09F2AE")
wnd11 = guiCreateButton(24, 386, 349, 35, "Slap", false, mainwndmaster)
        guiSetProperty(wnd11, "NormalTextColour", "FFFB0101")

wnd8 = guiCreateButton(24, 296, 349, 35, "Jail", false, mainwndmaster)
guiSetProperty(wnd8, "NormalTextColour", "FFFDBE01")
master = guiCreateButton(24, 476, 349, 35, "اللغة العربية", false, mainwndmaster)
guiSetProperty(master, "NormalTextColour", "FFDF1B4E")


wnd5 = guiCreateGridList(27, 39, 346, 247, false, mainwndmaster)
guiGridListSetSelectionMode(wnd5,2)

local column = guiGridListAddColumn(wnd5,"Jail Time", 0.9)


row1 = guiGridListAddRow(wnd5)
row2 = guiGridListAddRow(wnd5)
row3 = guiGridListAddRow(wnd5)
row4 = guiGridListAddRow(wnd5)
row5 = guiGridListAddRow(wnd5)
row6 = guiGridListAddRow(wnd5)


guiGridListSetItemText(wnd5,row1,column,"1 min", false, false)
guiGridListSetItemColor ( wnd5, row1, column, 0, 0, 255 )
guiGridListSetItemText(wnd5,row2,column,"2 min", false, false)
guiGridListSetItemColor ( wnd5, row2, column, 0, 0, 255 )
guiGridListSetItemText(wnd5,row3,column,"3 min", false, false)
guiGridListSetItemColor ( wnd5, row3, column, 0, 0, 255 )
guiGridListSetItemText(wnd5,row4,column,"4 min", false, false)
guiGridListSetItemColor ( wnd5, row4, column, 0, 0, 255 )
guiGridListSetItemText(wnd5,row5,column,"5 min", false, false)
guiGridListSetItemColor ( wnd5, row5, column, 0, 0, 255 )
guiGridListSetItemText(wnd5,row6,column,"1 hour", false, false)
guiGridListSetItemColor ( wnd5, row6, column, 0, 0, 255 )

wnd6 = guiCreateButton(24, 341, 349, 35, "UnJail", false, mainwndmaster)
guiSetProperty(wnd6, "NormalTextColour", "FF0CF706")


---------------------
--Key to poen panel
---------------------


bindKey ("m", "down",                            -- binds B key to toggle cursor state
        function()
		guiSetVisible(mainwndmaster,false)
		guiSetText(mainwndmaster,"" )

		triggerServerEvent ("checkPermission", getLocalPlayer())
					showCursor( not isCursorShowing() )

        end)

		
		
		
		
		addEvent("openpolice",true)
addEventHandler("openpolice",root,
	function(Target1,ownerveh1,target3)
	
	
	if not guiGetVisible(mainwndmaster, true) then
	
		guiSetVisible(mainwndmaster,true)
	guiSetText(mainwndmaster,Target1 or ownerveh1 or target3 )

	end
	end
)



addEvent("noopenpolice",true)
addEventHandler("noopenpolice",root,
	function()
		guiSetVisible(mainwndmaster,false)

	end
)
-----------------------
--add player to list
----------------------

---------------------
--close panel
---------------------



----------------------
-- Watch the player
----------------------

function spectatePlayer(player)
	if tostring(player) then
		int = getElementInterior(player) 
		dim = getElementDimension(player) 
		if int and dim then
			setCameraTarget(player)
			setElementInterior(player,int)
			setElementDimension(player,dim)
		end
	end
end

----------------------
--When client click button
---------------------

function onClickza()
	
		
	
	if source == wnd11 then -- slap
	selectedPlayerslap = guiGetText(mainwndmaster)
	if selectedPlayerslap then	
	triggerServerEvent ("slap", getLocalPlayer(), tostring(selectedPlayerslap))

	end
	elseif source == wnd14 then -- destroy
	triggerServerEvent ("destroy", getLocalPlayer(), tostring(selectedPlayerslap))	

	elseif source == wnd8 then -- jail
	
	jail = guiGridListGetItemText ( wnd5, guiGridListGetSelectedItem ( wnd5 ), 1 )
	if jail then
	triggerServerEvent ("jail", getLocalPlayer(), tostring(selectedPlayerslap), jail)

		end
	elseif source == wnd6 then -- unjail
	
	if selectedPlayerslap then	
	triggerServerEvent ("unjail", getLocalPlayer(), tostring(selectedPlayerslap))	

		end		
	end
end 
addEventHandler("onClientGUIClick",root,onClickza)

 

@3NAD

لو تعدلها وترسلها خاص اكون شاكر اخوي عناد

 

#Edit:

لو تسمحو شباب لو تقدرو تعدلوها اكون شاكر

@</Mr.Tn6eL>

@iPrestege

@3NAD

@Abdul KariM

@N3xT

@Default

Edited by Master_MTA
Link to comment

ب جانب السيرفر

احذف إيفنت 

"checkPermission"

وأكواده

وبدل الفنكشن اللي تحته ب ذا

function masternew ( _, _, thePlayer ) 
    local account = getPlayerAccount(thePlayer)
	if not isGuestAccount ( account ) then
		if isObjectInACLGroup("user."..getAccountName(account), aclGetGroup("Police")) then
			if getElementType( source ) == "player" then
				triggerClientEvent ( thePlayer, "openpolice" ,resourceRoot,getPlayerName(source))
			elseif getElementType( source ) == "vehicle" then 
				local controller = getVehicleController(source)
				triggerClientEvent ( thePlayer, "openpolice" ,resourceRoot,(controller and getPlayerName(controller)) or getElementData(source, "driverName") or "Unknown")
			end  
		end
	end
end 
addEventHandler( "onElementClicked",root, masternew)

 

--

 

جانب الكلنت

bindKey ("m", "down",
	function()
		showCursor( not isCursorShowing() )
	end
)	
			
addEvent("openpolice",true)
addEventHandler("openpolice",root,
	function(Target)
		guiSetText(mainwndmaster,Target )	
		if not guiGetVisible(mainwndmaster) then
			guiSetVisible(mainwndmaster,true)
		end
	end
)

 

Link to comment
17 minutes ago, 3NAD said:

ب جانب السيرفر

احذف إيفنت 


"checkPermission"

وأكواده

وبدل الفنكشن اللي تحته ب ذا


function masternew ( _, _, thePlayer )     local account = getPlayerAccount(thePlayer)	if not isGuestAccount ( account ) then		if isObjectInACLGroup("user."..getAccountName(account), aclGetGroup("Police")) then			if getElementType( source ) == "player" then				triggerClientEvent ( thePlayer, "openpolice" ,resourceRoot,getPlayerName(source))			elseif getElementType( source ) == "vehicle" then 				local controller = getVehicleController(source)				triggerClientEvent ( thePlayer, "openpolice" ,resourceRoot,(controller and getPlayerName(controller)) or getElementData(source, "driverName") or "Unknown")			end  		end	endend addEventHandler( "onElementClicked",root, masternew)

 

--

 

جانب الكلنت


bindKey ("m", "down",	function()		showCursor( not isCursorShowing() )	end)				addEvent("openpolice",true)addEventHandler("openpolice",root,	function(Target)		guiSetText(mainwndmaster,Target )			if not guiGetVisible(mainwndmaster) then			guiSetVisible(mainwndmaster,true)		end	end)

 

اخوي فهمت غلط علي انت

انا ما ابيه لو ظغط في اي مكان ابيه مثل لوحتك مثلا اللي بطاره

يوم يظغط على حرف m بس

واسف معليش تعبتك

@3NAD

Edited by Master_MTA
Link to comment
function masternew ( _, _, thePlayer ) 
    local account = getPlayerAccount(thePlayer)
	if not isGuestAccount ( account ) then
		if not getElementData ( thePlayer, "police_m" ) then return end
		if isObjectInACLGroup("user."..getAccountName(account), aclGetGroup("Police")) then
			if getElementType( source ) == "player" then
				triggerClientEvent ( thePlayer, "openpolice" ,resourceRoot,getPlayerName(source))
			elseif getElementType( source ) == "vehicle" then 
				local controller = getVehicleController(source)
				triggerClientEvent ( thePlayer, "openpolice" ,resourceRoot,(controller and getPlayerName(controller)) or getElementData(source, "driverName") or "Unknown")
			end  
		end
	end
end 
addEventHandler( "onElementClicked",root, masternew)

 

bindKey ("m", "down",
	function()
		local cursorValue = not isCursorShowing()
		setElementData ( localPlayer, "police_m", cursorValue )
		showCursor( cursorValue )
	end
)	

 

Link to comment
13 minutes ago, 3NAD said:

function masternew ( _, _, thePlayer )     local account = getPlayerAccount(thePlayer)	if not isGuestAccount ( account ) then		if not getElementData ( thePlayer, "police_m" ) then return end		if isObjectInACLGroup("user."..getAccountName(account), aclGetGroup("Police")) then			if getElementType( source ) == "player" then				triggerClientEvent ( thePlayer, "openpolice" ,resourceRoot,getPlayerName(source))			elseif getElementType( source ) == "vehicle" then 				local controller = getVehicleController(source)				triggerClientEvent ( thePlayer, "openpolice" ,resourceRoot,(controller and getPlayerName(controller)) or getElementData(source, "driverName") or "Unknown")			end  		end	endend addEventHandler( "onElementClicked",root, masternew)

 


bindKey ("m", "down",	function()		local cursorValue = not isCursorShowing()		setElementData ( localPlayer, "police_m", cursorValue )		showCursor( cursorValue )	end)	

 

@3NAD

مو زابط اخي

شف اخوي ذي الاكواد كامله

 

 

سيرفر

 

 

--***********************************--
--            By MR.S3D             --
--            Server Side            --
--***************please dont remove********************--

----------------------
--Coordinates in the prison and outside prison
----------------------

------ This is Coordinates where the prison

local x, y, z = 198, 162, 1003
local interior_jail = 3

-- this is Coordinates to get out of prison

local interior_unjail = 0 
local x1, y1, z1 = 780, -1327, 13

-------------------------------------------------

rRoot = getResourceRootElement(getThisResource())
local timeLeft = {}
local timeLeftText = {}

local mint = 60 -- this 1 min
local f = 120  -- this 2 min
local s3m = 180 -- this 3 min
local s4m = 240 -- this 4 min
local s5m = 300 -- this 5 min
local s1h = 3600 -- 1 hour

function RemoveFromVeh(plr)
     hisVeh = getPedOccupiedVehicle(plr)
             if hisVeh then
            removePedFromVehicle(plr)
        end
end


addEvent("jail",true) -- Jail
addEventHandler("jail",root,
function(isJailed,text)
if text == "1 min" then
		thePlayer = getPlayerFromName(isJailed)
		if getElementData( thePlayer, "isJailed") then outputChatBox("This player is already in jail.",isJailed,255,0,0) return end   
		RemoveFromVeh(thePlayer)		
	    setElementInterior ( thePlayer, interior_jail )       
		setElementPosition (thePlayer, x, y, z )
		toggleControl (thePlayer, "fire", false)
        toggleControl (thePlayer, "next_weapon", false)
        toggleControl (thePlayer, "previous_weapon", false)
        toggleControl (thePlayer, "sprint", true)
        toggleControl (thePlayer, "aim_weapon", false)
	    toggleControl (thePlayer, "weapon", false)
        toggleControl (thePlayer, "next_weapon", false)
        toggleControl (thePlayer, "vehicle_fire", false)
        toggleControl (thePlayer, "vehicle_secondary_fire", false)	
        showPlayerHudComponent (thePlayer, "ammo", false)
        showPlayerHudComponent (thePlayer, "weapon", false)	 
		setElementData(thePlayer, "Timeleft", tonumber(mint))
        showTimeLeft(thePlayer)
		setElementData(thePlayer,"isJailed",true)
		setElementData(getResourceRootElement(getThisResource()),"".. getPlayerSerial(thePlayer).."-j",true)
        outputChatBox("** You arrested [ "..getPlayerName(thePlayer).." #FFFF00]For 1 min",source,255,255,0,true)
		outputChatBox("** [ "..getPlayerName(thePlayer).." #FF0000] Player has been arrested ",root,255,0,0,true)
elseif text == "2 min" then
		thePlayer = getPlayerFromName(isJailed)
		if getElementData( thePlayer, "isJailed") then outputChatBox("This player is already in jail.",isJailed,255,0,0) return end  
		RemoveFromVeh(thePlayer)		   		
	    setElementInterior ( thePlayer, interior_jail )        
		setElementPosition (thePlayer, x, y, z )
		toggleControl (thePlayer, "fire", false)
        toggleControl (thePlayer, "next_weapon", false)
        toggleControl (thePlayer, "previous_weapon", false)
        toggleControl (thePlayer, "sprint", true)
        toggleControl (thePlayer, "aim_weapon", false)
	    toggleControl (thePlayer, "weapon", false)
        toggleControl (thePlayer, "next_weapon", false)
        toggleControl (thePlayer, "vehicle_fire", false)
        toggleControl (thePlayer, "vehicle_secondary_fire", false)	
        showPlayerHudComponent (thePlayer, "ammo", false)
        showPlayerHudComponent (thePlayer, "weapon", false)			
		setElementData(thePlayer, "Timeleft", tonumber(f))
        showTimeLeft(thePlayer)
        setElementData(thePlayer,"isJailed",true)
        setElementData(getResourceRootElement(getThisResource()),"".. getPlayerSerial(thePlayer).."-j",true)
        outputChatBox("** You arrested [ "..getPlayerName(thePlayer).." #FFFF00]For 2 min",source,255,255,0,true)
		outputChatBox("** [ "..getPlayerName(thePlayer).." #FF0000] Player has been arrested ",root,255,0,0,true)
elseif text == "3 min" then
		thePlayer = getPlayerFromName(isJailed)
		if getElementData( thePlayer, "isJailed") then outputChatBox("This player is already in jail.",isJailed,255,0,0) return end
		RemoveFromVeh(thePlayer)				
	    setElementInterior ( thePlayer, interior_jail )
        setElementPosition (thePlayer, x, y, z )
		toggleControl (thePlayer, "fire", false)
        toggleControl (thePlayer, "next_weapon", false)
        toggleControl (thePlayer, "previous_weapon", false)
        toggleControl (thePlayer, "sprint", true)
        toggleControl (thePlayer, "aim_weapon", false)
	    toggleControl (thePlayer, "weapon", false)
        toggleControl (thePlayer, "next_weapon", false)
        toggleControl (thePlayer, "vehicle_fire", false)
        toggleControl (thePlayer, "vehicle_secondary_fire", false)	
        showPlayerHudComponent (thePlayer, "ammo", false)
        showPlayerHudComponent (thePlayer, "weapon", false)			
        setElementData(thePlayer,"isJailed",true)
	    setElementData(thePlayer, "Timeleft", tonumber(s3m))
        showTimeLeft(thePlayer)
        setElementData(getResourceRootElement(getThisResource()),"".. getPlayerSerial(thePlayer).."-j",true)
        outputChatBox("** You arrested [ "..getPlayerName(thePlayer).." #FFFF00]For 3 min",source,255,255,0,true)
		outputChatBox("** [ "..getPlayerName(thePlayer).." #FF0000] Player has been arrested ",root,255,0,0,true)
elseif text == "4 min" then
		thePlayer = getPlayerFromName(isJailed)
		if getElementData( thePlayer, "isJailed") then outputChatBox("This player is already in jail.",isJailed,255,0,0) return end   
		RemoveFromVeh(thePlayer)		  		
	    setElementInterior ( thePlayer, interior_jail )        
        setElementPosition (thePlayer, x, y, z )
		toggleControl (thePlayer, "fire", false)
        toggleControl (thePlayer, "next_weapon", false)
        toggleControl (thePlayer, "previous_weapon", false)
        toggleControl (thePlayer, "sprint", true)
        toggleControl (thePlayer, "aim_weapon", false)
	    toggleControl (thePlayer, "weapon", false)
        toggleControl (thePlayer, "next_weapon", false)
        toggleControl (thePlayer, "vehicle_fire", false)
        toggleControl (thePlayer, "vehicle_secondary_fire", false)	
        showPlayerHudComponent (thePlayer, "ammo", false)
        showPlayerHudComponent (thePlayer, "weapon", false)			
        setElementData(thePlayer,"isJailed",true)
	    setElementData(thePlayer, "Timeleft", tonumber(s4m))
        showTimeLeft(thePlayer)
        setElementData(getResourceRootElement(getThisResource()),"".. getPlayerSerial(thePlayer).."-j",true)
        outputChatBox("** You arrested [ "..getPlayerName(thePlayer).." #FFFF00]For 4 min",source,255,255,0,true)
		outputChatBox("** [ "..getPlayerName(thePlayer).." #FF0000] Player has been arrested ",root,255,0,0,true)
elseif text == "5 min" then
		thePlayer = getPlayerFromName(isJailed)
		if getElementData( thePlayer, "isJailed") then outputChatBox("This player is already in jail.",isJailed,255,0,0) return end  
		RemoveFromVeh(thePlayer)		   		
	    setElementInterior ( thePlayer, interior_jail )        
		setElementPosition (thePlayer, x, y, z )
		toggleControl (thePlayer, "fire", false)
        toggleControl (thePlayer, "next_weapon", false)
        toggleControl (thePlayer, "previous_weapon", false)
        toggleControl (thePlayer, "sprint", true)
        toggleControl (thePlayer, "aim_weapon", false)
	    toggleControl (thePlayer, "weapon", false)
        toggleControl (thePlayer, "next_weapon", false)
        toggleControl (thePlayer, "vehicle_fire", false)
        toggleControl (thePlayer, "vehicle_secondary_fire", false)	
        showPlayerHudComponent (thePlayer, "ammo", false)
        showPlayerHudComponent (thePlayer, "weapon", false)			
        setElementData(thePlayer,"isJailed",true)
	    setElementData(thePlayer, "Timeleft", tonumber(s5m))
        showTimeLeft(thePlayer)
        setElementData(getResourceRootElement(getThisResource()),"".. getPlayerSerial(thePlayer).."-j",true)
        outputChatBox("** You arrested [ "..getPlayerName(thePlayer).." #FFFF00]For 5 min",source,255,255,0,true)
		outputChatBox("** [ "..getPlayerName(thePlayer).." #FF0000] Player has been arrested ",root,255,0,0,true)
elseif text == "1 hour" then
		thePlayer = getPlayerFromName(isJailed)
		if getElementData( thePlayer, "isJailed") then outputChatBox("This player is already in jail.",isJailed,255,0,0) return end 
		RemoveFromVeh(thePlayer)				
	    setElementInterior ( thePlayer, interior_jail )        
		setElementPosition (thePlayer, x, y, z )
		toggleControl (thePlayer, "fire", false)
        toggleControl (thePlayer, "next_weapon", false)
        toggleControl (thePlayer, "previous_weapon", false)
        toggleControl (thePlayer, "sprint", true)
        toggleControl (thePlayer, "aim_weapon", false)
	    toggleControl (thePlayer, "weapon", false)
        toggleControl (thePlayer, "next_weapon", false)
        toggleControl (thePlayer, "vehicle_fire", false)
        toggleControl (thePlayer, "vehicle_secondary_fire", false)	
        showPlayerHudComponent (thePlayer, "ammo", false)
        showPlayerHudComponent (thePlayer, "weapon", false)			
        setElementData(thePlayer,"isJailed",true)
	    setElementData(thePlayer, "Timeleft", tonumber(s1h))
        showTimeLeft(thePlayer)
        setElementData(getResourceRootElement(getThisResource()),"".. getPlayerSerial(thePlayer).."-j",true)
        outputChatBox("** You arrested [ "..getPlayerName(thePlayer).." #FFFF00]For 1 hour",source,255,255,0,true)
		outputChatBox("** [ "..getPlayerName(thePlayer).." #FF0000] Player has been arrested ",root,255,0,0,true)
	end
end	)

addEvent("unjail",true)-- unJail
addEventHandler("unjail",root,
function(isJailed)
	thePlayer = getPlayerFromName(isJailed)
        if thePlayer then
        if not getElementData( thePlayer, "isJailed") then outputChatBox("This player is not in jail.",isJailed,255,0,0) return end
        setElementInterior ( thePlayer, interior_unjail )
        setElementPosition ( thePlayer, x1, y1, z1 )
		toggleControl (thePlayer, "fire", true)
		toggleControl (thePlayer, "next_weapon",true)
		toggleControl (thePlayer, "previous_weapon", true)
		toggleControl (thePlayer, "sprint", true)
		toggleControl (thePlayer, "aim_weapon", true)
		toggleControl (thePlayer, "weapon", true)
		toggleControl (thePlayer, "next_weapon", true)
		toggleControl (thePlayer, "vehicle_fire", true)
		toggleControl (thePlayer, "vehicle_secondary_fire", true)			
	    setElementData(thePlayer, "Timeleft", false)
        setElementData(thePlayer,"isJailed",false)
        setElementData(thePlayer, "Timeleft", 0)		
	    textDestroyDisplay(timeLeft[thePlayer])
        setElementData(rRoot,"".. getPlayerSerial(thePlayer).."-j",false)
        outputChatBox("** You are Now out of prison [ "..getPlayerName(thePlayer).." #FFFF00] Please respect the rule of server",source,255,255,0,true)
        outputChatBox("** [ "..getPlayerName(thePlayer).." #FFFF00]  has been out of prison ",root,255,255,0,true)
end
end)
	
addEventHandler("onPlayerSpawn",root, -- Check If He Is isJailed [ OnSpawn ]
function()
if getElementData(source,"isJailed") == true then
setElementInterior ( source, interior_jail )        
setElementPosition (source, x, y, z )
RemoveFromVeh(thePlayer)
end
end)

addEventHandler("onPlayoin",root, -- Check If He Is isJailed - By IP [ OnJoin ]
function()
if getElementData(rRoot,""..getPlayerSerial(source).."-j") == true then
setElementData(source,"isJailed",true)
setElementInterior ( source, interior_jail )        
setElementPosition (source, x, y, z )
end
end)

function showTimeLeft(player)
    timeLeft[player] = textCreateDisplay()
    textDisplayAddObserver(timeLeft[player], player)
    timeLeftText[player] = textCreateTextItem("Time Left: " .. getElementData(player, "Timeleft"), 0.45, 0.1, "high", 255, 255, 255, 255)
    textDisplayAddText(timeLeft[player], timeLeftText[player])
    setTimer(updateTimeLeft, 1000, getElementData(player, "Timeleft"), player)
end
 
function updateTimeLeft(player)
    local name = getPlayerName(player)
    setElementData(player, "Timeleft", getElementData(player, "Timeleft") - 1)
    textItemSetText(timeLeftText[player], "Time Left: " .. getElementData(player, "Timeleft"))
   
    if tonumber(getElementData(player, "Timeleft")) == 0 then
        textDestroyDisplay(timeLeft[player])
		setElementInterior ( player, interior_unjail )
		setElementPosition(player, x1, y1, z1)
        outputChatBox("** [ "..name.." #FFFF00]  has been out of prison ",root,255,255,0,true)
		setElementData(rRoot,"".. getPlayerSerial(thePlayer).."-j",false)
		setElementData (player, "isJailed",false)
		toggleControl (player, "fire", true)
		toggleControl (player, "next_weapon",true)
		toggleControl (player, "previous_weapon", true)
		toggleControl (player, "sprint", true)
		toggleControl (player, "aim_weapon", true)
		toggleControl (player, "weapon", true)
		toggleControl (player, "next_weapon", true)
		toggleControl (player, "vehicle_fire", true)
		toggleControl (player, "vehicle_secondary_fire", true)	
    end
end


addEvent( "slap", true) --- slap
addEventHandler( "slap", getRootElement(),
function ( PlayerNick )
	local toWho = getPlayerFromName ( PlayerNick )
	local name = getPlayerName ( source )
	data = 100
	if ( getElementHealth ( toWho ) > 0 ) and ( not isPedDead ( toWho ) ) then
	if ( tonumber ( data ) > getElementHealth ( toWho ) ) then setTimer ( killPed, 50, 1, toWho )
	else setElementHealth ( toWho, getElementHealth ( toWho ) - data ) end
		local x, y, z = getElementVelocity ( toWho )
		setElementVelocity ( toWho, x , y, z + 0.2 )	
		outputChatBox("".. PlayerNick .." has been slapped by " .. name ..". (100 HP)", root, 255, 0, 170, true )
	  end
end)



addEvent( "destroy", true) ----destroy car
addEventHandler( "destroy", getRootElement(),
function ( PlayerNick,veh )
	local name = getPlayerName(source)
	local theVehicle = getElementData(PlayerNick, "driverName") or "Unknown" 
		 destroyElement ( getElementData("driverName12"),veh )
		 outputChatBox("Your vehicle has been destroyed by ".. name ..".", PlayerNick, 255, 0, 0, true )
	
end )



addEvent( "kickm", true) -- kick
addEventHandler( "kickm", getRootElement(),
function ( PlayerNick )
	local toWho = getPlayerFromName ( PlayerNick )
	local name = getPlayerName ( source )
		 kickPlayer ( toWho, source, "Please respect the laws of the server" )
		 outputChatBox("Player ".. PlayerNick .." has been kick By ".. name ..".", getRootElement(), 255, 0, 0, true )
end )

-----------------
-- on admin login trigger client to make panel
----------------


---------------
-- on start check is theree any admin
---------------

addEvent("checkPermission",true)
addEventHandler("checkPermission",root,
	function()
		for i,v in ipairs(getElementsByType"player") do
			if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(v)), aclGetGroup("Police")) then
addEventHandler( "onElementClicked",getRootElement(), masternew)
			
			else
			removeEventHandler( "onElementClicked",getRootElement(), masternew)

							    triggerClientEvent(v,"noopenpolice",v)

			end
		end
	end
)







   function masternew ( _, _, thePlayer ) 
    local account = getPlayerAccount(thePlayer)
        if getElementType( source ) == "player" or getElementType( source ) == "vehicle" then 
            triggerClientEvent ( thePlayer, "openpolice" ,thePlayer,getPlayerName(getVehicleController(source)),getPlayerName(source),getElementData(source, "driverName") or "Unknown")
        end 
     
end 







 
   
 
addEventHandler ( "onVehicleEnter", root,
	function ( player , seat )
		if seat == 0 then
			setElementData(source, "driverName", getPlayerName(player))
		end
	end
)



addEventHandler ( "onVehicleExit", root,
	function ( veh , seat )
		if seat == 0 then
			setElementData(source, "driverName12", veh)
		end
	end
)


طيب

 

وهذ الكلنت سايد

 

 

 

--***********************************--
--            By MR.S3D             --
--            Client Side            --
--***************please dont remove********************--


--------------------
--Key For Open Panel
-------------------

-----------------
-- when start check Is there any admin
----------------



----------------
--panel for admin only
----------------







local screenW, screenH = guiGetScreenSize()
mainwndmaster = guiCreateWindow(screenW - 393 - 10, (screenH - 562) / 2, 393, 562, "", false)
guiSetAlpha(mainwndmaster,0.89999997615814)
 guiSetVisible(mainwndmaster,false)

  ali1 = guiCreateLabel(24, 524, 78, 19, "Work State :", false, mainwndmaster)
        guiLabelSetColor(ali1, 250, 0, 0)
        ali2 = guiCreateLabel(121, 524, 78, 19, "Work State :2", false, mainwndmaster)
        guiLabelSetColor(ali2, 250, 0, 0)
        ali3 = guiCreateLabel(215, 524, 78, 19, "State : ", false, mainwndmaster)
        guiLabelSetColor(ali3, 250, 0, 0)
        ali4 = guiCreateLabel(303, 524, 78, 19, "Online", false, mainwndmaster)
        guiLabelSetColor(ali4, 38, 238, 11) 




wnd14 = guiCreateButton(24, 431, 349, 35, "Destroy Car", false, mainwndmaster)
   guiSetProperty(wnd14, "NormalTextColour", "FF09F2AE")
wnd11 = guiCreateButton(24, 386, 349, 35, "Slap", false, mainwndmaster)
        guiSetProperty(wnd11, "NormalTextColour", "FFFB0101")

wnd8 = guiCreateButton(24, 296, 349, 35, "Jail", false, mainwndmaster)
guiSetProperty(wnd8, "NormalTextColour", "FFFDBE01")
master = guiCreateButton(24, 476, 349, 35, "اللغة العربية", false, mainwndmaster)
guiSetProperty(master, "NormalTextColour", "FFDF1B4E")


wnd5 = guiCreateGridList(27, 39, 346, 247, false, mainwndmaster)
guiGridListSetSelectionMode(wnd5,2)

local column = guiGridListAddColumn(wnd5,"Jail Time", 0.9)


row1 = guiGridListAddRow(wnd5)
row2 = guiGridListAddRow(wnd5)
row3 = guiGridListAddRow(wnd5)
row4 = guiGridListAddRow(wnd5)
row5 = guiGridListAddRow(wnd5)
row6 = guiGridListAddRow(wnd5)


guiGridListSetItemText(wnd5,row1,column,"1 min", false, false)
guiGridListSetItemColor ( wnd5, row1, column, 0, 0, 255 )
guiGridListSetItemText(wnd5,row2,column,"2 min", false, false)
guiGridListSetItemColor ( wnd5, row2, column, 0, 0, 255 )
guiGridListSetItemText(wnd5,row3,column,"3 min", false, false)
guiGridListSetItemColor ( wnd5, row3, column, 0, 0, 255 )
guiGridListSetItemText(wnd5,row4,column,"4 min", false, false)
guiGridListSetItemColor ( wnd5, row4, column, 0, 0, 255 )
guiGridListSetItemText(wnd5,row5,column,"5 min", false, false)
guiGridListSetItemColor ( wnd5, row5, column, 0, 0, 255 )
guiGridListSetItemText(wnd5,row6,column,"1 hour", false, false)
guiGridListSetItemColor ( wnd5, row6, column, 0, 0, 255 )

wnd6 = guiCreateButton(24, 341, 349, 35, "UnJail", false, mainwndmaster)
guiSetProperty(wnd6, "NormalTextColour", "FF0CF706")


---------------------
--Key to poen panel
---------------------


bindKey ("m", "down",                            -- binds B key to toggle cursor state
        function()
		guiSetVisible(mainwndmaster,false)
		guiSetText(mainwndmaster,"" )

		triggerServerEvent ("checkPermission", getLocalPlayer())
					showCursor( not isCursorShowing() )

        end)

		
		
		
		
		addEvent("openpolice",true)
addEventHandler("openpolice",root,
	function(Target1,ownerveh1,target3)
	
	
	if not guiGetVisible(mainwndmaster, true) then
	
		guiSetVisible(mainwndmaster,true)
	guiSetText(mainwndmaster,Target1 or ownerveh1 or target3 )

	end
	end
)



addEvent("noopenpolice",true)
addEventHandler("noopenpolice",root,
	function()
		guiSetVisible(mainwndmaster,false)

	end
)
-----------------------
--add player to list
----------------------

---------------------
--close panel
---------------------



----------------------
-- Watch the player
----------------------

function spectatePlayer(player)
	if tostring(player) then
		int = getElementInterior(player) 
		dim = getElementDimension(player) 
		if int and dim then
			setCameraTarget(player)
			setElementInterior(player,int)
			setElementDimension(player,dim)
		end
	end
end

----------------------
--When client click button
---------------------

function onClickza()
	
		
	
	if source == wnd11 then -- slap
	selectedPlayerslap = guiGetText(mainwndmaster)
	if selectedPlayerslap then	
	triggerServerEvent ("slap", getLocalPlayer(), tostring(selectedPlayerslap))

	end
	elseif source == wnd14 then -- destroy
	triggerServerEvent ("destroy", getLocalPlayer(), tostring(selectedPlayerslap))	

	elseif source == wnd8 then -- jail
	
	jail = guiGridListGetItemText ( wnd5, guiGridListGetSelectedItem ( wnd5 ), 1 )
	if jail then
	triggerServerEvent ("jail", getLocalPlayer(), tostring(selectedPlayerslap), jail)

		end
	elseif source == wnd6 then -- unjail
	
	if selectedPlayerslap then	
	triggerServerEvent ("unjail", getLocalPlayer(), tostring(selectedPlayerslap))	

		end		
	end
end 
addEventHandler("onClientGUIClick",root,onClickza)

 

 

طيب وش المشاكل اللي عندي المشاكل اللي عندي هي

 

1- ان اللوحه تفتح وسليمه وكل شي بس اذا كنت لوحدي في السيرفر اذا دخل شخص اخر ما تفتح

2- ان لو دست على سياره فاضيه يجيب اخر مستخدم ليها ويحطه باللوحه من فوق مزبوط بس لما اجي اسوي ديستروي للالمنت ما اعرف وش اسوي

فيحتاج حق الدستروي بجانب السيرفر تعديل

ديستروي = سحب سياره

المهم اخوي التحقق من الصلاحيات لازم ولازم اضيف فيه الايفينت لان لو ما سويت كذا

بيصير

لما يضغط اف 1

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

اتمنى تكون فهمت مشكلتي

@3NAD

Edited by Master_MTA
Link to comment
1 hour ago, N3xT said:

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

هههههههه يعطيكك العافيه حليتها بس النقطه الثانيه ما عرفت

طبعا الحل

زي ما قال

الاخ عناد بس انا كنت مسوي شي غلط

وعدلت على كود

m

شوي تعديل بسيط


    bindKey ("m", "down",
    	function()
    		local cursorValue = not isCursorShowing()
			if not guiGetVisible(mainwndmaster, true) then
    		setElementData ( localPlayer, "police_m", cursorValue )
			
    		showCursor( cursorValue )
			else
			guiSetVisible(mainwndmaster,false)
			guiSetText(mainwndmaster,"")
			    		showCursor( false )

end
			end
    )	

	

@N3xT

 

1 hour ago, Master_MTA said:

هههههههه يعطيكك العافيه حليتها بس النقطه الثانيه ما عرفت

طبعا الحل

زي ما قال

الاخ عناد بس انا كنت مسوي شي غلط

وعدلت على كود

m

شوي تعديل بسيط


    bindKey ("m", "down",    	function()    		local cursorValue = not isCursorShowing()			if not guiGetVisible(mainwndmaster, true) then    		setElementData ( localPlayer, "police_m", cursorValue )			    		showCursor( cursorValue )			else			guiSetVisible(mainwndmaster,false)			guiSetText(mainwndmaster,"")			    		showCursor( false )end			end    )		

@N3xT

وفي تعديل على السيرفر ايضا

 



    function masternew ( _, _, thePlayer ) 
        local account = getPlayerAccount(thePlayer)
    	if not isGuestAccount ( account ) then
    		if not getElementData ( thePlayer, "police_m" ) then return end
    		if isObjectInACLGroup("user."..getAccountName(account), aclGetGroup("Police")) then
    			if getElementType( source ) == "player" then
    				triggerClientEvent ( thePlayer, "openpolice" ,resourceRoot,getPlayerName(source))
					    			 removeElementData(thePlayer,"police_m")

    			elseif getElementType( source ) == "vehicle" then 

    				local controller = getVehicleController(source)
    				triggerClientEvent ( thePlayer, "openpolice" ,resourceRoot,(controller and getPlayerName(controller)) or getElementData(source, "driverName") or "Unknown")
    			 removeElementData(thePlayer,"police_m")
				end  
    		end
			
    	end
    end 
    addEventHandler( "onElementClicked",root, masternew)

@</Mr.Tn6eL>

 

#Edit

 

يعني المشكله عندي هنا

سيرفر سايد

 

addEvent( "destroy", true) ----destroy car
addEventHandler( "destroy", getRootElement(),
function ( PlayerNick,veh )
	local name = getPlayerName(source)
	local theVehicle = getElementData(PlayerNick, "driverName") or "Unknown" 
		 destroyElement ( getElementData("driverName12"),veh )
		 outputChatBox("Your vehicle has been destroyed by ".. name ..".", PlayerNick, 255, 0, 0, true )
	
end )

 

 

والكلنت سايد

 

 

function onClickza()
	
		
	
	if source == wnd11 then -- slap
	selectedPlayerslap = guiGetText(mainwndmaster)
	if selectedPlayerslap then	
	triggerServerEvent ("slap", getLocalPlayer(), tostring(selectedPlayerslap))

	end
	elseif source == wnd14 then -- destroy
	triggerServerEvent ("destroy", getLocalPlayer(), tostring(selectedPlayerslap))	

	elseif source == wnd8 then -- jail
	
	jail = guiGridListGetItemText ( wnd5, guiGridListGetSelectedItem ( wnd5 ), 1 )
	if jail then
	triggerServerEvent ("jail", getLocalPlayer(), tostring(selectedPlayerslap), jail)

		end
	elseif source == wnd6 then -- unjail
	
	if selectedPlayerslap then	
	triggerServerEvent ("unjail", getLocalPlayer(), tostring(selectedPlayerslap))	

		end		
	end
end 
addEventHandler("onClientGUIClick",root,onClickza)

 

Edited by Master_MTA
Link to comment
1 minute ago, iPrestege said:

وش مشكلتك كاملة واطرح الاكواد اللي فيها المشكلة بشكل مفصل لانك عافس الاكواد

ابشر تفضل

اولا هذي مزبوطه

الحدث حق الضغط

مافيه اي مشكله

function masternew ( _, _, thePlayer ,veh) 
        local account = getPlayerAccount(thePlayer)
    	if not isGuestAccount ( account ) then
    		if not getElementData ( thePlayer, "police_m" ) then return end
    		if isObjectInACLGroup("user."..getAccountName(account), aclGetGroup("Police")) then
    			if getElementType( source ) == "player" then
    				triggerClientEvent ( thePlayer, "openpolice" ,resourceRoot,getPlayerName(source))
					    			 removeElementData(thePlayer,"police_m")

    			elseif getElementType( source ) == "vehicle" then 
			setElementData(source, "driverName123")

    				local controller = getVehicleController(source)
    				triggerClientEvent ( thePlayer, "openpolice" ,resourceRoot,(controller and getPlayerName(controller)) or getElementData(source, "driverName") or "Unknown")
    			 removeElementData(thePlayer,"police_m")
				end  
    		end
			
    	end
    end 
    addEventHandler( "onElementClicked",root, masternew)

 

 

 

ثانيا

الحدث حق لما يضغط على زررر طيب

 

 

كلنت سايد طبعا

 

	elseif source == wnd14 then -- destroy
	triggerServerEvent ("destroy", getLocalPlayer(), guiGetText(mainwndmaster))	

------------ذا حق الزر
------------- وهذا عشان تفهمني بشكل افضل

	addEvent("openpolice",true)
addEventHandler("openpolice",root,
	function(Target1,ownerveh1,target3)
	
	
	if not guiGetVisible(mainwndmaster, true) then
	
		guiSetVisible(mainwndmaster,true)
	guiSetText(mainwndmaster,Target1 or ownerveh1 or target3 )

	end
	end
)
-------------اللي يستقبل الحدث لما يظغط

طيب

 

نرجع للمشكله اللي هي

 

في سيرفر سايد

 

 

addEvent( "destroy", true) ----destroy car
addEventHandler( "destroy", getRootElement(),
function ( PlayerNick,veh )
	local name = getPlayerName(source)
	local theVehicle = getVehicleFromeName(getElementData(veh, "driverName12"))
		 destroyElement (getVehicleName(getElementData(veh, "driverName123")))
		 outputChatBox("Your vehicle has been destroyed by ".. name ..".", PlayerNick, 255, 0, 0, true )
	
end )

وبس

ابيه يسحب السياره لما يضغط الزر

 

Link to comment
	triggerServerEvent ("destroy", getLocalPlayer(), guiGetText(mainwndmaster))	

 

هنا انت مرسل فقط قيمة وحده وهي

 

mainwndmaster الكلام اللي في 

 

هذي ايديت؟

 

+ كيف تستقبل بالسيرفر قيمتين وانت مرسل وحده اصلاً ؟

 

getVehicleFromName هذي ويش؟ اذا تبي تسحب سيارهـ لاعب تاكد استخدم

 

getPedOccupiedVehicle

 

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