Jump to content

طلب فنكشن


Recommended Posts

السلام عليكم

ابي فنكشن وقت يضغط الاعب على الزر تموت الشخصيه التي له

كودي

  
GUIEditor = { 
    button = {}, 
    label = {} 
} 
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        GUIEditor.button[1] = guiCreateButton(527, 365, 133, 45, "armor", false) 
        guiSetAlpha(GUIEditor.button[1], 0.83) 
  
  
        GUIEditor.button[2] = guiCreateButton(311, 365, 133, 45, "Healt ", false) 
        guiSetAlpha(GUIEditor.button[2], 0.86) 
  
  
        GUIEditor.button[3] = guiCreateButton(120, 365, 133, 45, "Dead", false) 
        guiSetAlpha(GUIEditor.button[3], 0.88) 
  
  
        GUIEditor.button[4] = guiCreateButton(309, 235, 133, 45, "Car infernus ", false) 
        guiSetAlpha(GUIEditor.button[4], 0.88) 
  
  
        GUIEditor.button[5] = guiCreateButton(120, 235, 133, 45, "Nrg-500", false) 
        guiSetAlpha(GUIEditor.button[5], 0.88) 
  
  
        GUIEditor.button[6] = guiCreateButton(527, 235, 133, 45, "Bullet", false) 
        guiSetAlpha(GUIEditor.button[6], 0.88) 
  
  
        GUIEditor.label[2] = guiCreateLabel(548, 428, 427, 21, "Skype : Z3im-Mt2sm", false) 
  
        GUIEditor.label[3] = guiCreateLabel(433, 1, 110, 20, "", false, GUIEditor.label[2]) 
  
  
        GUIEditor.label[4] = guiCreateLabel(140, 107, 113, 17, "Name :",.. getPlayerName,false) 
  
  
        GUIEditor.label[5] = guiCreateLabel(140, 149, 113, 17, "Serial :".. getPlayerSerial, false) 
  
  
        GUIEditor.label[6] = guiCreateLabel(140, 191, 113, 17, "IP :" .. getPlayerIP, false) 
  
  
        GUIEditor.label[7] = guiCreateLabel(293, 82, 427, 21, "Panel Player V1.1 By Hassan", false)     
    end 
) 
  
addEventHandler("onClientRender", root, 
    function() 
        dxDrawImage(93, 68, 595, 391, "/image/progress.png, 0, tocolor(255, 255, 255, 255), false) 
    end 
) 
addEventHandler ("onClientGUIClick", getRootElement(), 
function() 
if ( source == GUIEditor.button[1] ) then 
setPedArmor ( player, 100 ) 
outputChatBox(("You Now Have Armor Player  " .. getPlayerName ) 
    end 
 end  
) 
----------------------------------------- 
addEventHandler ("onClientGUIClick", getRootElement(), 
function() 
if ( source == GUIEditor.button[2] ) then 
 setElementHealth ( player, 100 ) 
 outputChatBox(("You Now Have Healt Player  " .. getPlayerName ) 
     end 
 end  
) 
---------------------------------------------------------- 
addEventHandler ("onClientGUIClick", getRootElement(), 
function() 
if ( source == GUIEditor.button[3] ) then 
   end 
end 
----------------------------------------------- 
addEventHandler ("onClientGUIClick", getRootElement(), 
function() 
if ( source == GUIEditor.button[4] ) then 
x, y, z = getElementPosition(source) 
local theVehicle = createVehicle(411, x, y, z) 
 warpPedIntoVehicle(source, theVehicle) 
  outputChatBox(("You Now Have Car infernus Player:  " .. getPlayerName ) 
    end 
 end 
 ) 
 -------------------------------------------- 
 addEventHandler ("onClientGUIClick", getRootElement(), 
function() 
if ( source == GUIEditor.button[5] ) then 
x, y, z = getElementPosition(source) 
local theVehicle = createVehicle(522, x, y, z) 
 warpPedIntoVehicle(source, theVehicle) 
  outputChatBox(("You Now Have bike Nrg-500 Player:  " .. getPlayerName ) 
      end 
 end 
 ) 
 ----------------------------------------------------------- 
  addEventHandler ("onClientGUIClick", getRootElement(), 
function() 
if ( source == GUIEditor.button[6] ) then 
x, y, z = getElementPosition(source) 
local theVehicle = createVehicle(541, x, y, z) 
 warpPedIntoVehicle(source, theVehicle) 
  outputChatBox(("You Now Have Car Bullet Player:  " .. getPlayerName ) 
      end 
 end 
 ) 
  
  
  
  
  
  
  
 

بس انا ابي كمان كيف اعمل زر للكود

ولازم للكود لي معي سيرفر ولا؟

Link to comment
--Client Side  
addEventHandler ( "onClientGUIClick", root, 
function (  ) 
if source == GUIEditor.button[1] then 
triggerServerEvent("kill",getLocalPlayer())  
end 
end 
) 

  
--Server Side 
addEvent("kill", true) 
addEventHandler("kill", root, 
 function  (  ) 
  killPed ( client ) 
end 
) 

وكودكـ معفوس كيف تحط سيرفر مع كلنت ؟ :wink:

Link to comment

ناقصكـ اقواس كثيرهـ وبعض الفنكشنات سيرفر دامجها مع كلنت ^

triggerServerEvent معرف اعمله قلي وين احطه وشو اعمل

+

ابي فنكشن وقت يضغط الاعب على الزر تموت الشخصيه التي له

بضرب لك مثال كيف تسوي ترايقر لـ زر وفي نفس الوقت طلبك

حط الترايقر تحت الزر مثلا

#Client

addEventHandler ( "onClientGUIClick", root, function (    ) 
    if ( source == اسم الزر ) then 
    triggerServerEvent ( "_killPlayer", localPlayer ) -- هنا 
    end 
end ) 

#Server

addEvent ( "_killPlayer", true ) 
addEventHandler("_killPlayer", root, function  (    ) 
    killPed ( source, source ) 
end ) 

ملاحظه : الفنكشنات الي لونها ازرق يعني تصلح كلنت وسيرفر

والفنكشنات الي لونها احمر حقت كلنت بس

والفنشكنات الي لونها اصفر حقت سيرفر بس

وعشان اوضح لك اكثر سوينا ترايقر لان فنكشن

killPed 

سيرفر اصلاً ولونه اصفر :mrgreen:

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