Jump to content

تصليح خطأ بسيط


Recommended Posts

السلام عليكم

    addCommandHandler("buyhouse", function(thePlayer) 
        if(getElementData(thePlayer, "house:lastvisit")) and (getElementData(thePlayer, "house:lastvisit") ~= false)  then 
            local house = getElementData(thePlayer, "house:lastvisit") 
            if(house) then 
                local id = house 
                local owner = houseData[id]["OWNER"] 
                if(owner ~= "None") then 
                    outputChatBox("You can't buy this house!", thePlayer, 255, 0, 0) 
                else 
                    local houses = 0 
                    for index, col in pairs(getElementsByType("colshape")) do 
                        if(getElementData(col, "house") == true) and (houseData[getElementData(col, "ID")]["OWNER"] == getPlayerName(thePlayer)) then 
                            houses = houses+1 
                            if(houses == max_player_houses) then 
                                outputChatBox("You have allready "..max_player_houses.." houses! Sell a house to buy this one.", thePlayer, 255, 0, 0) 
                                return 
                            end 
                        end 
                    end 
                    local money = getPlayerMoney(thePlayer) 
                    local price = houseData[id]["PRICE"] 
                    if(money < price) then outputChatBox("You have not enought money! You need "..(price-money).."$ more!", thePlayer, 255, 0, 0) return end 
                    setHouseData(id, "OWNER", getPlayerName(thePlayer)) 
                    takePlayerMoney(thePlayer, price) 
                    takePlayerMoney(thePlayer, money) 
                    outputChatBox("Congratulations! You bought the house!", thePlayer, 0, 255, 0) 
                    setElementModel(houseData[id]["PICKUP"], 1272) 
                    setElementModel(houseData[id]["BLIP"], 32) 
                end 
            end 
        end 
    end) 

لما أشتري البيت الفلوس ما تتسحب !؟ وش الحل :twisted:

Link to comment
  
addCommandHandler("buyhouse", function(thePlayer) 
        if(getElementData(thePlayer, "house:lastvisit")) and (getElementData(thePlayer, "house:lastvisit") ~= false)  then 
            local house = getElementData(thePlayer, "house:lastvisit") 
            if(house) then 
                local id = house 
                local owner = houseData[id]["OWNER"] 
                if(owner ~= "None") then 
                    outputChatBox("You can't buy this house!", thePlayer, 255, 0, 0) 
                else 
                    local houses = 0 
                    for index, col in pairs(getElementsByType("colshape")) do 
                        if(getElementData(col, "house") == true) and (houseData[getElementData(col, "ID")]["OWNER"] == getPlayerName(thePlayer)) then 
                            houses = houses+1 
                            if(houses == max_player_houses) then 
                                outputChatBox("You have allready "..max_player_houses.." houses! Sell a house to buy this one.", thePlayer, 255, 0, 0) 
                                return 
                            end 
                        end 
                    end 
                    local money = getPlayerMoney(thePlayer) 
                    local price = houseData[id]["PRICE"] 
                    if(money < price) then outputChatBox("You have not enought money! You need "..(price-money).."$ more!", thePlayer, 255, 0, 0) return end 
                    setHouseData(id, "OWNER", getPlayerName(thePlayer)) 
                    takePlayerMoney(thePlayer, tonumber(price)) 
                    takePlayerMoney(thePlayer, tonumber(money)) 
                    outputChatBox("Congratulations! You bought the house!", thePlayer, 0, 255, 0) 
                    setElementModel(houseData[id]["PICKUP"], 1272) 
                    setElementModel(houseData[id]["BLIP"], 32) 
                end 
            end 
        end 
    end) 
  

Link to comment
  
addCommandHandler("buyhouse", function(thePlayer) 
        if(getElementData(thePlayer, "house:lastvisit")) and (getElementData(thePlayer, "house:lastvisit") ~= false)  then 
            local house = getElementData(thePlayer, "house:lastvisit") 
            if(house) then 
                local id = house 
                local owner = houseData[id]["OWNER"] 
                if(owner ~= "None") then 
                    outputChatBox("You can't buy this house!", thePlayer, 255, 0, 0) 
                else 
                    local houses = 0 
                    for index, col in pairs(getElementsByType("colshape")) do 
                        if(getElementData(col, "house") == true) and (houseData[getElementData(col, "ID")]["OWNER"] == getPlayerName(thePlayer)) then 
                            houses = houses+1 
                            if(houses == max_player_houses) then 
                                outputChatBox("You have allready "..max_player_houses.." houses! Sell a house to buy this one.", thePlayer, 255, 0, 0) 
                                return 
                            end 
                        end 
                    end 
                    local money = getPlayerMoney(thePlayer) 
                    local price = houseData[id]["PRICE"] 
                    if(money < price) then outputChatBox("You have not enought money! You need "..(price-money).."$ more!", thePlayer, 255, 0, 0) return end 
                    setHouseData(id, "OWNER", getPlayerName(thePlayer)) 
                    takePlayerMoney(thePlayer, tonumber(price)) 
                    takePlayerMoney(thePlayer, tonumber(money)) 
                    outputChatBox("Congratulations! You bought the house!", thePlayer, 0, 255, 0) 
                    setElementModel(houseData[id]["PICKUP"], 1272) 
                    setElementModel(houseData[id]["BLIP"], 32) 
                end 
            end 
        end 
    end) 
  

شكرا لردك ومساعدتك بس مايسحب الفلوس نفس الشيء :roll:

Link to comment
  
  
addCommandHandler("buyhouse", function(thePlayer) 
        if(getElementData(thePlayer, "house:lastvisit")) and (getElementData(thePlayer, "house:lastvisit") ~= false)  then 
            local house = getElementData(thePlayer, "house:lastvisit") 
            if(house) then 
                local id = house 
                local owner = houseData[id]["OWNER"] 
                if(owner ~= "None") then 
                    outputChatBox("You can't buy this house!", thePlayer, 255, 0, 0) 
                else 
                    local houses = 0 
                    for index, col in pairs(getElementsByType("colshape")) do 
                        if(getElementData(col, "house") == true) and (houseData[getElementData(col, "ID")]["OWNER"] == getPlayerName(thePlayer)) then 
                            houses = houses+1 
                            if(houses == max_player_houses) then 
                                outputChatBox("You have allready "..max_player_houses.." houses! Sell a house to buy this one.", thePlayer, 255, 0, 0) 
                                return 
                            end 
                        end 
                    end 
                    local money = getPlayerMoney(thePlayer) 
                    local price = houseData[id]["PRICE"] 
                    if(money < price) then outputChatBox("You have not enought money! You need "..( tonumber(price) - tonumber(money)).."$ more!", thePlayer, 255, 0, 0) return end 
                    setHouseData(id, "OWNER", getPlayerName(thePlayer)) 
                    takePlayerMoney(thePlayer, tonumber(price)) 
                    outputChatBox("Congratulations! You bought the house!", thePlayer, 0, 255, 0) 
                    setElementModel(houseData[id]["PICKUP"], 1272) 
                    setElementModel(houseData[id]["BLIP"], 32) 
                end 
            end 
        end 
    end) 
  

جرب

Link to comment

إذا مستخدم فانكشن

takePlayerMoney 

في الكلاينت سايد

اعتقد مارح يصير شي ع الفلوس

جرب استخدمها في السيرفر سايد

Note: Using this function client side (not recommended) will not change a players money server side.

Link to comment

اممم انا مستغرب ليش تحط return

عند الايند ؟

جرب

  
  
addCommandHandler("buyhouse", function(thePlayer) 
        if(getElementData(thePlayer, "house:lastvisit")) and (getElementData(thePlayer, "house:lastvisit") ~= false)  then 
            local house = getElementData(thePlayer, "house:lastvisit") 
            if(house) then 
                local id = house 
                local owner = houseData[id]["OWNER"] 
                if(owner ~= "None") then 
                    outputChatBox("You can't buy this house!", thePlayer, 255, 0, 0) 
                else 
                    local houses = 0 
                    for index, col in pairs(getElementsByType("colshape")) do 
                        if(getElementData(col, "house") == true) and (houseData[getElementData(col, "ID")]["OWNER"] == getPlayerName(thePlayer)) then 
                            houses = houses+1 
                            if(houses == max_player_houses) then 
                                    return 
                                outputChatBox("You have allready "..max_player_houses.." houses! Sell a house to buy this one.", thePlayer, 255, 0, 0) 
                            end 
                        end 
                    end 
                    local money = getPlayerMoney(thePlayer) 
                    local price = houseData[id]["PRICE"] 
                    if(tonumber(money) < tonumber(price)) then return  outputChatBox("You have not enought money! You need "..(price-money).."$ more!", thePlayer, 255, 0, 0)  end 
                    setHouseData(id, "OWNER", getPlayerName(thePlayer)) 
                    takePlayerMoney(thePlayer, tonumber(price)) 
                    takePlayerMoney(thePlayer, tonumber(money)) 
                    outputChatBox("Congratulations! You bought the house!", thePlayer, 0, 255, 0) 
                    setElementModel(houseData[id]["PICKUP"], 1272) 
                    setElementModel(houseData[id]["BLIP"], 32) 
                end 
            end 
        end 
    end) 
  

Link to comment
   addCommandHandler("buyhouse", function(thePlayer) 
        if(getElementData(thePlayer, "house:lastvisit")) and (getElementData(thePlayer, "house:lastvisit") ~= false)  then 
            local house = getElementData(thePlayer, "house:lastvisit") 
            if(house) then 
                local id = house 
                local owner = houseData[id]["OWNER"] 
                if(owner ~= "None") then 
                    outputChatBox("You can't buy this house!", thePlayer, 255, 0, 0) 
                else 
                    local houses = 0 
                    for index, col in pairs(getElementsByType("colshape")) do 
                        if(getElementData(col, "house") == true) and (houseData[getElementData(col, "ID")]["OWNER"] == getPlayerName(thePlayer)) then 
                            houses = houses+1 
                            if(houses == max_player_houses) then 
                                outputChatBox("You have allready "..max_player_houses.." houses! Sell a house to buy this one.", thePlayer, 255, 0, 0) 
                                return 
                            end 
                        end 
                    end 
                    local money = getPlayerMoney(thePlayer) 
                    local price = tonumber(houseData[id]["PRICE"]) 
                    if(money < price) then outputChatBox("You have not enought money! You need "..(price-money).."$ more!", thePlayer, 255, 0, 0) return end 
                    setHouseData(id, "OWNER", getPlayerName(thePlayer)) 
                    takePlayerMoney(thePlayer, price) 
                    takePlayerMoney(thePlayer, money) 
                    outputChatBox("Congratulations! You bought the house!", thePlayer, 0, 255, 0) 
                    setElementModel(houseData[id]["PICKUP"], 1272) 
                    setElementModel(houseData[id]["BLIP"], 32) 
                end 
            end 
        end 
    end) 

جرب

Link to comment
   addCommandHandler("buyhouse", function(thePlayer) 
        if(getElementData(thePlayer, "house:lastvisit")) and (getElementData(thePlayer, "house:lastvisit") ~= false)  then 
            local house = getElementData(thePlayer, "house:lastvisit") 
            if(house) then 
                local id = house 
                local owner = houseData[id]["OWNER"] 
                if(owner ~= "None") then 
                    outputChatBox("You can't buy this house!", thePlayer, 255, 0, 0) 
                else 
                    local houses = 0 
                    for index, col in pairs(getElementsByType("colshape")) do 
                        if(getElementData(col, "house") == true) and (houseData[getElementData(col, "ID")]["OWNER"] == getPlayerName(thePlayer)) then 
                            houses = houses+1 
                            if(houses == max_player_houses) then 
                                outputChatBox("You have allready "..max_player_houses.." houses! Sell a house to buy this one.", thePlayer, 255, 0, 0) 
                                return 
                            end 
                        end 
                    end 
                    local money = getPlayerMoney(thePlayer) 
                    local price = tonumber(houseData[id]["PRICE"]) 
                    if(money < price) then outputChatBox("You have not enought money! You need "..(price-money).."$ more!", thePlayer, 255, 0, 0) return end 
                    setHouseData(id, "OWNER", getPlayerName(thePlayer)) 
                    takePlayerMoney(thePlayer, price) 
                    takePlayerMoney(thePlayer, money) 
                    outputChatBox("Congratulations! You bought the house!", thePlayer, 0, 255, 0) 
                    setElementModel(houseData[id]["PICKUP"], 1272) 
                    setElementModel(houseData[id]["BLIP"], 32) 
                end 
            end 
        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...