تمت التجربة !
#Client
GUIEditor = {
window = { }
}
GUIEditor.window[1] = guiCreateWindow(420, 190, 361, 182, "::Panel x6lbat::", false)
guiWindowSetSizable(GUIEditor.window[1], false)
guiSetVisible(GUIEditor.window[1],false)
give = guiCreateButton(21, 47, 93, 33, "Give Car", false, GUIEditor.window[1])
take = guiCreateButton(134, 47, 93, 33, "Destroy Car", false, GUIEditor.window[1])
kill = guiCreateButton(247, 47, 93, 33, "Slap", false, GUIEditor.window[1])
health = guiCreateButton(21, 123, 93, 33, "100 Health", false, GUIEditor.window[1])
armor = guiCreateButton(134, 123, 93, 33, "100 Armor", false, GUIEditor.window[1])
fly = guiCreateButton(247, 123, 93, 33, "Fly Car", false, GUIEditor.window[1])
addEventHandler("onClientGUIClick",resourceRoot,
function ( )
if ( source == health ) then
setElementHealth( localPlayer , 100 )
outputChatBox("Done 100 Health",255,24,21,true)
elseif ( source == armor ) then
triggerServerEvent ("Give_Ar", localPlayer )
elseif ( source == kill ) then
setElementHealth ( localPlayer ,0 )
outputChatBox("Done Kill",255,24,21,true)
elseif ( source == fly ) then
setWorldSpecialPropertyEnabled("aircars", true)
outputChatBox("You Can Fly know !!",253,35,32)
elseif ( source == take ) then
triggerServerEvent( "DestroyMyCar",localPlayer )
elseif ( source == give ) then
triggerServerEvent ( "GiveVehicle", localPlayer )
end
end
) ;
-- Open Panel
function Open()
guiSetVisible (GUIEditor.window[1],not guiGetVisible(GUIEditor.window[1]))
showCursor (guiGetVisible(GUIEditor.window[1]))
end
bindKey("x", "down", Open)
#Server
-- server side
addEvent("Give_Ar",true)
addEventHandler("Give_Ar",root,
function( )
if getPedArmor ( source ) == 100 then return end
setPedArmor ( source , 100 )
end
) ;
local table = { }
local TheCarID = 411
addEvent("GiveVehicle",true)
addEventHandler("GiveVehicle",root,
function( )
if isElement ( table[ source ] ) then destroyElement ( table[ source ] ) end
PosX , PosY , PosZ = getElementPosition ( source )
table[ source ] = createVehicle( TheCarID , PosX , PosY , PosZ )
warpPedIntoVehicle( source , table[ source ] )
end
) ;
addEvent("DestroyMyCar",true)
addEventHandler("DestroyMyCar",root,
function( )
if isElement ( table[ source ] ) then destroyElement ( table[ source ] ) end
end
) ;
addEventHandler('onPlayerQuit',root, function ( )
if isElement ( table[ source ] ) then destroyElement ( table[ source ] ) end
end
) ;