• 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!

Problem z TFS !~!~! HELP !~!~!

Micki

New Member
Joined
May 16, 2009
Messages
538
Reaction score
4
Problem z TFS

Witam,


Mam mały problem z silnikiem TFS. Dziś dodałem do silnika Quest by gęsior na Arenę SVARGROND... Arena działa bardzo dobrze ale jest mały problem nie związany z areną gdy wyszedłem playerem z temple i padłem nie straciłem bp i straciłem bardzo mało expa. Nie miałem ani Aol'a ani 5 blessów. Miałem 100 lvl. Nie wiem jak to naprawić, moze wy wiecie jak tak to proszę o odpowiedź


Mój plik kills.lua:


Code:
function onKill(cid, target)
---- BOUNTY HUNTERS START -----
pid = cid
pid2 = getPlayerGUID(target)
    local result_plr = db.getResult("SELECT * FROM `bounty_hunters` WHERE `sp_id` = "..pid2.." AND `killed` = 0;")
    if(result_plr:getID() ~= -1) then
    prize = tonumber(result_plr:getDataInt("prize"))
    bid = tonumber(result_plr:getDataInt("id"))
	result_plr:free()
    else
    prize = 0
	bid = 0
    end
if bid ~= 0 and prize ~= 0 then
    db.executeQuery("UPDATE `bounty_hunters` SET `killed` = 1, `k_id`="..getPlayerGUID(cid)..", `kill_time` = " .. os.time() .. " WHERE `id`  = "..bid..";")
	doPlayerAddMoney(cid,prize*1000)
	doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,'[BOUNTY HUNTERS] You killed hunted player, so you gained the reward!')
end
end	
function onKill(cid, target)
    local monster = getCreatureName(target)
    local room = getArenaMonsterIdByName(monster)
    if room > 0 then
        setPlayerStorageValue(cid, room, 1)
        doPlayerSendTextMessage(cid,MESSAGE_EVENT_DEFAULT, 'Mozesz wejsc do kolejnego pokoju areny!')
    end
return TRUE
end



Oraz mój plik login.lua:


Code:
function onLogin(cid)
    registerCreatureEvent(cid, "PlayerKill")
    if (InitArenaScript ~= 0) then
    InitArenaScript = 1
    -- make arena rooms free
        for i = 42300, 42309 do
            setGlobalStorageValue(i, 0)
            setGlobalStorageValue(i+100, 0)
        end
    end
    -- if he did not make full arena 1 he must start from zero
    if getPlayerStorageValue(cid, 42309) < 1 then
        for i = 42300, 42309 do
            setPlayerStorageValue(cid, i, 0)
        end
    end
    -- if he did not make full arena 2 he must start from zero
    if getPlayerStorageValue(cid, 42319) < 1 then
        for i = 42310, 42319 do
            setPlayerStorageValue(cid, i, 0)
        end
    end
    -- if he did not make full arena 3 he must start from zero
    if getPlayerStorageValue(cid, 42329) < 1 then
        for i = 42320, 42329 do
            setPlayerStorageValue(cid, i, 0)
        end
    end
    if getPlayerStorageValue(cid, 42355) == -1 then
        setPlayerStorageValue(cid, 42355, 0) -- did not arena level
    end
    setPlayerStorageValue(cid, 42350, 0) -- time to kick 0
    setPlayerStorageValue(cid, 42352, 0) -- is not in arena 
	
	local loss = getConfigValue('deathLostPercent')
	if(loss ~= nil) then
		for i = PLAYERLOSS_EXPERIENCE, PLAYERLOSS_ITEMS do
			doPlayerSetLossPercent(cid, i, loss)
		end
	end

	registerCreatureEvent(cid, "Mail")
	registerCreatureEvent(cid, "GuildMotd")
	registerCreatureEvent(cid, "PlayerDeath")
	registerCreatureEvent(cid, "BountyHunter")

	return TRUE
end



Zamieszczam te 2 pliki iż przy nich zmieniałem zawartość przy dodawaniu questa i wydaje mi się że gdzieś wpośród nich może tkwić błąd.



PoZdro
 
Last edited:
Troche nie rozumiem o co kaman.Czy o to ze jak padniesz po arenie tracisz mniej expa itp. czy ogolnie.Bo jezeli ogolnie to: ustawiasz to w config.lua "deathLosePercent = 10". A jezeli chodzi z tym bp to musze sobie przypomniec gdzie sie to robilo;p

o to chodzi?
 
Tak chodziło o to ale ja nic nie zmieniałem w configu z tym i dodam że tracę bp co parę zgonów. To co się dzieje nie ma nic wspólnego z areną to samo się dzieje przed wykonaniem areny o po jej wykonaniu... Jeżeli zginę np od demona to nie tracę bp a nie mam aola i zabiera mi bardzo mało hp.



PoZdro
 
Tak, dopiero jak dodałem skrypt na OTS zaczęły się problemy...



,,,
 
Last edited:
pogrzeb z plikiem dodanym do creaturescripts, odpowiadającym za reset areny po dedzie.
 
podmien login.lua na taki
Code:
function onLogin(cid)
    registerCreatureEvent(cid, "PlayerKill")
    if (InitArenaScript ~= 0) then
    InitArenaScript = 1
    -- make arena rooms free
        for i = 42300, 42309 do
            setGlobalStorageValue(i, 0)
            setGlobalStorageValue(i+100, 0)
        end
    end
    -- if he did not make full arena 1 he must start from zero
    if getPlayerStorageValue(cid, 42309) < 1 then
        for i = 42300, 42309 do
            setPlayerStorageValue(cid, i, 0)
        end
    end
    -- if he did not make full arena 2 he must start from zero
    if getPlayerStorageValue(cid, 42319) < 1 then
        for i = 42310, 42319 do
            setPlayerStorageValue(cid, i, 0)
        end
    end
    -- if he did not make full arena 3 he must start from zero
    if getPlayerStorageValue(cid, 42329) < 1 then
        for i = 42320, 42329 do
            setPlayerStorageValue(cid, i, 0)
        end
    end
    if getPlayerStorageValue(cid, 42355) == -1 then
        setPlayerStorageValue(cid, 42355, 0) -- did not arena level
    end
    setPlayerStorageValue(cid, 42350, 0) -- time to kick 0
    setPlayerStorageValue(cid, 42352, 0) -- is not in arena 
	
	local loss = getConfigValue('deathLostPercent')
	if(loss ~= nil) then
		doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
	end
	end

	registerCreatureEvent(cid, "Mail")
	registerCreatureEvent(cid, "GuildMotd")
	registerCreatureEvent(cid, "PlayerDeath")
	registerCreatureEvent(cid, "BountyHunter")

	return TRUE
end
I dodatkowo ustaw wszysztkim playerom w bazie wszystkie loos-y na 100
 
chciałem sprawdzić gdzie jest błąd czy w arenie czy bounty zaraz co dam jak masz zrobić.

zrób tak do creaturescripts.xml dodaj
Code:
<event type="kill" name="BountyHunter" script="kill1.lua"/>
do login.lua dodaj po:
Code:
registerCreatureEvent(cid, "PlayerDeath")
dodaj
Code:
registerCreatureEvent(cid, "BountyHunter")
Następnie w creaturescripts/scripts zrób sobie plik kill1.lua i wklej w nim:
Code:
[COLOR=#000000][COLOR=#007700]function [/COLOR][COLOR=#0000BB]onKill[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]cid[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]target[/COLOR][COLOR=#007700]) 
    if [/COLOR][COLOR=#0000BB]isPlayer[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]target[/COLOR][COLOR=#007700]) == [/COLOR][COLOR=#0000BB]TRUE then 
        local result [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]db[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000BB]getResult[/COLOR][COLOR=#007700]([/COLOR][COLOR=#DD0000]"SELECT * FROM `bounty_hunters` WHERE `sp_id` = "[/COLOR][COLOR=#007700].. [/COLOR][COLOR=#0000BB]getPlayerGUID[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]target[/COLOR][COLOR=#007700]) ..[/COLOR][COLOR=#DD0000]" AND `killed` = 0;"[/COLOR][COLOR=#007700]) 
        [/COLOR][COLOR=#0000BB]local prize [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]0 
        local bid [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]0 
        [/COLOR][COLOR=#007700]if [/COLOR][COLOR=#0000BB]result[/COLOR][COLOR=#007700]:[/COLOR][COLOR=#0000BB]getID[/COLOR][COLOR=#007700]() ~= [/COLOR][COLOR=#0000BB]LUA_ERROR then 
            prize [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]tonumber[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]result[/COLOR][COLOR=#007700]:[/COLOR][COLOR=#0000BB]getDataInt[/COLOR][COLOR=#007700]([/COLOR][COLOR=#DD0000]"prize"[/COLOR][COLOR=#007700])) 
            [/COLOR][COLOR=#0000BB]bid [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]tonumber[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]result[/COLOR][COLOR=#007700]:[/COLOR][COLOR=#0000BB]getDataInt[/COLOR][COLOR=#007700]([/COLOR][COLOR=#DD0000]"id"[/COLOR][COLOR=#007700])) 
            [/COLOR][COLOR=#0000BB]result[/COLOR][COLOR=#007700]:[/COLOR][COLOR=#0000BB]free[/COLOR][COLOR=#007700]() 
        [/COLOR][COLOR=#0000BB]end 
        [/COLOR][COLOR=#007700]if [/COLOR][COLOR=#0000BB]bid [/COLOR][COLOR=#007700]~= [/COLOR][COLOR=#0000BB]0 [/COLOR][COLOR=#007700]and [/COLOR][COLOR=#0000BB]prize [/COLOR][COLOR=#007700]~= [/COLOR][COLOR=#0000BB]0 [/COLOR][COLOR=#007700]and [/COLOR][COLOR=#0000BB]not[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]getTileInfo[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]getCreaturePosition[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]cid[/COLOR][COLOR=#007700])).[/COLOR][COLOR=#0000BB]pvp[/COLOR][COLOR=#007700]) [/COLOR][COLOR=#0000BB]then 
            local k_id [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]getPlayerGUID[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]cid[/COLOR][COLOR=#007700]) 
            [/COLOR][COLOR=#0000BB]db[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000BB]executeQuery[/COLOR][COLOR=#007700]([/COLOR][COLOR=#DD0000]"UPDATE `bounty_hunters` SET `killed` = 1, `k_id`="[/COLOR][COLOR=#007700].. [/COLOR][COLOR=#0000BB]k_id [/COLOR][COLOR=#007700]..[/COLOR][COLOR=#DD0000]", `kill_time` = "[/COLOR][COLOR=#007700].. [/COLOR][COLOR=#0000BB]os[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000BB]time[/COLOR][COLOR=#007700]() ..[/COLOR][COLOR=#DD0000]" WHERE `id`  = "[/COLOR][COLOR=#007700].. [/COLOR][COLOR=#0000BB]bid [/COLOR][COLOR=#007700]..[/COLOR][COLOR=#DD0000]";"[/COLOR][COLOR=#007700]) 
            [/COLOR][COLOR=#0000BB]doPlayerAddMoney[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]cid[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]prize [/COLOR][COLOR=#007700]* [/COLOR][COLOR=#0000BB]1000[/COLOR][COLOR=#007700]) 
            [/COLOR][COLOR=#0000BB]doPlayerSendTextMessage[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]cid[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]MESSAGE_STATUS_CONSOLE_BLUE[/COLOR][COLOR=#007700], [/COLOR][COLOR=#DD0000]"[BOUNTY HUNTERS] You killed hunted player, so you gained the reward!"[/COLOR][COLOR=#007700]) 
        [/COLOR][COLOR=#0000BB]end 
    end 
    [/COLOR][COLOR=#007700]return [/COLOR][COLOR=#0000BB]TRUE 
end[/COLOR][/COLOR]
 
Last edited:
Back
Top