• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Special command

ScorpiOOn93

etherno.net
Joined
Jun 19, 2008
Messages
662
Reaction score
1
Location
CookieLand :DDD
I need a command that normal player can use when he is standing next to some occupied house and if owner of that house is not login on the ots 7 days/or if he is facc then another player can use that command and then owner of this house loose it.
 
not exactly what you are looking for but it kinda does the same thing..if a player doesn't log in for 10 days, it clears out the house so it is buyable again, and sends all items to the depot

PHP:
--Adam 2008

--Goosio OT

local safelist = {1,2,6,9,10,11}

function onSay(cid, words, param)
if getPlayerGroupId(cid) > 2 then
    pdelete = "Inactive Players With Houses:\n\n"
    days = 10*3600*24
    t=os.date('*t')
    local house = db.getResult("SELECT `owner`,`id` FROM `houses`")
    if(house:getID() ~= -1) then
        while (true) do
        local owner = house:getDataInt("owner")
        local hid = house:getDataInt("id")
            local player = db.getResult("SELECT `id`,`name`,`lastlogin` FROM `players` WHERE `id` = '"..owner.."'  ")
            if(player:getID() ~= -1) then
                local lastlogin = player:getDataInt("lastlogin")
                local pid = player:getDataInt("id")
                local name = player:getDataString("name")
                time=os.time(t) - lastlogin
                offline = time - days
                if offline >= 0 then
                    pdelete = pdelete.."House #"..hid.." owned by "..name.."\n"
                    if isInArray(safelist,hid) == FALSE then                    
                        setHouseOwner(hid, 0)
                    end
                end
            player:free()
            end
            if not(house:next()) then
                break
            end
        end
            
        house:free()    
        doShowTextDialog(cid, 5958, pdelete)
    else
        doPlayerSendCancel(cid, "Error.")
    end
end
return TRUE
end

works with 0.3
more sql talkactions at OtLand - Threads Tagged with xxgoosexx
 
@Up
Ok tnx, but this script is removing all old owners, and I need a command for players, but anyway thanks maybe i will be able to do it myself :p

whats wrong with removing all old owners ;) maybe it can help you get a start, i am not too familiar with new LUA functions, maybe they can be of more use to u
 
@Up
Yes i know that will be helpful and I have that command on my OT, but I want to have this special command for players, because they are always telling me that a noobs are owning houses and they are not playing etc. and now players can do it by himself

#Edit
Maybe someone can do it with a little help? : P
http://www.wklejto.pl/28037
http://www.wklejto.pl/28036
 
@Up
Yes i know that will be helpful and I have that command on my OT, but I want to have this special command for players, because they are always telling me that a noobs are owning houses and they are not playing etc. and now players can do it by himself

#Edit
Maybe someone can do it with a little help? : P
Kod: 28037 WKLEJTO.PL <= Darmowa wklejka, na zawsze!
Kod: 28036 WKLEJTO.PL <= Darmowa wklejka, na zawsze!

EDIT: before i do this what distro are you using some of these LUA functions i don't have in my source so i am not sure what they return..PM me if u want

i will write something up in a sec, i am not going to test it so i'd assume that you'd probably want to back stuff up before trying it
 
Last edited:
not exactly what you are looking for but it kinda does the same thing..if a player doesn't log in for 10 days, it clears out the house so it is buyable again, and sends all items to the depot

PHP:
--Adam 2008

--Goosio OT

local safelist = {1,2,6,9,10,11}

function onSay(cid, words, param)
if getPlayerGroupId(cid) > 2 then
    pdelete = "Inactive Players With Houses:\n\n"
    days = 10*3600*24
    t=os.date('*t')
    local house = db.getResult("SELECT `owner`,`id` FROM `houses`")
    if(house:getID() ~= -1) then
        while (true) do
        local owner = house:getDataInt("owner")
        local hid = house:getDataInt("id")
            local player = db.getResult("SELECT `id`,`name`,`lastlogin` FROM `players` WHERE `id` = '"..owner.."'  ")
            if(player:getID() ~= -1) then
                local lastlogin = player:getDataInt("lastlogin")
                local pid = player:getDataInt("id")
                local name = player:getDataString("name")
                time=os.time(t) - lastlogin
                offline = time - days
                if offline >= 0 then
                    pdelete = pdelete.."House #"..hid.." owned by "..name.."\n"
                    if isInArray(safelist,hid) == FALSE then                    
                        setHouseOwner(hid, 0)
                    end
                end
            player:free()
            end
            if not(house:next()) then
                break
            end
        end
            
        house:free()    
        doShowTextDialog(cid, 5958, pdelete)
    else
        doPlayerSendCancel(cid, "Error.")
    end
end
return TRUE
end

works with 0.3
more sql talkactions at OtLand - Threads Tagged with xxgoosexx

Im noob on this , so where do i put it ?
 
Newest TFS :) (TFS 0.3.1 patch 2)

PHP:
function onSay(cid, words, param)
        -- Made By Xikez
	-- Editted By Goose
     	local days = 7*3600*24 -- 7 days
  	local t=os.date('*t')
        local housePos = getFacePosition(cid)
        local houseID = getHouseFromPos(housePos)
        local doorID = getThingfromPos(housePos).itemid
        local msgto = ""
	local player = getPlayerGUID(cid)
        if(isItemDoor(doorID) == 1) then
                if(houseID ~= 0) then
                        if(getHouseOwner(houseID) ~= 0) and (luaGetHouseByPlayerGUID(player) == 0)then
    				local house = db.getResult("SELECT `owner`,`id` FROM `houses` WHERE `id` = '"..houseID.."' ")
				if(house:getID() ~= -1) then
					local owner = house:getDataInt("owner")
       					local hid = house:getDataInt("id")
           				local player = db.getResult("SELECT `id`,`name`,`lastlogin` FROM `players` WHERE `id` = '"..owner.."'  ")
          				if(player:getID() ~= -1) then
                				local lastlogin = player:getDataInt("lastlogin")
                				local pid = player:getDataInt("id")
               					local name = player:getDataString("name")
                				time=os.time(t) - lastlogin
                				offline = time - days
                				if offline >= 0 then
              						if isInArray(safelist,hid) == FALSE then                    
                        					setHouseOwner(hid, 0)
								msgto = "This house is now available to purchase."
                   	 				end
						end
					player:free()
					end
					house:free()
				else
					msgto = "Nobody owns this house."
				end
                        else
                                msgto = "You already own a house."
                        end
                else
                        msgto = "You are not facing a house door."
                end     
        else
                msgto = "You are not facing a door."
        end     
        
        doPlayerSendTextMessage(cid, 24, msgto)
        doPlayerSendTextMessage(cid, 25, words)
        return FALSE        
end
 
function getFacePosition(cid)
        local pos = getPlayerPosition(cid)
        local faceDir = getPlayerLookDir(cid)
        if(faceDir == NORTH) then
                pos.y = pos.y - 1
        elseif(faceDir == EAST) then
                pos.x = pos.x + 1
        elseif(faceDir == SOUTH) then
                pos.y = pos.y + 1
        elseif(faceDir == WEST) then
                pos.x = pos.x - 1
        end     
        return pos
end

try this.. not sure if it will work, you may have to play with some of the lua function for the houses

for some reason it prints out the time, i am not sure whats going on with it, maybe it will be a good start for you :) sorry i dont have lots of time to debug it at the moment
 
Last edited:
Tnx but when i put your script to my OT and when im using this command it showing error on line 13:
if(getHouseOwner(houseID) ~= 0) and (luaGetHouseByPlayerGUID(player) == 0) then
and it means that function (luaGetHouseByPlayerGUID(player) == 0) is a nil value (it's not exist) so when I've deleted it, it's not showing any errors but it's not working properly :/
Sometimes it's showing that "You are not facing a door." and when it's not showing any errors it's not doing anything else, it's not evicting the player from his house.
 
Ok and now:
If someone is not login on his character for 7 days (like in script) then it's showing:
"You are not facing a door" and it's not doing anything :| (it's not evicting the player from his house)
but if someone is login on his character for 7 days then it's not showing anything just my command and it's not doing anything xd
Can you configure the script please? :p
 
Ok and now:
If someone is not login on his character for 7 days (like in script) then it's showing:
"You are not facing a door" and it's not doing anything :| (it's not evicting the player from his house)
but if someone is login on his character for 7 days then it's not showing anything just my command and it's not doing anything xd
Can you configure the script please? :p

i dont know the door thing didnt work for 0.3 i even tried the other script you pasted, and it didn't work. i just removed the line..it would honestly probably be easier to do this in source and make it like the buyhouse command
 
Back
Top