Jump to content

ابي اكواد لشوب


Recommended Posts

ههههههه مادري علي مزاجات ض2

لاكن يلا تفضل

--server side--

addEvent('health',true) 
addEventHandler('health', root, 
    function () 
       if (getPlayerMoney(source) >= 3000) then 
       takePlayerMoney (source,3000) 
       setElementHealth(source,100) 
       outputChatBox("* #0099ccSuccessfully bought Health #000000[ #ff0000-$2500 #000000]#00ff00 !",source,0,255,0,true) 
       else --- dont use elseif this is good way .. 
       outputChatBox("* you Don't have enough Money !",source,255,0,0,true) 
       end 
    end 
) 
  
addEvent('armor',true) 
addEventHandler("armor", root, 
    function () 
        if (getPlayerMoney(source) >= 3000) then 
        takePlayerMoney (source,3000)   
        setPedArmor(source,100) 
        outputChatBox("* #0099ccSuccessfully bought Armor #000000[ #ff0000-$2000 #000000]#00ff00 !",source,0,255,0,true) 
        else 
        outputChatBox("* you Don't have enough Money !",source,255,0,0,true) 
        end 
    end 
) 

--client side--

  
armor = guiCreateButton(10,80,90,30,"$3000                     Armor",false,TheWindow ) 
health = guiCreateButton(110,80,90,30,"$3000                     health",false,TheWindow ) 
addEventHandler ("onClientGUIClick", root, 
    function() 
        if ( source ==  health ) then 
        triggerServerEvent("health", localPlayer) 
        elseif ( source ==  armor ) then 
         triggerServerEvent("armor", localPlayer) 
end 
end) 

Link to comment

--client side--

  
setTimer( 
    function() 
        playerList = guiCreateGridList(6, 6, 140, 460, false, tab4) 
            guiGridListSetSelectionMode(playerList, 2) 
            local cl = guiGridListAddColumn(playerList, "Players List ...", 0.85) 
                if ( cl and guiGetVisible(GUIEditor_Window[1] ) == true ) then 
                    for _,name in ipairs(getElementsByType("player")) do 
                     local rw = guiGridListAddRow(playerList) 
                     guiGridListSetItemText(playerList, rw, cl, getPlayerName(name), false, false) 
                    end 
        addEventHandler("onClientGUIClick", playerList, onClickPlayerName) 
                end 
    end 
,4000,0) 
  
nameEdit = guiCreateEdit(160,150,200,30,"",false,tab4) 
  
amountEdit = guiCreateEdit(160,200,100,30,"",false,tab4) 
  
sendBTN = guiCreateButton(150,280,130,36, "send", false,tab4) 
-- 
function onClickPlayerName () 
  local name = guiGridListGetItemText(playerList, guiGridListGetSelectedItem(playerList), 1) 
  guiSetText(nameEdit, name) 
end 
  
addEventHandler("onClientGUIClick",getRootElement(), 
function() 
       if ( source == sendBTN ) then 
         playerNick = guiGetText(nameEdit) 
         amount = guiGetText(amountEdit) 
         triggerServerEvent("onSendMoney", getLocalPlayer(), playerNick, amount) 
       end 
end) 
  

--server side--

addEvent("onSendMoney", true) 
addEventHandler("onSendMoney", getRootElement(), 
 function(who, player) 
   local money = getPlayerMoney(source) 
    if tonumber(player) >= 200 then 
        if tonumber(player) <= money then 
            toWho = getPlayerFromName(who) 
                if toWho ~= false then 
                    givePlayerMoney(toWho, player) 
                    takePlayerMoney(source, player) 
                    name = getPlayerName(source) 
                    outputChatBox("* You have given money amount of: #00ff00$" .. player .. " #0099ccto: #ff0000" .. who, source, 0, 150, 255, true) 
                    outputChatBox("* ".. name .. " #ff0000has given you money amount of: #00ff00$" .. player .. " #ff0000!", toWho, 255, 0, 0, true) 
                else 
                    outputChatBox("* Player did not exist !", source, 255, 0, 0) 
                end 
        else 
            outputChatBox("* you dont have enough money !", source, 255, 0, 0) 
        end 
    else 
        outputChatBox("* the Less amount must be #00ff00$200 !", source, 255, 0, 0) 
    end 
 end 
) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...