Jump to content

مساعده


Recommended Posts

السلام عليكم

المود عباره عن Car Spawner

وهو عندما يدخل الاعب الي الماركر و يضغط علي "Sanchez" ثم تعطيه اياها

meta.xml

  
  

Client

marker1 = createMarker(1543.01550,-1719.50916,12.55456,"cylinder",3,255,255,255) 
function spawn() 
  
      
GUIEditor = { 
    button = {}, 
    window = {} 
} 
  
        GUIEditor.window[1] = guiCreateWindow(238, 130, 492, 333, "INRU Spawner", false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
        GUIEditor.button[2] = guiCreateButton(386, 24, 96, 55, "Close", false, GUIEditor.window[1]) 
  
        GUIEditor.button[1] = guiCreateButton(9, 22, 103, 50, "Sanchez", false, GUIEditor.window[1]) 
            
        showCursor ( true )   
  
end 
addEventHandler("onClientMarkerHit",getRootElement(),spawn) 
  
  
  
addEventHandler("onClientGUIClick",root, 
function ( ) 
if ( source == GUIEditor.button[2]) then 
        guiSetVisible(GUIEditor.window[1],false) 
            showCursor(false) 
                guiSetInputEnabled(false) 
end 
end) 
  
addEventHandler("onClientGUIClick",root, 
function ( thePlayer ) 
if ( source == GUIEditor.button[1]) then 
        guiSetVisible(GUIEditor.window[1],false) 
            showCursor(false) 
             
                guiSetInputEnabled(false) 
                 
                 
triggerServerEvent ( "onClientGUIClick",  resourceRoot, thePlayer )  
end 
end) 

Server

function GUI(thePlayer) 
  
local luckyBugger = getLocalPlayer() 
      local x, y, z = getElementPosition ( luckyBugger )  
  
    veh = createVehicle ( 468, x, y, z + 10 ) 
     
    end 
    addEvent ("onClientGUIClick",true) 
    addEventHandler( "onClientGUIClick", resourceRoot, getLocalPlayer ) 

Link to comment

عليكم السلام

اكوادك ملخبطه صراحة لاكن جرب

Client :

marker1 = createMarker(1543.01550,-1719.50916,12.55456,"cylinder",3,255,255,255) 
  
      
GUIEditor = { 
    button = {}, 
    window = {} 
} 
  
        GUIEditor.window[1] = guiCreateWindow(238, 130, 492, 333, "INRU Spawner", false) 
        guiWindowSetSizable( GUIEditor.window[1] , false ) 
        guiSetVisible ( GUIEditor.window[1] , false ) 
        GUIEditor.button[2] = guiCreateButton(386, 24, 96, 55, "Close", false, GUIEditor.window[1]) 
  
        GUIEditor.button[1] = guiCreateButton(9, 22, 103, 50, "Sanchez", false, GUIEditor.window[1]) 
          
  
addEventHandler("onClientMarkerHit", marker1 , 
  
    function ( player_ ) 
      
    if ( player_ == getLocalPlayer (    ) ) then 
  
    guiSetVisible ( GUIEditor.window[1] , true ) 
  
    showCursor( true ) 
  
    guiSetInputEnabled ( true ) 
  
        end 
    end 
    ) ; 
  
addEventHandler("onClientGUIClick", getRootElement (    ) , 
  
    function ( ) 
  
    if ( source == GUIEditor.button[2] ) then 
  
    guiSetVisible ( GUIEditor.window[1] , false ) 
  
    showCursor( false ) 
  
    guiSetInputEnabled ( false ) 
  
    elseif ( source == GUIEditor.button[1] ) then 
  
    guiSetVisible ( GUIEditor.window[1] , false ) 
  
    showCursor( false ) 
  
    guiSetInputEnabled ( false ) 
        
    triggerServerEvent ( "CreateVehicle_" , getLocalPlayer (    ) )  
  
        end 
    end 
    ) ; 

Server :

local table = { } 
  
addEvent ( "CreateVehicle_" , true ) 
  
addEventHandler ( "CreateVehicle_" , getRootElement (   ) ,  
  
    function (  ) 
  
    if isElement ( table [ source ] ) then  
     
    destroyElement ( table [ source ] )  
  
   table [ source ] = nil 
    
    end 
      
    local x , y , z = getElementPosition ( source ) 
      
    table [ source ] = createVehicle ( 468, x, y, z + 10 ) 
        
        end 
    ) ; 
Edited by Guest
Link to comment
عليكم السلام

اكوادك ملخبطه صراحة لاكن جرب

Client :

marker1 = createMarker(1543.01550,-1719.50916,12.55456,"cylinder",3,255,255,255) 
  
      
GUIEditor = { 
    button = {}, 
    window = {} 
} 
  
        GUIEditor.window[1] = guiCreateWindow(238, 130, 492, 333, "INRU Spawner", false) 
        guiWindowSetSizable( GUIEditor.window[1] , false ) 
        guiSetVisible ( GUIEditor.window[1] , false ) 
        GUIEditor.button[2] = guiCreateButton(386, 24, 96, 55, "Close", false, GUIEditor.window[1]) 
  
        GUIEditor.button[1] = guiCreateButton(9, 22, 103, 50, "Sanchez", false, GUIEditor.window[1]) 
          
  
addEventHandler("onClientMarkerHit", marker1 , 
  
    function ( player_ ) 
      
    if ( player_ == getLocalPlayer (    ) ) then 
  
    guiSetVisible ( GUIEditor.window[1] , true ) 
  
    showCursor( true ) 
  
    guiSetInputEnabled ( true ) 
  
        end 
    end 
    ) ; 
  
addEventHandler("onClientGUIClick", getRootElement (    ) , 
  
    function ( ) 
  
    if ( source == GUIEditor.button[2] ) then 
  
    guiSetVisible ( GUIEditor.window[1] , false ) 
  
    showCursor( false ) 
  
    guiSetInputEnabled ( false ) 
  
    elseif ( source == GUIEditor.button[1] ) then 
  
    guiSetVisible ( GUIEditor.window[1] , false ) 
  
    showCursor( false ) 
  
    guiSetInputEnabled ( false ) 
        
    triggerServerEvent ( "CreateVehicle_" , getLocalPlayer (    ) )  
  
        end 
    end 
    ) ; 

Server :

local table = { } 
  
addEvent ( "CreateVehicle_" , true ) 
  
addEventHandler ( "CreateVehicle_" , getRootElement (   ) ,  
  
    function (  ) 
  
    if isElement ( table [ source ] ) then  
     
    destroyElement ( table [ source ] )  
     
    end 
      
    local x , y , z = getElementPosition ( source ) 
      
    table [ source ] = createVehicle ( 468, x, y, z + 10 ) 
        
        end 
    ) ; 

تحت سطر 11 حط هالكود :

local var; 
for k ,v in pairs ( table ) do var = ( var or 0 ) + 1 end outputChatBox ( var ) 

راح تلاحظ يطلع لك 1, بمعنى ان قيمة اللاعب لازالت موجوده داخل الجدول عشان كذا لازم تحذفها :

table [ source ] = nil; 

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

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