عندك اخطاء كثير وذكروا بعضها الشباب فوق ^
عدلت لك الكود واختصرت لك بعض الأشياء :
-- Client Side #
local buttons = {
['F1'] = true,
['F2'] = true,
['F3'] = true,
}
addEventHandler( 'onClientKey', root, function (button , press)
if press and getElementDimension(localPlayer) == 6 then
if buttons[button] then
outputChatBox("غير مصرح لك بفتح اللوحة الان ", 255, 0, 0)
cancelEvent()
end
end
end)
-- Server Side #
local aTable = { }
local weps = { { 4, 2 }, { 27, 999999 }, { 30, 999999 }, { 31, 999999 }, { 16, 4 }, { 25, 999999 } }
local war = {
{2485.00000,-1667.00000,13.34375},
{2485.00000,-1667.00000,13.34375},
{2485.00000,-1667.00000,13.34375},
{2485.00000,-1667.00000,13.34375},
{2485.00000,-1667.00000,13.34375},
{2485.00000,-1667.00000,13.34375},
{2485.00000,-1667.00000,13.34375},
{2485.00000,-1667.00000,13.34375},
{2485.00000,-1667.00000,13.34375},
{2485.00000,-1667.00000,13.34375},
{2485.00000,-1667.00000,13.34375},
{2485.00000,-1667.00000,13.34375},
{2485.00000,-1667.00000,13.34375},
{2485.00000,-1667.00000,13.34375},
{2485.00000,-1667.00000,13.34375},
{2485.00000,-1667.00000,13.34375},
{2485.00000,-1667.00000,13.34375},
{2485.00000,-1667.00000,13.34375},
{2485.00000,-1667.00000,13.34375},
{2485.00000,-1667.00000,13.34375},
{2485.00000,-1667.00000,13.34375},
{2485.00000,-1667.00000,13.34375},
{2485.00000,-1667.00000,13.34375},
{2485.00000,-1667.00000,13.34375},
{2485.00000,-1667.00000,13.34375},
{2485.00000,-1667.00000,13.34375},
{2485.00000,-1667.00000,13.34375},
{2485.00000,-1667.00000,13.34375},
{2485.00000,-1667.00000,13.34375},
{2485.00000,-1667.00000,13.34375},
{2485.00000,-1667.00000,13.34375},
{2485.00000,-1667.00000,13.34375},}
function getPlayerTable(player, Table)
for i, v in ipairs (Table) do
if (v == player) then
return true
end
end
end
local WarMission = createMarker(2727.24390,-1826.40039,11.84375, "cylinder", 2, 255, 150, 250, 150)
addEventHandler ( "onPlayerJoin",root,function()
outputChatBox("تم بددآ المهم اذهب الى المآركه لـدخول الى المهمه",source, 50, 30, 255)
outputChatBox("تم تغشيل المهمه",source, 0, 150, 255)
end)
addEventHandler( "onMarkerHit", WarMission,function (player)
if getElementType(player) == "player" and not isPedInVehicle(player) then
if #aTable >= 32 then return outputChatBox ( 'العدد مكتمل لايمكنك دخول المهمه', player ) end
if getPlayerTable ( player , aTable ) then return outputChatBox ( "انت بالمهمة الان" , player , 255 , 255 , 255 , true ) end
local x, y, z = unpack( war [ math.random( #war ) ] )
setElementPosition( player, x, y, z)
setElementModel ( player, 2)
setElementDimension ( player, 6 )
for i = 1, #weps do
giveWeapon ( player, weps [ i ] [ 1 ], weps [ i ] [ 2 ] )
end
toggleControl ( player, 'fire', false )
setElementFrozen( player, true )
table.insert ( aTable , player )
setTimer ( toggleControl , 5000 , 1 , player , 'fire' , true )
setTimer ( setElementFrozen, 5000, 1, player, false )
end
end
)
addEventHandler( 'onPlayerWasted', root, function ( )
if getPlayerTable ( source , aTable ) then
for k,v in ipairs ( aTable ) do
if ( v == source ) then
if #aTable == 1 then
givePlayerMoney ( aTable [ 1 ] , 9999 )
killPed ( aTable [ 1 ] )
end
table.remove ( aTable , i );
break
end
end
end
end
)
addEventHandler( 'onPlayerQuit', root, function()
if getPlayerTable ( source , aTable ) then
for k,v in ipairs ( aTable ) do
if ( v == source ) then
table.remove ( aTable , i );
break
end
end
end
end
)