Ir para conteúdo

Posts Recomendados

Eu estou com dois scripts e queria usar eles só para eventos entao queria que só desse para usar eles em um certo lugar, não fasso a minima ideia de como faz isso..

 

Primeiro Script

http://www.xtibia.com/forum/topic/143281-talk-cs-war-tibia-v2-atualizado-20102010/

peguei deste tópico ai

está em data/talkactions/scripts/tiros.lua

function buy(cid,numero)

return getPlayerStorageValue(cid,numero)

end

 

function onSay(cid,words,param)

-- [nao mexa] = {distancia maxima,velocidade,delay entre os tiros, "msg animada" , math.random(min,max)}

 

local arsenal = {

[13251] = {4,200,2,"no Pé",math.random(1,8),"9X19MM SIDEARM"},

[13252] = {4,215,2,"no Braço",math.random(1,10),"KM .45 TACTICAL"},

[13253] = {4,215,2,"no Braço",math.random(1,10),"228 COMPACT "},

[13254] = {5,170,2,"na Perna",math.random(15,35),"NIGHT WALK .50C"},

[13255] = {5,175,2,"na Perna",math.random(15,35),"ES FIVE-SEVEN"},

[13261] = {6,220,5,"UGHHH",math.random(23,35),"LEONE 12 GALGUE SUPER"},

[13262] = {6,220,3,"UGHHH",math.random(15,30),"LEONE IG1265 AUTO"},

[13271] = {7,175,2,"no Pé",math.random(1,8),"SCHMIDT MACHINE"},

[13272] = {7,170,2,"no Braço",math.random(1,10),"KM SUB-MACHINE GUN"},

[13273] = {7,170,2,"no Pé",math.random(1,8),"KM UMP45"},

[13274] = {7,160,2,"no Braço",math.random(1,10),"ES C90"},

[13281] = {5,180,1.5,"no Peito",math.random(25,65),"CLARION 5.56"},

[13282] = {7,186,2,"no Peito",math.random(25,65),"SCHMIDT SCOUT"},

[13283] = {6,170,1.5,"Nut Shot",math.random(25,75),"MAVERICK M4A1"},

[13284] = {5,160,1.5,"no Peito",math.random(25,65),"BULLPUP"},

[13285] = {6,170,2,"Nut Shot",math.random(25,75),"KRIEG 550 COMMANDO"},

[13286] = {8,145,3,"Head Shot",math.random(80,100),"MAGNUM SNIPER RIFLE"},

[13291] = {7,165,8,"Errou",0,"M249"},

}

local armamento = arsenal[getPlayerStorageValue(cid,13245)]

 

 

if words == "!b" then

doPlayerPopupFYI(cid, "Sell:" ..

"\n1 - PISTOLS" ..

"\n2 - SHOTGUNS" ..

"\n3 - SMG" ..

"\n4 - RIFLES" ..

"\n5 - MACHINE GUNS" ..

"\n" ..

"\nSay '!b + number' -> example:" ..

"\n!b1 for open PISTOLS Sellers." )

end

 

if words == "!b1" then -- PISTOLS

doPlayerPopupFYI(cid, "Sell:" ..

"\n11 - 9X19MM SIDEARM --- 4000 GOLD COINS" ..

"\n12 - KM .45 TACTICAL --- 5000 GOLD COINS" ..

"\n13 - 228 COMPACT --- 6000 GOLD COINS" ..

"\n14 - NIGHT WALK .50C --- 6500 GOLD COINS" ..

"\n15 - ES FIVE-SEVEN --- 7500 GOLD COINS" ..

"\n" ..

"\nSay '!b + number' -> example:" ..

"\n!b14 for buy NIGHT WALK .50C (DESERT EAGLE)." )

end

 

if words == "!b2" then -- SHOTGUNS

doPlayerPopupFYI(cid, "Sell:" ..

"\n21 - LEONE 12 GALGUE SUPER --- 17000 GOLD COINS" ..

"\n22 - LEONE IG1265 AUTO --- 30000 GOLD COINS" ..

"\n" ..

"\nSay '!b + number' -> example:" ..

"\n!b21 for buy LEONE 12 GALGUE SUPER." )

end

 

if words == "!b3" then -- SMG

doPlayerPopupFYI(cid, "Sell:" ..

"\n31 - SCHMIDT MACHINE --- 12500 GOLD COINS" ..

"\n32 - KM SUB-MACHINE GUN --- 15000 GOLD COINS" ..

"\n33 - KM UMP45 --- 17000 GOLD COINS" ..

"\n34 - ES C90 --- 23500 GOLD COINS" ..

"\n" ..

"\nSay '!b + number' -> example:" ..

"\n!b34 for buy ES C90." )

end

 

if words == "!b4" then -- RILES

doPlayerPopupFYI(cid, "Sell:" ..

"\n41 - CLARION 5.56 --- 22500 GOLD COINS" ..

"\n42 - SCHMIDT SCOUT --- 27500 GOLD COINS" ..

"\n43 - MAVERICK M4A1 --- 31000 GOLD COINS" ..

"\n44 - BULLPUP --- 35000 GOLD COINS" ..

"\n45 - KRIEG 550 COMMANDO --- 42000 GOLD COINS" ..

"\n46 - MAGNUM SNIPER RIFLE --- 47500 GOLD COINS" ..

"\n" ..

"\nSay '!b + number' -> example:" ..

"\n!b46 for buy MAGNUM SNIPER RIFLE(AWP)." )

end

 

if words == "!b5" then -- RILES

doPlayerPopupFYI(cid, "Sell:" ..

"\n51 - M249 --- 57500 GOLD COINS" ..

"\n" ..

"\nSay '!b + number' -> example:" ..

"\n!b51 for buy M249(RAMBO)." )

end

 

 

 

local comprar = {

["!b11"] = {13251,4000},

["!b12"] = {13252,5000},

["!b13"] = {13253,6000},

["!b14"] = {13254,6500},

["!b15"] = {13255,7500},

["!b21"] = {13261,17000},

["!b22"] = {13262,30000},

["!b31"] = {13271,12500},

["!b32"] = {13272,15000},

["!b33"] = {13273,17000},

["!b34"] = {13274,23500},

["!b41"] = {13281,22500},

["!b42"] = {13282,27500},

["!b43"] = {13283,31000},

["!b44"] = {13284,35000},

["!b45"] = {13285,42000},

["!b46"] = {13286,47500},

["!b51"] = {13291,57500},

}

 

local buyarmas = comprar[words]

 

if buyarmas ~= nil then

if buy(cid,13251) >= 1 or buy(cid,13252) >= 1 or buy(cid,13253) >= 1 or buy(cid,13254) >= 1 or buy(cid,13255) >= 1

or buy(cid,13261) >= 1 or buy(cid,13262) >= 1

or buy(cid,13271) >= 1 or buy(cid,13272) >= 1 or buy(cid,13273) >= 1 or buy(cid,13274) >= 1

or buy(cid,13281) >= 1 or buy(cid,13282) >= 1 or buy(cid,13283) >= 1 or buy(cid,13284) >= 1 or buy(cid,13285) >= 1 or buy(cid,13286) >= 1

or buy(cid,13291) >= 1 then

 

return doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"Voce nao pode comprar mais armas estando com uma. digite !g para se livrar de sua arma.")

end

 

if doPlayerRemoveMoney(cid, buyarmas[1]) == FALSE then

return doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"Você tem que ter "..buyarmas[2].." gold coins.")

end

 

setPlayerStorageValue(cid,buyarmas[1],1)

-- teste --

setPlayerStorageValue(cid,13245,buyarmas[1])

doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"Você comprou uma arma.")

 

end

 

if words == "!g" then

if buy(cid,13251) >= 1 or buy(cid,13252) >= 1 or buy(cid,13253) >= 1 or buy(cid,13254) >= 1 or buy(cid,13255) >= 1

or buy(cid,13261) >= 1 or buy(cid,13262) >= 1

or buy(cid,13271) >= 1 or buy(cid,13272) >= 1 or buy(cid,13273) >= 1 or buy(cid,13274) >= 1

or buy(cid,13281) >= 1 or buy(cid,13282) >= 1 or buy(cid,13283) >= 1 or buy(cid,13284) >= 1 or buy(cid,13285) >= 1 or buy(cid,13286) >= 1

or buy(cid,13291) >= 1 then

 

setPlayerStorageValue(cid,13251,-1)

setPlayerStorageValue(cid,13252,-1)

setPlayerStorageValue(cid,13253,-1)

setPlayerStorageValue(cid,13254,-1)

setPlayerStorageValue(cid,13255,-1)

setPlayerStorageValue(cid,13261,-1)

setPlayerStorageValue(cid,13262,-1)

setPlayerStorageValue(cid,13271,-1)

setPlayerStorageValue(cid,13272,-1)

setPlayerStorageValue(cid,13273,-1)

setPlayerStorageValue(cid,13274,-1)

setPlayerStorageValue(cid,13281,-1)

setPlayerStorageValue(cid,13282,-1)

setPlayerStorageValue(cid,13283,-1)

setPlayerStorageValue(cid,13284,-1)

setPlayerStorageValue(cid,13285,-1)

setPlayerStorageValue(cid,13286,-1)

setPlayerStorageValue(cid,13291,-1)

 

setPlayerStorageValue(cid,13245,-1)

 

doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"Você se livrou de sua arma.")

else

return doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"Você não tinha arma.")

end

end

 

 

if words == "!atirar" then

 

local storage = 13243

 

if armamento == nil then

return doPlayerSendCancel(cid,"Voce precisa comprar uma arma, digite !b")

end

 

if getTilePzInfo(getCreaturePosition(cid)) == TRUE then

return doPlayerSendCancel(cid,"Voce só pode atirar fora da protection zone.")

end

 

if os.time() - getPlayerStorageValue(cid,storage) <= armamento[3] then

return doSendAnimatedText(getCreaturePosition(cid), "Reloading", math.random(1,255))

end

 

setPlayerStorageValue(cid,storage,os.time())

 

 

-- SCRIPT BY DRAKY LUCAS --

-- [de 1 a 10] = {"fala",math.random(dano minimo,dano maximo) em percentagens},

local falas = {

[1] = {"Head Shot",math.random(80,100)},

[2] = {"Nut Shot",math.random(25,35)},

[3] = {"na Perna",math.random(10,25)},

[4] = {"no Peito",math.random(50,75)},

[5] = {"no Pé",math.random(1,10)},

}

 

local i = 1

local tempo = armamento[2]

local max = armamento[1] -- numero de repetiçoes

repeat

local direction = getPlayerLookDir(cid)

position = getCreaturePosition(cid)

if(direction == NORTH) then

position.y = position.y - (i/tempo)

elseif(direction == SOUTH) then

position.y = position.y + (i/tempo) + 1

elseif(direction == WEST) then

position.x = position.x - (i/tempo)

elseif(direction == EAST) then

position.x = position.x + (i/tempo) + 1

end

position.stackpos = 253

local pos = {x = position.x,y = position.y, z = position.z}

pos.stackpos = 253

if getTilePzInfo(pos) == TRUE then

break

end

 

if getThingfromPos(pos).itemid > 0 then

local fala = falas[math.random(1,10)]

if fala == nil then

if addEvent(isPlayer,i,getThingfromPos(pos).uid) then

addEvent(doCreatureAddHealth,i,getThingfromPos(pos).uid,-(getCreatureMaxHealth(getThingfromPos(pos).uid)/100)* armamento[5])

addEvent(doSendMagicEffect,i,pos,64)

addEvent(doSendAnimatedText,i,pos, armamento[4], math.random(1,255))

break

end

end

if addEvent(isPlayer,i,getThingfromPos(pos).uid) then

addEvent(doCreatureAddHealth,i,getThingfromPos(pos).uid,-(getCreatureMaxHealth(getThingfromPos(pos).uid)/100)* fala[2])

addEvent(doSendMagicEffect,i,pos,64)

addEvent(doSendAnimatedText,i,pos, fala[1], math.random(1,255))

break

end

break

end

 

addEvent(doSendMagicEffect,i,pos, 4)

 

i = i + tempo

until i >= tempo * max

end -- do if word == atirar..

 

if words == "!arma" then

if getPlayerStorageValue(cid,13245) <= 0 then

return doPlayerSendTextMessage(cid,25,"Você não tem arma.")

end

doPlayerSendTextMessage(cid,25,"Você está usando uma "..armamento[6]..".")

end

 

return TRUE

end

 

data/talkactions/talkactions.xml

<talkaction log="yes" words="!atirar;!b;!b1;!b2;!b3;!b4;!b5;!g;!b11;!b12;!b13;!b14;!b15;!b21;!b22;!b31;!b32;!b33;!b34;!b41;!b42;!b43;!b44;!b45;!b46;!b51;!arma" event="script" value="tiros.lua"/>

QUeria um jeito de apenas dar para usar os comandos !g !arma !b e !atirar em um tao xao

 

e o otro script é esse aqui peguei daki http://www.xtibia.com/forum/topic/148261-talkaction-dirigindo-carro/page__st__20

 

talkactions/scripts/car.lua

--<< Configurable >>--

local storages = { speed = 314622, status = 352993 } -- Empty storages

 

local cfg = { min_speed = 100, -- better not increase than that [ the least speed for a car ]

max_speed = 50, -- better not decrease than this [ the maximum speed for a car ]

Increase_per_command = 100, -- The speed increase or decrease value per each command (!car speed // !car slow)

Car_Explode = true -- Keep it true , so your map isnt filled with cars

}

-->> END <<--

 

--<< Functions >>--

 

function isWalkable(pos, creature, pz)-- Modificações by Hudsin,Arkires e Pinpao Xtibia

if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end

if getTopCreature(pos).uid > 0 and creature then return false end

if getTileInfo(pos).protection and pz then return false, true end

local n = not proj and 3 or 2

for i = 0, 255 do

pos.stackpos = i

local tile = getTileThingByPos(pos)

if tile.itemid ~= 0 and not isCreature(tile.uid) then

if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then

return false

end

end

end

return true

end

 

function getCarSpeed(cid) return getPlayerStorageValue(cid,storages.speed) end

function setCarSpeed(cid,value) return setPlayerStorageValue(cid,storages.speed, getPlayerStorageValue(cid,storages.speed) + value) end

function setCarStatus(cid,value) return setPlayerStorageValue(cid,storages.status,value) end

function carMove(cid) return getPlayerStorageValue(cid,storages.status) > 0 and true or false end

 

function move(cid,time)

local dir = getCreatureLookDir(cid)

local id = isInArray({1,3},getCreatureLookDir(cid)) and 7267 or 7266

local place = getPositionByDirection(getThingPos(cid),dir,1)

if isWalkable(place,true,true,true) then

doRemoveItem( getTileItemById(getThingPos(cid),7267).uid > 0 and getTileItemById(getThingPos(cid),7267).uid or getTileItemById(getThingPos(cid),7266).uid )

doTeleportThing(cid,place,false)

addEvent(doSendMagicEffect,time+10,place,34)

doCreateItem(id,1,place)

if carMove(cid) then

addEvent(move,time,cid,getCarSpeed(cid))

else

doRemoveItem( getTileItemById(getThingPos(cid),7267).uid > 0 and getTileItemById(getThingPos(cid),7267).uid or getTileItemById(getThingPos(cid),7266).uid )

end

else

doCreatureSetNoMove(cid, 0)

doPlayerSendTextMessage(cid,27,"You have hit somthng.")

setCarStatus(cid,0)

if cfg.Car_Explode then

doRemoveItem( getTileItemById(getThingPos(cid),7267).uid > 1 and

getTileItemById(getThingPos(cid),7267).uid or getTileItemById(getThingPos(cid),7266).uid )

doSendAnimatedText(getThingPos(cid),"Crashed",TEXTCOLOR_RED)

doSendMagicEffect(getThingPos(cid),31)

end

end

end

 

--<< Functions Ends <<--

 

function onSay(cid, words, param, channel)

if param == "speed" then

if carMove(cid) then

if getCarSpeed(cid) > cfg.max_speed then

setCarSpeed(cid,-(cfg.Increase_per_command))

addEvent(doSendAnimatedText,10,getThingPos(cid),"Speeding",TEXTCOLOR_GREEN)

else

setCarSpeed(cid,cfg.max_speed)

doPlayerSendCancel(cid,"The car is in its maximum speed.")

end

else

doPlayerSendCancel(cid,"You should start moving first.")

end

elseif param == "slow" then

if carMove(cid) then

if getCarSpeed(cid) < cfg.min_speed then

setCarSpeed(cid,cfg.Increase_per_command)

addEvent(doSendAnimatedText,10,getThingPos(cid),"Slowing",TEXTCOLOR_GREEN)

else

setCarSpeed(cid,cfg.min_speed)

doPlayerSendCancel(cid,"The car is in its minumium speed.")

end

else

doPlayerSendCancel(cid,"You should start moving first.")

end

elseif param == "stop" then -- by DarkVelocity Xtibia

if carMove(cid) then

setCarStatus(cid,0)

doCreatureSetNoMove(cid, 0)

 

else

doPlayerSendCancel(cid,"Car is already stopped.")

end

elseif param == "move" then

if not carMove(cid) then

if getTileItemById(getThingPos(cid),7267).uid < 1 and getTileItemById(getThingPos(cid),7266).uid < 1 then

local item = isInArray({1,3},getCreatureLookDir(cid)) and 7267 or 7266

doCreateItem(item,1,getThingPos(cid))

end

setPlayerStorageValue(cid,storages.speed,cfg.min_speed)

setCarStatus(cid,1)

doCreatureSetNoMove(cid, 1)

move(cid,getCarSpeed(cid))

else

doPlayerSendCancel(cid,"Car is already moving.")

end

end

 

return true

end

 

talkactions.xml

<talkaction words="!car" event="script" value="car.lua"/>

keria que só desse pra usa o comando !car move !car speed !car slow !car stop em um certo xao tbm porfavor ajudem REP+ de montao

Link para o comentário
https://xtibia.com/forum/topic/150350-pedido-arrumar-2-scritps/
Compartilhar em outros sites

×
×
  • Criar Novo...