--------------------
-- CLIENT
--------------------
local rows = {
{"M4 $500","500"},
{"Armor $1000","1000"},
}
addEventHandler("onClientResourceStart", resourceRoot,
function()
wnd = guiCreateWindow(187, 116, 450, 386, "=[ Panel Shop v1.0 | By Mr.R ]=", false)
guiWindowSetSizable(wnd, false)
GridList = guiCreateGridList(9, 21, 223, 355, false, wnd)
column = guiGridListAddColumn(GridList, "Weapon ...", 0.9)
for k,v in ipairs (rows) do
row = guiGridListAddRow(GridList)
guiGridListSetItemText(GridList,row,1,v[1],false,false)
end
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)
end
)
addEventHandler("onClientGUIClick", root,
function( thePlayer )
if ( source == Button1 ) then
getA = guiGridListGetItemText ( GridList, guiGridListGetSelectedItem ( GridList ), 1 )
local row, column = guiGridListGetSelectedItem ( GridList )
local Money = tonumber ( guiGridListGetItemText(GridList,row,2) )
if ( row and column and row ~= -1 and column ~= -1 ) then
triggerServerEvent("Trigger",localPlayer,Money)
else
outputChatBox("الرجاء اختيار سلاح ", thePlayer,255,0,0,true)
end
elseif ( source == Button2 ) then
guiSetVisible( wnd,false)
guiSetVisible( GridList,false)
showCusror(false)
end
end
)
addEvent("Chat",true)
addEventHandler("Chat", getRootElement(),
function ( thePlayer )
outputChatBox("Don't have #"..Money,thePlayer,255,0,0,true)
end
)
---------------------
-- SERVER
---------------------
addEvent("Trigger",true)
addEventHandler("Trigger",getRootElement( ) ,
function( Money )
if ( Money < getPlayerMoney(source)) then
giveWeapon( 30, 1000 )
takePlayerMoney( source, tonumber(Money) )
elseif ( Money > getPlayerMoney(source)) then
triggerClientEvent("Chat",source)
end
end
)