Posts: 2
Threads: 0
Joined: Jul 2017
It manages to open placard, but then i have to press purchase land and it will work until i have to press purchase land again.. how to fix this?
Posts: 5
Threads: 1
Joined: Apr 2019
fixed it
Code: local delay = 5000 --Delay between purchase attempts, 1000 is 1 second
local buytype = 0 --0 is Private Individual, 1 is Free Company, 2 is Relocation...
if BuyHouseVar == nil then
BuyHouseVar = true
BuyHouseStep = 0
BuyHouseLast = 0
BuyHousePushButton = 24
if GetGameRegion() == 1 then BuyHousePushButton = 25 end
else
BuyHouseVar = not BuyHouseVar
end
function BuyHouseFunction()
d("BuyHouseStep: "..tostring(BuyHouseStep))
if BuyHouseVar and TimeSince(BuyHouseLast) > delay then
local PlacardID = 0
local el = EntityList("nearest,contentid=2002736")
if table.valid(el) then
for k,v in pairs(el) do
PlacardID = v.id
end
end
if BuyHouseStep == 0 then
if IsControlOpen("HousingSignBoard") then
BuyHouseStep = 1
else
Player:SetTarget(PlacardID)
Player:Interact(PlacardID)
end
end
if BuyHouseStep == 1 then
UseControlAction("HousingSignBoard","PurchaseLand")
if IsControlOpen("SelectYesno") then
BuyHouseStep = 3
elseif IsControlOpen("SelectString") and not IsControlOpen("HousingSignBoard") then
BuyHouseStep = 2
elseif IsControlOpen("HousingSignBoard") then
local ctrl = GetControl("HousingSignBoard")
if ctrl:GetRawData()[1].value.A == 1 then
ctrl:PushButton(BuyHousePushButton,2)
end
end
end
if BuyHouseStep == 2 then
if IsControlOpen("SelectYesno") then
BuyHouseStep = 3
elseif IsControlOpen("SelectString") then
GetControl("SelectString"):Action("SelectIndex",buytype)
elseif IsControlOpen("HousingSignBoard") then
UseControlAction("SelectYesno","Yes")
BuyHouseStep = 1
end
end
if BuyHouseStep == 3 then
if IsControlOpen("SelectYesno") then
UseControlAction("SelectYesno","Yes")
elseif Player:GetTarget() == nil then
BuyHouseStep = 0
BuyHouseLast = Now()
end
end
end
end
RegisterEventHandler("Gameloop.Update", BuyHouseFunction)
Posts: 5
Threads: 1
Joined: Sep 2018
anyone been successful yet with the updated code? 10 plots so far and I lose to others. not upset, more or less just want to make sure it works, and or any suggestions for a way to make it faster then other bots :)
Posts: 8
Threads: 2
Joined: May 2016
04-25-2019, 07:50 PM
(This post was last modified: 04-25-2019, 08:04 PM by FunkedUp.)
(04-25-2019, 04:07 PM)chadit Wrote: anyone been successful yet with the updated code? 10 plots so far and I lose to others. not upset, more or less just want to make sure it works, and or any suggestions for a way to make it faster then other bots :)
I was successful with it today, copy the code, change the delay from 5000 to whatever you want. There were so many other people buying houses today I went /busy, set it to 500 and managed to get mine. If I set it to anything lower than 500, the bot would end up crashing.
Posts: 5
Threads: 1
Joined: Sep 2018
(04-25-2019, 07:50 PM)FunkedUp Wrote: (04-25-2019, 04:07 PM)chadit Wrote: anyone been successful yet with the updated code? 10 plots so far and I lose to others. not upset, more or less just want to make sure it works, and or any suggestions for a way to make it faster then other bots :)
I was successful with it today, copy the code, change the delay from 5000 to whatever you want. There were so many other people buying houses today I went /busy, set it to 500 and managed to get mine. If I set it to anything lower than 500, the bot would end up crashing.
great thank you, I have my set to 10 atm and it seems to be holding up. day 3 and on my 11th attempt, was starting to question if it was working :)
Posts: 5
Threads: 1
Joined: Sep 2018
still working snagging a house, I was looking a the console output just to see what was happening (can believe I have lost this many times)... is this error because the log is not purchasable or is there an issue with my script
Code: 16:18:58> D = "BuyHouseStep: 0"
16:18:58> D = "BuyHouseStep: 0"
16:18:58> D = "BuyHouseStep: 0"
16:18:58> D = "BuyHouseStep: 0"
16:18:58> D = "BuyHouseStep: 0"
16:18:58> [Lua Error]: [string "local delay = 500..."]:41: attempt to index a nil value
16:18:58> Callstack:
16:18:58> [[string "local delay = 500..."]]:41:
16:18:58> D = "BuyHouseStep: 1"
16:18:58> D = "BuyHouseStep: 2"
16:18:58> D = "BuyHouseStep: 1"
16:18:58> D = "BuyHouseStep: 1"
16:18:58> D = "BuyHouseStep: 2"
16:18:58> D = "BuyHouseStep: 1"
Posts: 1
Threads: 0
Joined: Jul 2015
05-01-2019, 02:56 PM
(This post was last modified: 05-01-2019, 02:57 PM by liouliou.)
(04-30-2019, 04:23 PM)chadit Wrote: still working snagging a house, I was looking a the console output just to see what was happening (can believe I have lost this many times)... is this error because the log is not purchasable or is there an issue with my script
Same problem here (and same logs), don't know if it's juste because of the loop, or if there is a problem with the script. I've lost the count of the number of house i've lost.
Posts: 8
Threads: 2
Joined: May 2016
(05-01-2019, 02:56 PM)liouliou Wrote: (04-30-2019, 04:23 PM)chadit Wrote: still working snagging a house, I was looking a the console output just to see what was happening (can believe I have lost this many times)... is this error because the log is not purchasable or is there an issue with my script
Same problem here (and same logs), don't know if it's juste because of the loop, or if there is a problem with the script. I've lost the count of the number of house i've lost.
Depending on the server you guys are playing on, buying houses is really a coin flip. While using a script to do it for you makes it easier. It isn't 100% that you're going to get a house. There's also a ton of other people using scripts or bots to nab houses.
Posts: 6
Threads: 0
Joined: Apr 2019
05-04-2019, 06:10 AM
(This post was last modified: 05-04-2019, 06:11 AM by bender69.)
I had issue with players able to see macro due to head movement on target, so made this tiny change so character doesnt move head.
Code: local delay = 500 --Delay between purchase attempts, 1000 is 1 second
local buytype = 0 --0 is Private Individual, 1 is Free Company, 2 is Relocation...
local PlacardID = 0
if BuyHouseVar == nil then
BuyHouseVar = true
BuyHouseStep = 0
BuyHouseLast = 0
BuyHousePushButton = 24
if GetGameRegion() == 1 then BuyHousePushButton = 25 end
else
BuyHouseVar = not BuyHouseVar
end
function BuyHouseFunction()
d("BuyHouseStep: "..tostring(BuyHouseStep))
if BuyHouseVar and TimeSince(BuyHouseLast) > delay then
PlacardID = 0
local el = EntityList("nearest,contentid=2002736")
if table.valid(el) then
for k,v in pairs(el) do
PlacardID = v.id
end
end
if BuyHouseStep == 0 then
if IsControlOpen("HousingSignBoard") then
BuyHouseStep = 1
else
Player:SetTarget(PlacardID)
Player:Interact(PlacardID)
end
end
if BuyHouseStep == 1 then
UseControlAction("HousingSignBoard","PurchaseLand")
if IsControlOpen("SelectYesno") then
BuyHouseStep = 3
elseif IsControlOpen("SelectString") and not IsControlOpen("HousingSignBoard") then
BuyHouseStep = 2
elseif IsControlOpen("HousingSignBoard") then
local ctrl = GetControl("HousingSignBoard")
if ctrl:GetRawData()[1].value.A == 1 then
ctrl:PushButton(BuyHousePushButton,2)
end
end
end
if BuyHouseStep == 2 then
if IsControlOpen("SelectYesno") then
BuyHouseStep = 3
elseif IsControlOpen("SelectString") then
GetControl("SelectString"):Action("SelectIndex",buytype)
elseif IsControlOpen("HousingSignBoard") then
UseControlAction("SelectYesno","Yes")
BuyHouseStep = 1
end
end
if BuyHouseStep == 3 then
if IsControlOpen("SelectYesno") then
UseControlAction("SelectYesno","Yes")
elseif Player:GetTarget() == nil then
BuyHouseStep = 0
BuyHouseLast = Now()
end
end
end
if Player:GetTarget() == nil then
Player:SetTarget(PlacardID)
end
end
RegisterEventHandler("Gameloop.Update", BuyHouseFunction)
Posts: 1
Threads: 0
Joined: May 2019
Is it possible someone could explain to me how to set this up? Or point me where to look? I seem to be struggling trying to make it work all together
|