function buym4 (toBuy)
local money = getPlayerMoney(source)
local m4money = 2000
if ( money >= m4money ) then
giveWeapon ( source, 31, m4ammo, true)
else
outputChatBox ("You havent got enough money to buy this!", source)
end
end
addEvent("buym4",true)
addEventHandler("buym4",getRootElement(),buym4)
-- Steps:
-- Give weps with command |Done
-- Take money while giving weps with command |Done
-- Establish connections between your client sided script and server sided script. |Done
-- Make a simple button and sell weps from that button when it get clicked | Having errors
-- Make a simple gui window and add all neccesary weps. | Not Finished
-- Make a marker and set visible the GUI when the player hits to that marker | Not Finished
function buym4 ()
triggerServerEvent ( "buym4", getLocalPlayer(), "buym4" )
end
addEventHandler ( "onClientGUIClick", M4.button, buym4, false )
Please try to understand what I did.