BigJoe Posted June 11, 2016 Share Posted June 11, 2016 السلام عليكم 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) لما أشتري البيت الفلوس ما تتسحب !؟ وش الحل Link to comment
iMr.WiFi..! Posted June 11, 2016 Share Posted June 11, 2016 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
BigJoe Posted June 11, 2016 Author Share Posted June 11, 2016 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
iMr.WiFi..! Posted June 11, 2016 Share Posted June 11, 2016 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
Mr.CoR Posted June 11, 2016 Share Posted June 11, 2016 إذا مستخدم فانكشن takePlayerMoney في الكلاينت سايد اعتقد مارح يصير شي ع الفلوس جرب استخدمها في السيرفر سايد Note: Using this function client side (not recommended) will not change a players money server side. Link to comment
iMr.WiFi..! Posted June 11, 2016 Share Posted June 11, 2016 الكود ذا سيرفر ولا كلينت ؟ Link to comment
BigJoe Posted June 11, 2016 Author Share Posted June 11, 2016 ........................... Link to comment
iMr.WiFi..! Posted June 12, 2016 Share Posted June 12, 2016 اممم انا مستغرب ليش تحط 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
BigJoe Posted June 12, 2016 Author Share Posted June 12, 2016 برضوا مش بيسحب مني فلوس ! Link to comment
[DONE]* Posted June 12, 2016 Share Posted June 12, 2016 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
BigJoe Posted June 13, 2016 Author Share Posted June 13, 2016 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now