شوف الكود الي طلع معي وصلحه لاهنت لانه مايخذ وقت سلاحين بس ^^
احس طولناها وهي قصيره ، وانا جربت كل شيء مانفع
تفضل
-- Client
local Weapons = {
[ 1 ] = { "M4", 31, 500 },
[ 2 ] = { "Minigun", 16, 4000 },
}
addEventHandler( "onClientResourceStart", resourceRoot, function ( )
wnd = guiCreateWindow(187, 116, 450, 386, "=[ Panel Shop v1.0 | By Mr.R ]=", false)
guiWindowSetSizable( wnd, false )
guiSetVisible ( wnd, false )
GridList = guiCreateGridList(9, 21, 223, 355, false, wnd)
guiGridListAddColumn(GridList, "Weapon", 0.9)
guiGridListAddColumn(GridList, "Price", 5)
Button1 = guiCreateButton(270, 243, 139, 39, "=[ Buy ]=", false, wnd)
guiSetProperty(Button1, "NormalTextColour", "FFAAAAAA")
Button2 = guiCreateButton(270, 292, 139, 39, "=[ X ]=", false, wnd)
guiSetProperty(Button2, "NormalTextColour", "FFAAAAAA")
MTA = guiCreateStaticImage(249, 27, 191, 193, "MTA.png", false, wnd)
for i, v in ipairs ( Weapons ) do
Row = guiGridListAddRow( GridList )
guiGridListSetItemText( GridList, Row, 1, v[1], false, false )
guiGridListSetItemText( GridList, Row, 2, "$"..v[3], false, false )
guiGridListSetItemData( GridList, Row, 1, v[2] )
end
end )
bindKey ( "F2", "down", function ( )
guiSetVisible ( wnd, not guiGetVisible ( wnd ) )
showCursor ( guiGetVisible ( wnd ) )
end )
addEventHandler( "onClientGUIClick", resourceRoot, function( )
if ( source == Button1 ) then
if ( guiGridListGetSelectedItem ( GridList ) ~= -1 ) then
local Money = tonumber ( guiGridListGetItemText ( GridList, guiGridListGetSelectedItem ( GridList ), 2 ) )
local iD = tonumber( guiGridListGetItemData( source, guiGridListGetSelectedItem( GridList ), 1 ) )
if ( Money ~= '' and iD ~= '' ) then
triggerServerEvent( "M4", localPlayer, iD, Money ) -- هنا اضفت ترايقر حق سلاح ام4
triggerServerEvent( "Minigun", localPlayer, iD, Money ) -- وهنا اضفت ترايقر حق الخلاط
end
else
outputChatBox ( "* Please Select Weapon", 255, 255, 255, true )
end
elseif ( source == Button2 ) then
guiSetVisible ( wnd, false )
showCursor ( guiGetVisible ( wnd ) )
elseif ( source == GridList ) then
if ( guiGridListGetSelectedItem ( GridList ) ~= -1 ) then
local fName = guiGridListGetItemText ( GridList, guiGridListGetSelectedItem ( GridList ), 1 )
if ( fName ~= '' ) then
guiStaticImageLoadImage ( M4, ""..fName..""..png ) -- هنا اضفت هذا الكود عشان اذا ضغط على رو سلاح ام4 يروح صورة رجل قراند وتجي صورة السلاح
guiStaticImageLoadImage ( Minigun, ""..fName..""..png ) -- هنا مثل الشيء + ملاحظه صورة رجل قراند جاهزه اول ماتشغل المود
end
end
end
end )
-- Server
addEvent( "M4", true )
addEventHandler( "M4", root, function( iD, Money )
if ( getPlayerMoney ( client ) >= Money ) then
if ( giveWeapon ( client, iD, 500 ) ) then -- 500 مبلغ السلاح
takePlayerMoney ( client, Money )
outputChatBox ( "* You Bought "..getWeaponNameFromID ( iD ).." With "..Money.."", client )
end
else
outputChatBox ( "* You Don't Have engouf money", client )
end
end )
addEvent( "Minigun", true )
addEventHandler( "Minigun", root, function( iD, Money )
if ( getPlayerMoney ( client ) >= Money ) then
if ( giveWeapon ( client, iD, 4000 ) ) then -- 4000 مبلغ السلاح
takePlayerMoney ( client, Money )
outputChatBox ( "* You Bought "..getWeaponNameFromID ( iD ).." With "..Money.."", client )
end
else
outputChatBox ( "* You Don't Have engouf money", client )
end
end )
مادري وش الخطأ للحين
شف الحل لاهنت ^^
debugscript 3
اكتب باف8
وشوف وش يقلك
وحطه هنا !