What's new

Support Scripts - naprawiamy / tworzymy

Status
Not open for further replies.

czuk123

Active User
Joined
Dec 8, 2008
Messages
73
Reaction score
0
Odp: Support Scripts - naprawiamy / tworzymy

mustang nie dziala.

ErMex reput.

a teraz kolejny problem.
skrypt na transformation ring. gdy trafi z sms shopu bezposrednio do slotu na ringi silnik sie crashuje.

tutaj skrypt

Code:
local outfit =
{
-- Girls
{
lookType = 12,
lookHead = 19,
lookBody = 53,
lookLegs = 92,
lookFeet = 79,
lookAddons = 0
},
-- Boys
{
lookType = 12,
lookHead = 19,
lookBody = 79,
lookLegs = 3,
lookFeet = 81,
lookAddons = 0
}
}
local coinID = ITEM_GOLD_COIN
local wastingInterval = 1000
local wastingQuantity = 1
local triggerQuantity = 100
local warnOnLowSupply = TRUE
local lowSupplyMargin = 200
local storage = 50780
-- Config << --
local condition1 = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition1, CONDITION_PARAM_TICKS, -1)
setConditionParam(condition1, CONDITION_PARAM_SKILL_FIST, 120)
setConditionParam(condition1, CONDITION_PARAM_SKILL_FISHING, 120)
setConditionParam(condition1, CONDITION_PARAM_SKILL_CLUB, 120)
setConditionParam(condition1, CONDITION_PARAM_SKILL_SWORD, 120)
setConditionParam(condition1, CONDITION_PARAM_SKILL_AXE, 120)
setConditionParam(condition1, CONDITION_PARAM_SKILL_DISTANCE, 120)
setConditionParam(condition1, CONDITION_PARAM_SKILL_SHIELD, 120)
setConditionParam(condition1, CONDITION_PARAM_SKILL_FISHING, 120)
setConditionParam(condition1, CONDITION_PARAM_STAT_MAGICPOINTS, 120)
setConditionParam(condition1, CONDITION_PARAM_STAT_MAXHITPOINTSPERCENT, 180)
setConditionParam(condition1, CONDITION_PARAM_STAT_MAXMANAPOINTSPERCENT, 180)
local condition2 = createConditionObject(CONDITION_HASTE)
setConditionParam(condition2, CONDITION_PARAM_TICKS, -1)
setConditionFormula(condition2, 2.5, 0, 3.0, 0)
local area = createCombatArea({
{0, 0, 0, 1, 0, 0, 0},
{0, 1, 0, 0, 0, 1, 0},
{0, 0, 0, 0, 0, 0, 0},
{1, 0, 0, 2, 0, 0, 1},
{0, 0, 0, 0, 0, 0, 0},
{0, 1, 0, 0, 0, 1, 0},
{0, 0, 0, 1, 0, 0, 0}
})
local animCombat = 
{
createCombatObject(),
createCombatObject()
}
local sexyEffect =
{
CONST_ME_FIREWORK_RED,
CONST_ME_FIREWORK_YELLOW,
CONST_ME_MAGIC_RED,
CONST_ME_MAGIC_GREEN
}
setCombatParam(animCombat[2], COMBAT_PARAM_EFFECT, CONST_ME_HOLYAREA)
setCombatParam(animCombat[2], COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLHOLY)
setCombatParam(animCombat[1], COMBAT_PARAM_EFFECT, CONST_ME_FIREWORK_RED)
setCombatParam(animCombat[1], COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
setCombatArea(animCombat[2], area)
setCombatArea(animCombat[1], area)
local function StopSuperForm(cid)
if (getPlayerStorageValue(cid, storage) == 1) then
setPlayerStorageValue(cid, storage, 0)
doRemoveCondition(cid, CONDITION_OUTFIT)
doRemoveCondition(cid, CONDITION_ATTRIBUTES)
doRemoveCondition(cid, CONDITION_HASTE)
end
return TRUE
end
local function SuperForm(cid, sexIndex)
if (isCreature(cid)) then
if (getPlayerStorageValue(cid, storage) == 1) then
local goldLeft = getPlayerItemCount(cid, coinID)
if (goldLeft >= wastingQuantity) then
local position = getCreaturePosition(cid)
doPlayerRemoveItem(cid, coinID, wastingQuantity)
doSendMagicEffect(position, sexyEffect[sexIndex + 2])
doSendMagicEffect(position, sexyEffect[sexIndex])
if (goldLeft <= lowSupplyMargin and warnOnLowSupply == TRUE) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Coins left: " ..(goldLeft - wastingQuantity) .. "!")
end
addEvent(SuperForm, wastingInterval, cid, sexIndex)
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Your bangle has been destroyed!")
doPlayerRemoveItem(cid, 2127, 1)
return StopSuperForm(cid)
end
end
end
end
function onEquip(cid, item, slot)
if (getPlayerItemCount(cid, coinID) > triggerQuantity and getPlayerStorageValue(cid, storage) ~= 1) then
local sexIndex = getPlayerSex(cid) + 1
doCombat(cid, animCombat[sexIndex], numberToVariant(cid))
doSetCreatureOutfit(cid, outfit[sexIndex], -1)
setPlayerStorageValue(cid, storage, 1)
doAddCondition(cid, condition1)
doAddCondition(cid, condition2)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
doPlayerAddMana(cid, getPlayerMaxMana(cid) - getPlayerMana(cid)) 
doPlayerRemoveItem(cid, coinID, triggerQuantity)
SuperForm(cid, sexIndex)
elseif (getPlayerStorageValue(cid, storage) == 1) then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You cannot equip this now!")
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You do not have enough coins!")
end
return TRUE
end
function onDeEquip(cid, item, slot)
return StopSuperForm(cid)
end

i jeszcze to wq razie czego

Code:
<movevent type="Equip" itemid="2127" slot="ring" event="script" value="chaosbangle.lua"/>
<movevent type="DeEquip" itemid="2127" slot="ring" event="script" value="chaosbangle.lua"/>
 
Last edited by a moderator:

Oskar

Forum friend
Joined
Jan 24, 2009
Messages
2,256
Reaction score
331
Odp: Support Scripts - naprawiamy / tworzymy

PHP:
local outfit = { 
                { 
                lookType = 12, 
                lookHead = 19, 
                lookBody = 53, 
                lookLegs = 92, 
                lookFeet = 79, 
                lookAddons = 0 
                }, 

                { 
                lookType = 12, 
                lookHead = 19, 
                lookBody = 79, 
                lookLegs = 3, 
                lookFeet = 81, 
                lookAddons = 0 
                } 
                } 
local coinID = 2148 
local wastingInterval = 1000 
local wastingQuantity = 1 
local triggerQuantity = 100 
local warnOnLowSupply = TRUE 
local lowSupplyMargin = 200 
local storage = 50780 
-- Config << -- 
local condition1 = createConditionObject(CONDITION_ATTRIBUTES) 
setConditionParam(condition1, CONDITION_PARAM_TICKS, -1) 
setConditionParam(condition1, CONDITION_PARAM_SKILL_FIST, 120) 
setConditionParam(condition1, CONDITION_PARAM_SKILL_FISHING, 120) 
setConditionParam(condition1, CONDITION_PARAM_SKILL_CLUB, 120) 
setConditionParam(condition1, CONDITION_PARAM_SKILL_SWORD, 120) 
setConditionParam(condition1, CONDITION_PARAM_SKILL_AXE, 120) 
setConditionParam(condition1, CONDITION_PARAM_SKILL_DISTANCE, 120) 
setConditionParam(condition1, CONDITION_PARAM_SKILL_SHIELD, 120) 
setConditionParam(condition1, CONDITION_PARAM_SKILL_FISHING, 120) 
setConditionParam(condition1, CONDITION_PARAM_STAT_MAGICPOINTS, 120) 
setConditionParam(condition1, CONDITION_PARAM_STAT_MAXHITPOINTSPERCENT, 180) 
setConditionParam(condition1, CONDITION_PARAM_STAT_MAXMANAPOINTSPERCENT, 180) 
local condition2 = createConditionObject(CONDITION_HASTE) 
setConditionParam(condition2, CONDITION_PARAM_TICKS, -1) 
setConditionFormula(condition2, 2.5, 0, 3.0, 0) 
local area = createCombatArea({ 
                                {0, 0, 0, 1, 0, 0, 0}, 
                                {0, 1, 0, 0, 0, 1, 0}, 
                                {0, 0, 0, 0, 0, 0, 0}, 
                                {1, 0, 0, 2, 0, 0, 1}, 
                                {0, 0, 0, 0, 0, 0, 0}, 
                                {0, 1, 0, 0, 0, 1, 0}, 
                                {0, 0, 0, 1, 0, 0, 0} 
                                }) 
local animCombat = { 
                    createCombatObject(), 
                    createCombatObject() 
                    } 
local sexyEffect = { 
                    CONST_ME_FIREWORK_RED, 
                    CONST_ME_FIREWORK_YELLOW, 
                    CONST_ME_MAGIC_RED, 
                    CONST_ME_MAGIC_GREEN 
                    } 
setCombatParam(animCombat[2], COMBAT_PARAM_EFFECT, CONST_ME_HOLYAREA) 
setCombatParam(animCombat[2], COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLHOLY) 
setCombatParam(animCombat[1], COMBAT_PARAM_EFFECT, CONST_ME_FIREWORK_RED) 
setCombatParam(animCombat[1], COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE) 
setCombatArea(animCombat[2], area) 
setCombatArea(animCombat[1], area) 
local function StopSuperForm(cid) 
if (getPlayerStorageValue(cid, storage) == 1) then 
setPlayerStorageValue(cid, storage, 0) 
doRemoveCondition(cid, CONDITION_OUTFIT) 
doRemoveCondition(cid, CONDITION_ATTRIBUTES) 
doRemoveCondition(cid, CONDITION_HASTE) 
end 
return TRUE 
end 
local function SuperForm(cid, sexIndex) 
if (isCreature(cid)) then 
if (getPlayerStorageValue(cid, storage) == 1) then 
local goldLeft = getPlayerItemCount(cid, coinID) 
if (goldLeft >= wastingQuantity) then 
local position = getCreaturePosition(cid) 
doPlayerRemoveItem(cid, coinID, wastingQuantity) 
doSendMagicEffect(position, sexyEffect[sexIndex + 2]) 
doSendMagicEffect(position, sexyEffect[sexIndex]) 
if (goldLeft <= lowSupplyMargin and warnOnLowSupply == TRUE) then 
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Coins left: " ..(goldLeft - wastingQuantity) .. "!") 
end 
addEvent(SuperForm, wastingInterval, cid, sexIndex) 
else 
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Your bangle has been destroyed!") 
doPlayerRemoveItem(cid, 2127, 1) 
return StopSuperForm(cid) 
end 
end 
end 
end 
function onEquip(cid, item, slot) 
if (getPlayerItemCount(cid, coinID) > triggerQuantity and getPlayerStorageValue(cid, storage) ~= 1 and getPlayerSex(cid) < 2) then 
	local sexIndex = getPlayerSex(cid) + 1
	doCombat(cid, animCombat[sexIndex], numberToVariant(cid)) 
	doSetCreatureOutfit(cid, outfit[sexIndex], -1) 
	setPlayerStorageValue(cid, storage, 1) 
	doAddCondition(cid, condition1) 
	doAddCondition(cid, condition2) 
	doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid)) 
	doPlayerAddMana(cid, getPlayerMaxMana(cid) - getPlayerMana(cid))  
	doPlayerRemoveItem(cid, coinID, triggerQuantity) 
	SuperForm(cid, sexIndex) 
elseif (getPlayerStorageValue(cid, storage) == 1) then 
	doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You cannot equip this now!") 
else 
	doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You do not have enough coins!") 
end 
return TRUE 
end 
function onDeEquip(cid, item, slot) 
return StopSuperForm(cid) 
end

#down
Wygl?da mi to na 7.6. Nie robi? takich skrypt?w.
 
Last edited:

robert891

Active User
Joined
Apr 21, 2009
Messages
121
Reaction score
0
Odp: Support Scripts - naprawiamy / tworzymy

PHP:
local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false
 
function onThingMove(creature, thing, oldpos, oldstackpos, item, itemEx)
 
end
 
 
function onCreatureAppear(creature)
 
end
 
 
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye then.')
focus = 0
talk_start = 0
end
end
function getPokemonMaxLife(name)
                local file = io.open('data/monster/monsters.xml','r')
                local arquivo = file:read(-1):lower():match('<monster name="'..name:lower()..'" file="(.-)"/>')
                file:close()
                local data = io.open('data/monster/'..(arquivo or ''),'r')
                if not data then
                        return 100
                end
                local maximo = data:read(-1):match('max%s*=%s*"(%d+)"')
                data:close()
                return maximo
end
 
function onCreatureTurn(creature)
 
end
 
function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
 
 
function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if (msgcontains(msg, 'hi')) and getDistanceToCreature(cid) < 4 then
	if getPlayerStorageValue(cid, 25000) == 5 then       
	return selfSay('Voc? est? montando.')
	end
	if getPlayerStorageValue(cid, 23000) == 5 then
	return selfSay('Twoj pokemon musi byc zchowany.')
	end
if #getCreatureSummons(cid) >= 1 then
selfSay('Zsiadaj z niego.')
focus = 0
talk_start = 0
return TRUE
end 

local idballs = {
[2532] = {2531},
[2653] = {2557},
[2654] = {2525},
[2652] = {2524},
[2195] = {2523},
[2531] = {2532},
[2557] = {2653},
[2525] = {2654},
[2524] = {2652},
[2523] = {2195},
}

local balls = idballs[getPlayerSlotItem(cid,8).itemid]
if balls == nil then
return selfSay('chowaj GO!')
end


local nome = getItemAttribute(getPlayerSlotItem(cid,8).uid,"name")
local poke_name1 = nome:match('(.-) Pokeball')
local poke_name2 = nome:match('(.-) Superball')
local poke_name3 = nome:match('(.-) Ultraball')
local poke_name4 = nome:match('(.-) Greatball')
local poke_name5 = nome:match('(.-) Masterball')

if poke_name1 == nil and poke_name2 == nil and poke_name3 == nil and poke_name4 == nil and poke_name5 == nil then
return doPlayerSendCancel(cid,"coloque no lugar correto")
end

if poke_name1 ~= nil then
poke_name = poke_name1
elseif poke_name2 ~= nil then 
poke_name = poke_name2
elseif poke_name3 ~= nil then 
poke_name = poke_name3
elseif poke_name4 ~= nil then 
poke_name = poke_name4
elseif poke_name5 ~= nil then 
poke_name = poke_name5
end

doItemSetAttribute(getPlayerSlotItem(cid,8).uid, "aid", getPokemonMaxLife(poke_name))
selfSay("Lecisz z tym koksem!")
doTransformItem(getPlayerSlotItem(cid, 8).uid, balls[1])
local hp = getCreatureMaxHealth(cid)
doCreatureAddHealth(cid, hp)

focus = 0
talk_start = 0
end
end
 
function onCreatureChangeOutfit(creature)
 
end
Chce zeby leczylo all pokemony nie ogarniam tego :D
 
Last edited:

adsko

User
Joined
Apr 4, 2008
Messages
28
Reaction score
1
Odp: Support Scripts - naprawiamy / tworzymy

typ: talkaction
Ja chcia?bym co? takiego jak !rank (skrypt Mistersi) tylko nie by wczytywalo lvl itp tylko z bazy danych wczytalo mi w zak?adce players kolumne frags, i wyswietlilo 15 najwiekszych wynikow i nicki ich nosicieli :D

//By nie bylo mozna go potraktowac dwojako, jako przerobienie skryptu Mistersi albo napisanie nowego, jak cos prosze przeniesc do drogiego tematu ;/
 
Last edited:

Mistersi

Active User
Joined
Nov 28, 2010
Messages
54
Reaction score
0
Odp: Support Scripts - naprawiamy / tworzymy

Skrypt:
PHP:
local config = {
                ile_dodaje_hp = 500,
                o_ile_procent_zwieksza_obrazenia = 110,
                ile_bierze_many = 10,
                co_ile_sec = 1,
                efekt_podczas_zmiany = CONST_ME_HOLYAREA
                }
local storage_obrazen = 4135

function onSay(cid, words, param)
if param == "" then
    setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + config.ile_dodaje_hp)
    doPlayerSetStorageValue(cid, storage_obrazen, config.o_ile_procent_zwieksza_obrazenia)
    doSendMagicEffect(getCreaturePosition(cid), config.efekt_podczas_zmiany)
    doCreatureAddMana(cid, -config.ile_bierze_many, false)
    addEvent(mana_gain, config.co_ile_sec * 1000, {cid = cid})
end
return true
end

function mana_gain(p)
if isPlayer(p.cid) then
    if getCreatureMana(p.cid) >= config.ile_bierze_many then
        doCreatureAddMana(p.cid, -config.ile_bierze_many, false)
        addEvent(mana_gain, config.co_ile_sec * 1000, p)
    else
        doPlayerSetStorageValue(p.cid, storage_obrazen, 0)
        setCreatureMaxHealth(p.cid, getCreatureMaxHealth(p.cid) - config.ile_dodaje_hp)
        doCreatureAddHealth(p.cid, 1)
    end
end
return true
end
Opis: Czy da?oby si? do tego skryptu doda?, ?e np. 1 voc zmienia si? w 8, 2 voc w 9 itd, ?eby m?g? sobie sam doda?.
 

konio13

Active User
Joined
May 8, 2008
Messages
131
Reaction score
9
Age
30
Odp: Support Scripts - naprawiamy / tworzymy

TFS 0.3.6 Poke Ots
Prosze O Pomoc W Tym Skrypcie,
Mamy pokeballa na slocie stop> Lapie nam pokemona w pokeballu dp bp
Nie Mamy Pokeballa na slocie stop> Lapie nam do slota stop
Co Zrobic Aby Jezeli niema nic w slocie stop aby lapal do bp ?

Actions
lapanie.lua
PHP:
local szansa = {
['abra'] = 15,
['shiny abra'] = 15,
}
local ID_GREATBALL = 2146
local ID_SUPERBALL = 2147
local ID_ULTRABALL = 2150
local ID_MASTERBALL = 2554
local ID_LAPIE = 24
local ID_NIE_LAPIE = 23
local pokebolas = {
[2149] = {2532,"Pokeball"},
[2147] = {2653,"Superball"},
[2146] = {2652,"Greatball"},
[2150] = {2654,"Ultraball"},
[2521] = {2195,"Masterball"},
}
local level = {
['abra'] = 30,
['shiny abra'] = 30,
}
local function lapie(params)
doSendMagicEffect(getCreaturePosition(params.cid), 173)
doPlayerSendTextMessage(params.cid, 25, 'Zlapales Pokemona! ('..params.monster..').')
item = doCreateItemEx(params.ball)
doItemSetAttribute(item, "name", ""..params.monster.." "..params.ball2)
doItemSetAttribute(item, "level", params.level)
doItemSetAttribute(item, "aid", params.hp)
doPlayerAddItemEx(params.cid, item, true)
end
local function nielapie(params)
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
local monster = getItemName(itemEx.uid):match("dead (.*)")
if item.itemid == ID_GREATBALL then
szansas = (szansa[monster]) * 2
elseif item.itemid == ID_SUPERBALL then
szansas = (szansa[monster]) * 3
elseif item.itemid == ID_ULTRABALL then
szansas = (szansa[monster]) * 4
elseif item.itemid == 2521 then
szansas = (szansa[monster]) * 400
else
szansas = szansae[monster]
end

if not szansa[monster] then
return doPlayerSendTextMessage(cid, 23, 'Nie udalo ci sie zlapac Pokemona!')
end

if math.random(1,1000) <= szansas then
if item.itemid == 2149 then
doSendMagicEffect(toPosition, 24)
elseif item.itemid == 2147 then
doSendMagicEffect(toPosition, 202)
elseif item.itemid == 2146 then
doSendMagicEffect(toPosition, 198)
elseif item.itemid == 2150 then
doSendMagicEffect(toPosition, 200)
elseif item.itemid == 2521 then
doSendMagicEffect(toPosition, 24)
end

local hpmax = 1
local ball = pokebolas[item.itemid]
addEvent(lapie, 4000, {cid = cid, monster = monster, ball = ball[1], ball2 = ball[2], level = level[monster], hp = hpmax})
doRemoveItem(itemEx.uid, 1)
doRemoveItem(item.uid, 1)
else
if item.itemid == 2149 then
doSendMagicEffect(toPosition, 23)
elseif item.itemid == 2147 then
doSendMagicEffect(toPosition, 201)
elseif item.itemid == 2146 then
doSendMagicEffect(toPosition, 197)
elseif item.itemid == 2150 then
doSendMagicEffect(toPosition, 199)
elseif item.itemid == 2521 then
doSendMagicEffect(toPosition, 23)
end
doRemoveItem(itemEx.uid, 1)
doRemoveItem(item.uid, 1)
end
return TRUE
end
 
Last edited:

Oskar

Forum friend
Joined
Jan 24, 2009
Messages
2,256
Reaction score
331
Odp: Support Scripts - naprawiamy / tworzymy

#adsko
Nie ma poj?cia czy masz w 'players' zak?adk? frags, ale trzymaj:
PHP:
function onSay(cid, words, param)
if param == "" then
	x = 'Najlepsi mordercy:\n'
	local frags, names = {}, {}
	for i = 1, 250 do
		row = db.getResult('SELECT `frags`, `name` FROM `players` WHERE `id` = '..i..';')
		local frag, name = row:getDataInt('frags'), row:getDataString('name')
		table.insert(frags, frag)
		table.insert(names, name)
	end
		table.sort(frags)
	if #frags > 15 then
		for v = #frags - 15, 1, -1 do
			table.remove(frags, v)
		end
	end
	for k = #frags, 1, -1 do
		x = x .. names[k] .. ' - ' .. frags[k] .. '\n'
	end
	doShowTextDialog(cid, 5669, x)
end
return true
end
Je?li wyskocz? b??dy to dlatego, ?e sprawdzam ka?de id, kt?re masz w bazie danych, je?li kt?rego? zabraknie to wywali b??d i przerwie skrypt. Nie wiem jak to naprawi?. Wybacz.

#Mistersi
PHP:
local config = { 
				vocs = {8, 9, 10, 11},
                ile_dodaje_hp = 500, 
                o_ile_procent_zwieksza_obrazenia = 110, 
                ile_bierze_many = 10, 
                co_ile_sec = 1, 
                efekt_podczas_zmiany = CONST_ME_HOLYAREA 
                } 
local storage_obrazen = 4135 

function onSay(cid, words, param) 
if param == "" then
	for i = 1, #config.vocs do
		if getPlayerVocation(cid) == i then
			doPlayerSetVocation(cid, config.vocs[i])
		end
	end
    setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + config.ile_dodaje_hp) 
    doPlayerSetStorageValue(cid, storage_obrazen, config.o_ile_procent_zwieksza_obrazenia) 
    doSendMagicEffect(getCreaturePosition(cid), config.efekt_podczas_zmiany) 
    doCreatureAddMana(cid, -config.ile_bierze_many, false) 
    addEvent(mana_gain, config.co_ile_sec * 1000, {cid = cid}) 
end 
return true 
end 

function mana_gain(p) 
if isPlayer(p.cid) then 
    if getCreatureMana(p.cid) >= config.ile_bierze_many then 
        doCreatureAddMana(p.cid, -config.ile_bierze_many, false) 
        addEvent(mana_gain, config.co_ile_sec * 1000, p) 
    else 
        doPlayerSetStorageValue(p.cid, storage_obrazen, 0) 
        setCreatureMaxHealth(p.cid, getCreatureMaxHealth(p.cid) - config.ile_dodaje_hp) 
        doCreatureAddHealth(p.cid, 1) 
    end 
end 
return true 
end
W tabelce vocs = {8, 9, 10, 11}, piszesz w jak? profesj? ma si? zamieni? - kolejno numer 1 w 8, numer 2 w 9, numer 3 w 10, numer 4 w 11.

#up
Nie bawi? si? w pokemony.

#down
W?a?nie o tym m?wi?. Ten b??d pojawia si? gdy w bazie danych brakuje jakiego? id.
U mnie na przyk?ad jest - 1, 2, 3, 6, 10, 12. Wi?c skrypt przerwie dzia?anie przy 3.
 
Last edited:

adsko

User
Joined
Apr 4, 2008
Messages
28
Reaction score
1
Odp: Support Scripts - naprawiamy / tworzymy

Oto blad z konsoli:img221.imageshack.us/i/beztytuubw.png/


Code:
local config = {
	advancedFragList = getBooleanFromString(getConfigValue("advancedFragList"))
}

function onSay(cid, words, param, channel)
	local time = os.time()
	local times = {today = (time - 86400), week = (time - (7 * 86400))}

	local contents = {day = {}, week = {}, month = {}}
	local result = db.getResult("SELECT `pd`.`date`, `pd`.`level`, `p`.`name` FROM `player_killers` pk LEFT JOIN `killers` k ON `pk`.`kill_id` = `k`.`id` LEFT JOIN `player_deaths` pd ON `k`.`death_id` = `pd`.`id` LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id` WHERE `pk`.`player_id` = " .. getPlayerGUID(cid) .. " AND `k`.`unjustified` = 1 AND `pd`.`date` >= " .. (time - (30 * 86400)) .. " ORDER BY `pd`.`date` DESC")
	if(result:getID() ~= -1) then
		repeat
			local content = {
				name = result:getDataString("name"),
				level = result:getDataInt("level"),
				date = result:getDataInt("date")
			}
			if(content.date > times.today) then
				table.insert(contents.day, content)
			elseif(content.date > times.week) then
				table.insert(contents.week, content)
			else
				table.insert(contents.month, content)
			end
		until not result:next()
		result:free()
	end

	local size = {
		day = table.maxn(contents.day),
		week = table.maxn(contents.week),
		month = table.maxn(contents.month)
	}
	if(config.advancedFragList) then
		local result = "Frags gained today: " .. size.day .. "."
		if(size.day > 0) then
			for _, content in ipairs(contents.day) do
				result = result .. "\n* " .. os.date("%d %B %Y %X at ", content.date) .. content.name .. " on level " .. content.level
			end

			result = result .. "\n"
		end

		result = result .. "\nFrags gained this week: " .. (size.day + size.week) .. "."
		if(size.week > 0) then
			for _, content in ipairs(contents.week) do
				result = result .. "\n* " .. os.date("%d %B %Y %X at ", content.date) .. content.name .. " on level " .. content.level
			end

			result = result .. "\n"
		end

		result = result .. "\nFrags gained this month: " .. (size.day + size.week + size.month) .. "."
		if(size.month > 0) then
			for _, content in ipairs(contents.month) do
				result = result .. "\n* " .. os.date("%d %B %Y %X at ", content.date) .. content.name .. " on level " .. content.level
			end

			result = result .. "\n"
		end

		local skullEnd = getPlayerSkullEnd(cid)
		if(skullEnd > 0) then
			result = result .. "\nYour " .. (getCreatureSkullType(cid) == SKULL_RED and "red" or "black") .. " skull will expire at " .. os.date("%d %B %Y %X", skullEnd)
		end

		doPlayerPopupFYI(cid, result)
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You currently have " .. size.day .. " frags today, " .. (size.day + size.week) .. " this week and " .. (size.day + size.week + size.month) .. " this month.")
		if(size.day > 0) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Last frag at " .. os.date("%d %B %Y %X", contents.day[1].date) .. " on level " .. contents.day[1].level .. " (" .. contents.day[1].name .. ").")
		end

		local skullEnd = getPlayerSkullEnd(cid)
		if(skullEnd > 0) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your " .. (getCreatureSkullType(cid) == SKULL_RED and "red" or "black") .. " skull will expire at " .. os.date("%d %B %Y %X", skullEnd))
		end
	end

	return true
end
a tego skryptu nie dalo by sie jakos przerobic?


//A jakby dac jakiegos if ktory by sprawdzal czy id ma nick jak nie to leci do nastepnego id?? wtedy skrypt nie powinien siadac na tym;]
 
Last edited:

kyraaaa

Active User
Joined
Jun 11, 2010
Messages
50
Reaction score
3
Odp: Support Scripts - naprawiamy / tworzymy

Typ: (chyba actions i talkactions) sam nie wiem ;)
Opis: Potrzebny mi skrypt na MANASA KTORY SIE NIE KO?CZY, tylko zeby dobrze dzia?a?.
Dodatkowe: SZCZ??LIWEGO NOWEGO ROKU ;)
 

Oskar

Forum friend
Joined
Jan 24, 2009
Messages
2,256
Reaction score
331
Odp: Support Scripts - naprawiamy / tworzymy

Je?li chodzi Ci o potiony to id? do data/actions/scripts/liquids i, w zale?no?ci od silnika, masz potions.lua tudzie? mana_potion.lua itd. Uruchom ten/te plik/i i pousuwaj wszystkie:
PHP:
doRemoveItem(item.uid)
 

pansuchar

Advanced User
Joined
Dec 18, 2008
Messages
174
Reaction score
5
Age
31
Odp: Support Scripts - naprawiamy / tworzymy

Poprosz? o skrypcik, mianowicie mam taki oto skrypt npc'ka Orlan kt?ry sprzedaje promotion, chcia?bym ?eby sprzedawa? jeszcze itemek o id xxxx za cen? 1cc.
PS. Npc jest pod OTS 7.6
Dla wykonawcy Rep+

PHP:
focus = 0
talk_start = 0
target = 0
following = false
attacking = false

function onThingMove(creature, thing, oldpos, oldstackpos)

end


function onCreatureAppear(creature)

end


function onCreatureDisappear(cid, pos)
      if focus == cid then
         selfSay('Dowidzenia.')
          focus = 0
          talk_start = 0
      end
end


function onCreatureTurn(creature)

end
function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not
string.find(txt, str .. '(%w+)'))
end


function onCreatureSay(cid, type, msg)
msg = string.lower(msg)

if ((string.find(msg, '(%a*)hi(%a*)')
or string.find(msg, '(%a*)siema(%a*)')
or string.find(msg, '(%a*)czesc(%a*)')
or string.find(msg, '(%a*)cze(%a*)')
or string.find(msg, '(%a*)yo(%a*)')
or string.find(msg, '(%a*)elo(%a*)'))
and (focus == 0)) and getDistanceToCreature(cid) < 4 then

rsay = math.random(1,4)
if rsay == 1 then says = 'Waazzuup'
elseif rsay == 2 then says = 'Siema'
elseif rsay == 3 then says = 'Czesc'
elseif rsay == 4 then says = 'Witam'
end



 		selfSay('Siemanko ' .. creatureGetName(cid) .. '! Jezeli jestes zainteresowany kupnem pacc wejdz na stronke mazurek.no-ip.biz po lewej stronie masz Premium Accont.')
  		focus = cid
  		talk_start = os.clock()

  	elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
  		selfSay('' .. creatureGetName(cid) .. '! Jezeli jestes zainteresowany kupnem pacc wejdz na stronke mazurek.no-ip.biz po lewej stronie masz Premium Accon')  	elseif focus == cid then
		talk_start = os.clock()

		if msgcontains(msg, 'promotion') or msgcontains(msg, 'promote') then
 			if isPromoted(cid) then
 				selfSay('Juz masz Promotion.')
 				talk_state = 0
 			elseif getPlayerLevel(creatureGetName(cid)) < 10 then
				selfSay('Wybacz potrzeba ci 10 poziom !')
				talk_state = 0
			elseif not isPremium(cid) then
				selfSay('Wybacz, ale najpierw kup Premium Accont!')
				talk_state = 0
			else
				selfSay('Czy chcesz kupic Promotion za 1 k?')
				talk_state = 1
			end

		elseif msgcontains(msg, 'p4323424u3m') then
			selfSay('Do you want to buy 10 premmy hours for 10k?')
			talk_state = 2

		elseif talk_state == 1 then
			if msgcontains(msg, 'yes') or msgcontains(msg, 'tak') then
				if pay(cid,1000) then
					selfSay('/promote ' .. creatureGetName(cid))
					selfSay('Dostales Promotion!')
				else
					selfSay('Wybacz, ale masz za malo pieniedzy.')
				end
 			end
			talk_state = 0

		elseif talk_state == 2 then
			if msgcontains(msg, '3wdf645d3s') then
				if pay(cid,10000) then
					selfSay('/premmy 10 ' .. creatureGetName(cid))
					selfSay('You have 10 premmy hours more!')
				else
					selfSay('Sorry, you do not have enough money.')
				end
			end
			talk_state = 0

  		elseif msgcontains(msg, 'bye')  and getDistanceToCreature(cid) < 4 then
  			selfSay('Narazie ' .. creatureGetName(cid) .. ' . Tylko kup pacc to nam pomoze !')
  			focus = 0
  			talk_start = 0
  		end
  	end
end


function onCreatureChangeOutfit(creature)

end


function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Nastepny prosze.')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Kupujac Pacc wspomagasz Tego OTS!')
focus = 0
end
end
if focus == 0 then
cx, cy, cz = selfGetPosition()
randmove = math.random(1,20)
if randmove == 1 then
nx = cx + 1
end
if randmove == 2 then
nx = cx - 1
end
if randmove == 3 then
ny = cy + 1
end
if randmove == 4 then
ny = cy - 1
end
if randmove >= 5 then
nx = cx
ny = cy
end
moveToPosition(nx, ny, cz)
--summons = 30
--summons2 = 30
end
end

Notka moderatorska:
W g??wnym po?cie wyra?nie widnieje:

Naprawiamy skrypty tylko i wy??cznie pod silniki SQL (8.1+).

aww... nie zauwa?y?em ;/ sorry
 
Last edited:

czuk123

Active User
Joined
Dec 8, 2008
Messages
73
Reaction score
0
Odp: Support Scripts - naprawiamy / tworzymy

@oskar nie dziala. teraz jak pojawi sie ring w slocie to zmienia nas w potwora i crash

Code:
local outfit = { 
                { 
                lookType = 12, 
                lookHead = 19, 
                lookBody = 53, 
                lookLegs = 92, 
                lookFeet = 79, 
                lookAddons = 0 
                }, 

                { 
                lookType = 12, 
                lookHead = 19, 
                lookBody = 79, 
                lookLegs = 3, 
                lookFeet = 81, 
                lookAddons = 0 
                } 
                } 
local coinID = 2148 
local wastingInterval = 1000 
local wastingQuantity = 1 
local triggerQuantity = 100 
local warnOnLowSupply = TRUE 
local lowSupplyMargin = 200 
local storage = 50780 
-- Config << -- 
local condition1 = createConditionObject(CONDITION_ATTRIBUTES) 
setConditionParam(condition1, CONDITION_PARAM_TICKS, -1) 
setConditionParam(condition1, CONDITION_PARAM_SKILL_FIST, 120) 
setConditionParam(condition1, CONDITION_PARAM_SKILL_FISHING, 120) 
setConditionParam(condition1, CONDITION_PARAM_SKILL_CLUB, 120) 
setConditionParam(condition1, CONDITION_PARAM_SKILL_SWORD, 120) 
setConditionParam(condition1, CONDITION_PARAM_SKILL_AXE, 120) 
setConditionParam(condition1, CONDITION_PARAM_SKILL_DISTANCE, 120) 
setConditionParam(condition1, CONDITION_PARAM_SKILL_SHIELD, 120) 
setConditionParam(condition1, CONDITION_PARAM_SKILL_FISHING, 120) 
setConditionParam(condition1, CONDITION_PARAM_STAT_MAGICPOINTS, 120) 
setConditionParam(condition1, CONDITION_PARAM_STAT_MAXHITPOINTSPERCENT, 180) 
setConditionParam(condition1, CONDITION_PARAM_STAT_MAXMANAPOINTSPERCENT, 180) 
local condition2 = createConditionObject(CONDITION_HASTE) 
setConditionParam(condition2, CONDITION_PARAM_TICKS, -1) 
setConditionFormula(condition2, 2.5, 0, 3.0, 0) 
local area = createCombatArea({ 
                                {0, 0, 0, 1, 0, 0, 0}, 
                                {0, 1, 0, 0, 0, 1, 0}, 
                                {0, 0, 0, 0, 0, 0, 0}, 
                                {1, 0, 0, 2, 0, 0, 1}, 
                                {0, 0, 0, 0, 0, 0, 0}, 
                                {0, 1, 0, 0, 0, 1, 0}, 
                                {0, 0, 0, 1, 0, 0, 0} 
                                }) 
local animCombat = { 
                    createCombatObject(), 
                    createCombatObject() 
                    } 
local sexyEffect = { 
                    CONST_ME_FIREWORK_RED, 
                    CONST_ME_FIREWORK_YELLOW, 
                    CONST_ME_MAGIC_RED, 
                    CONST_ME_MAGIC_GREEN 
                    } 
setCombatParam(animCombat[2], COMBAT_PARAM_EFFECT, CONST_ME_HOLYAREA) 
setCombatParam(animCombat[2], COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLHOLY) 
setCombatParam(animCombat[1], COMBAT_PARAM_EFFECT, CONST_ME_FIREWORK_RED) 
setCombatParam(animCombat[1], COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE) 
setCombatArea(animCombat[2], area) 
setCombatArea(animCombat[1], area) 
local function StopSuperForm(cid) 
if (getPlayerStorageValue(cid, storage) == 1) then 
setPlayerStorageValue(cid, storage, 0) 
doRemoveCondition(cid, CONDITION_OUTFIT) 
doRemoveCondition(cid, CONDITION_ATTRIBUTES) 
doRemoveCondition(cid, CONDITION_HASTE) 
end 
return TRUE 
end 
local function SuperForm(cid, sexIndex) 
if (isCreature(cid)) then 
if (getPlayerStorageValue(cid, storage) == 1) then 
local goldLeft = getPlayerItemCount(cid, coinID) 
if (goldLeft >= wastingQuantity) then 
local position = getCreaturePosition(cid) 
doPlayerRemoveItem(cid, coinID, wastingQuantity) 
doSendMagicEffect(position, sexyEffect[sexIndex + 2]) 
doSendMagicEffect(position, sexyEffect[sexIndex]) 
if (goldLeft <= lowSupplyMargin and warnOnLowSupply == TRUE) then 
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Coins left: " ..(goldLeft - wastingQuantity) .. "!") 
end 
addEvent(SuperForm, wastingInterval, cid, sexIndex) 
else 
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Your bangle has been destroyed!") 
doPlayerRemoveItem(cid, 2127, 1) 
return StopSuperForm(cid) 
end 
end 
end 
end 
function onEquip(cid, item, slot) 
if (getPlayerItemCount(cid, coinID) > triggerQuantity and getPlayerStorageValue(cid, storage) ~= 1 and getPlayerSex(cid) < 2) then 
    local sexIndex = getPlayerSex(cid) + 1
    doCombat(cid, animCombat[sexIndex], numberToVariant(cid)) 
    doSetCreatureOutfit(cid, outfit[sexIndex], -1) 
    setPlayerStorageValue(cid, storage, 1) 
    doAddCondition(cid, condition1) 
    doAddCondition(cid, condition2) 
    doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid)) 
    doPlayerAddMana(cid, getPlayerMaxMana(cid) - getPlayerMana(cid))  
    doPlayerRemoveItem(cid, coinID, triggerQuantity) 
    SuperForm(cid, sexIndex) 
elseif (getPlayerStorageValue(cid, storage) == 1) then 
    doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You cannot equip this now!") 
else 
    doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You do not have enough coins!") 
end 
return TRUE 
end 
function onDeEquip(cid, item, slot) 
return StopSuperForm(cid) 
end
 

Oskar

Forum friend
Joined
Jan 24, 2009
Messages
2,256
Reaction score
331
Odp: Support Scripts - naprawiamy / tworzymy

Sprawdzi?em dok?adnie kod, nie ma b??d?w. Je?li wci?? b?dzie crashowa? to niech z sms shopa wrzuca bezpo?rednio do backpacka.
PHP:
local outfit = { 
					{ 
					lookType = 12, 
					lookHead = 19, 
					lookBody = 53, 
					lookLegs = 92, 
					lookFeet = 79, 
					lookAddons = 0 
					}, 
					{ 
					lookType = 12, 
					lookHead = 19, 
					lookBody = 79, 
					lookLegs = 3, 
					lookFeet = 81, 
					lookAddons = 0 
					} 
                }
local wastingInterval = 1000 
local wastingQuantity = 1 
local triggerQuantity = 100 
local warnOnLowSupply = true
local lowSupplyMargin = 200 
local storage = 50780 
-- Config << -- 
local condition1 = createConditionObject(CONDITION_ATTRIBUTES) 
setConditionParam(condition1, CONDITION_PARAM_TICKS, -1) 
setConditionParam(condition1, CONDITION_PARAM_SKILL_FIST, 120) 
setConditionParam(condition1, CONDITION_PARAM_SKILL_FISHING, 120) 
setConditionParam(condition1, CONDITION_PARAM_SKILL_CLUB, 120) 
setConditionParam(condition1, CONDITION_PARAM_SKILL_SWORD, 120) 
setConditionParam(condition1, CONDITION_PARAM_SKILL_AXE, 120) 
setConditionParam(condition1, CONDITION_PARAM_SKILL_DISTANCE, 120) 
setConditionParam(condition1, CONDITION_PARAM_SKILL_SHIELD, 120) 
setConditionParam(condition1, CONDITION_PARAM_SKILL_FISHING, 120) 
setConditionParam(condition1, CONDITION_PARAM_STAT_MAGICPOINTS, 120) 
setConditionParam(condition1, CONDITION_PARAM_STAT_MAXHITPOINTSPERCENT, 180) 
setConditionParam(condition1, CONDITION_PARAM_STAT_MAXMANAPOINTSPERCENT, 180) 
local condition2 = createConditionObject(CONDITION_HASTE) 
setConditionParam(condition2, CONDITION_PARAM_TICKS, -1) 
setConditionFormula(condition2, 2.5, 0, 3.0, 0) 
local area = createCombatArea({ 
                                {0, 0, 0, 1, 0, 0, 0}, 
                                {0, 1, 0, 0, 0, 1, 0}, 
                                {0, 0, 0, 0, 0, 0, 0}, 
                                {1, 0, 0, 2, 0, 0, 1}, 
                                {0, 0, 0, 0, 0, 0, 0}, 
                                {0, 1, 0, 0, 0, 1, 0}, 
                                {0, 0, 0, 1, 0, 0, 0} 
                                }) 
local animCombat = { 
                    createCombatObject(), 
                    createCombatObject() 
                    } 
local sexyEffect = { 
                    CONST_ME_FIREWORK_RED, 
                    CONST_ME_FIREWORK_YELLOW, 
                    CONST_ME_MAGIC_RED, 
                    CONST_ME_MAGIC_GREEN 
                    } 
setCombatParam(animCombat[2], COMBAT_PARAM_EFFECT, CONST_ME_HOLYAREA) 
setCombatParam(animCombat[2], COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLHOLY) 
setCombatParam(animCombat[1], COMBAT_PARAM_EFFECT, CONST_ME_FIREWORK_RED) 
setCombatParam(animCombat[1], COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE) 
setCombatArea(animCombat[2], area) 
setCombatArea(animCombat[1], area) 

function onEquip(cid, item, slot) 
if (getPlayerMoney(cid) > triggerQuantity and getPlayerStorageValue(cid, storage) ~= 1 and getPlayerSex(cid) < 2) then 
    local sexIndex = getPlayerSex(cid) + 1
    doCombat(cid, animCombat[sexIndex], numberToVariant(cid)) 
    doSetCreatureOutfit(cid, outfit[sexIndex], -1) 
    doPlayerSetStorageValue(cid, storage, 1) 
    doAddCondition(cid, condition1) 
    doAddCondition(cid, condition2) 
    doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid)) 
    doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid)) 
	doPlayerRemoveMoney(cid, triggerQuantity)
    SuperForm(cid, sexIndex) 
elseif (getPlayerStorageValue(cid, storage) == 1) then 
    doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You cannot equip this now!") 
else 
    doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You do not have enough coins!") 
end 
return true
end 

function onDeEquip(cid, item, slot) 
return StopSuperForm(cid) 
end

function SuperForm(cid, sexIndex) 
if (isPlayer(cid)) then 
	if (getPlayerStorageValue(cid, storage) == 1) then
		if (getPlayerMoney(cid) >= wastingQuantity) then 
			local position = getCreaturePosition(cid)
			doPlayerRemoveMoney(cid, wastingQuantity)
			doSendMagicEffect(position, sexyEffect[sexIndex + 2]) 
			doSendMagicEffect(position, sexyEffect[sexIndex]) 
				if (getPlayerMoney(cid) <= lowSupplyMargin and warnOnLowSupply == true) then 
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Coins left: " ..(getPlayerMoney(cid) - wastingQuantity) .. "!") 
				end 
			addEvent(SuperForm, wastingInterval, cid, sexIndex) 
		else 
			doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Your bangle has been destroyed!") 
			doPlayerRemoveItem(cid, 2127, 1) 
			return StopSuperForm(cid) 
		end
	end
end
return true
end

function StopSuperForm(cid) 
if (getPlayerStorageValue(cid, storage) == 1) then 
	doPlayerSetStorageValue(cid, storage, 0) 
	doRemoveCondition(cid, CONDITION_OUTFIT) 
	doRemoveCondition(cid, CONDITION_ATTRIBUTES) 
	doRemoveCondition(cid, CONDITION_HASTE) 
end 
return true
end
 

Saryten

New User
Joined
Nov 23, 2009
Messages
9
Reaction score
0
Odp: Support Scripts - naprawiamy / tworzymy

Skrypt: (wydaje mi si? ?e to o to chodzi)
PHP:
-- ### CONFIG ###
-- message send to player by script "type" (types you can check in "global.lua")
SHOP_MSG_TYPE = 19
-- time (in seconds) between connections to SQL database by shop script
SQL_interval = 30
-- ### END OF CONFIG ###
function onThink(interval, lastExecution)
    local result_plr = db.getResult("SELECT * FROM z_ots_comunication WHERE `type` = 'login';")
    if(result_plr:getID() ~= -1) then
        while(true) do
            id = tonumber(result_plr:getDataInt("id"))
            action = tostring(result_plr:getDataString("action"))
            delete = tonumber(result_plr:getDataInt("delete_it"))
            cid = getCreatureByName(tostring(result_plr:getDataString("name")))
            if isPlayer(cid) == TRUE then
                local itemtogive_id = tonumber(result_plr:getDataInt("param1"))
                local itemtogive_count = tonumber(result_plr:getDataInt("param2"))
                local container_id = tonumber(result_plr:getDataInt("param3"))
                local container_count = tonumber(result_plr:getDataInt("param4"))
                local add_item_type = tostring(result_plr:getDataString("param5"))
                local add_item_name = tostring(result_plr:getDataString("param6"))
                local received_item = 0
                local full_weight = 0
                if add_item_type == 'container' then
                    full_weight = getItemWeightById(itemtogive_id, 1)
                end
                local free_cap = getPlayerFreeCap(cid)
                if full_weight <= free_cap then
                    if add_item_type == 'container' then
                        local new_container = doCreateItemEx(container_id, 1)
                        local iter = 0
                        while iter ~= container_count do
                            doAddContainerItem(new_container, itemtogive_id, itemtogive_count)
                            iter = iter + 1
                        end
                        received_item = doPlayerAddItemEx(cid, new_container)
                    else
                        local new_item = doCreateItemEx(itemtogive_id, itemtogive_count)
                        received_item = doPlayerAddItemEx(cid, new_item)
                    end
                    if received_item == RETURNVALUE_NOERROR then
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You just got a >> '.. add_item_name ..' << from the [url=http://www.Havoc-Online.net]Homepage - Havoc-Online[/url] Shop Offert. Please logout so your character can save.')
                        db.executeQuery("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";")
                        db.executeQuery("UPDATE `z_shop_history_item` SET `trans_state`='realized', `trans_real`=" .. os.time() .. " WHERE id = " .. id .. ";")
                    else
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> The item '.. add_item_name ..' << that you just bought on the website couldnt be added. An error has ocurred, please wait '.. SQL_interval ..' seconds.. Shop ID: '.. id ..'')
                    end
                else
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> The item '.. add_item_name ..' << that you just bought on the website couldnt be added. An error has ocurred, please wait '.. SQL_interval ..' seconds.. Shop ID: '.. id ..'')
                end
            end
            if not(result_plr:next()) then
                break
            end
        end
        result_plr:free()
    end
    return TRUE
end
shop.lua
Opis skryptu:
The item bp of holding << that you just bought on the website couldnt be added. An error has ocurred, please wait 30 seconds.. Shop ID: 5
Gdy oczekuje na otrzymanie przedmiotu wyskakuje mi taki b??d
z g?ry dzi?kuj? za odpowied?!
pozdrawiam!
 

Oskar

Forum friend
Joined
Jan 24, 2009
Messages
2,256
Reaction score
331
Odp: Support Scripts - naprawiamy / tworzymy

Masz wystarczaj?co du?o capa?
Skrypt jest dobrze napisany. Po prostu jakim? sposobem nie mo?e doda? graczowi itemka. A gdyby? zamieni? wszystkie doPlayerAddItemEx na doPlayerAddItem? Je?li to nie zadzia?a to pobieranie itemk?w ?le funkcjonuje, a w tym Ci nie pomog?. Nie szkoli?em si? w sql.
 

Saryten

New User
Joined
Nov 23, 2009
Messages
9
Reaction score
0
Odp: Support Scripts - naprawiamy / tworzymy

Masz wystarczaj?co du?o capa?
Skrypt jest dobrze napisany. Po prostu jakim? sposobem nie mo?e doda? graczowi itemka. A gdyby? zamieni? wszystkie doPlayerAddItemEx na doPlayerAddItem? Je?li to nie zadzia?a to pobieranie itemk?w ?le funkcjonuje, a w tym Ci nie pomog?. Nie szkoli?em si? w sql.


ju? sprawdzam zaraz dam sprawozdanie: )

wiesz gdy zmienilem na "doplayeradditemex" rzucalo itemke na ziemie i po tym zauwazylem ze to poprostu inne id dlatego dzieki i pozdrawiam!
 
Last edited:

Honly

Active User
Joined
Oct 28, 2010
Messages
146
Reaction score
2
Odp: Support Scripts - naprawiamy / tworzymy

Skrypt:
Code:
punkty1 = 0
punkty2 = 0
pilkapos = {x=95,y=117,z=7}
function onAddItem(moveitem, tileitem, position, cid)
  if (moveitem.itemid == 2109 and tileitem.actionid == 1245) then
    punkty1 = punkty1 + 1
    doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE , "Red Team - "..punkty1)
  elseif (moveitem.itemid == 2109 and tileitem.actionid == 1246) then
    punkty2 = punkty2 + 1
    doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Blue Team - "..punkty2)
  end
  doCreatureSay(cid,"Goool!",1)
  return true
end
Opis skryptu: Chc? aby przemieszcza?o item o id 2109 na pilkapos gdy kto? przesuni? go na pod?og? o actionid 1245 lub 1246.
 

Oskar

Forum friend
Joined
Jan 24, 2009
Messages
2,256
Reaction score
331
Odp: Support Scripts - naprawiamy / tworzymy

PHP:
punkty1 = 0
punkty2 = 0
pilkapos = {x=1913,y=1156,z=7}
function onAddItem(moveItem, tileItem, position, cid)
if moveItem.itemid == 2109 and isPlayer(cid) and isInArray({1245,1246}, getThingFromPos(position).actionid) then
	if getThingFromPos(position).actionid == 1245 then
		punkty1 = punkty1 + 1
		doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE , 'Red Team - '..punkty1)
	elseif getThingFromPos(position).actionid == 1246 then
		punkty2 = punkty2 + 1
		doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Blue Team - '..punkty2)
	end
	doCreatureSay(cid, 'Goool!', 1)
	doRemoveItem(moveItem.uid, 1)
	doCreateItem(2109, pilkapos)
end
return true
end
 

robert891

Active User
Joined
Apr 21, 2009
Messages
121
Reaction score
0
Odp: Support Scripts - naprawiamy / tworzymy

Od?wie?am moja pro?b? z drugiej strony
 
Status
Not open for further replies.
Top