TC
dúvida

Talkactions Por Parametro

Por Tchubaka, 19 de jul. de 2012 em Scripts

script
10
1.3k
TchubakaT
19 de julho de 2012 às 22:33

no meio script de conter strike.

queria por pra usar os comandos

so em tal parametro.

 

fiz 1 castelo queria que usasse as talkactions so dentro do castelo.

 

 

 

 

Vlw'

LeoxtibiaL
20 de julho de 2012 às 10:57

Acho que você quis dizer: Talkaction por PERÍMETRO não? Se foi isso mesmo...aí vai. Primeiramente não sei se o seu script de counter strike é igual a esse:

http://www.xtibia.com/forum/topic/180902-script-tibia-counter-strike-testado-na-versao-860/

Eu fiz as alterações nesse...caso não for, posta o seu aí. Aqui vai o script:

 

 

 

local fromPos,toPos = {x=10,y=10,z=7},{x=11,y=11,z=7}   ---- posição do canto superior esquerdo, posição do canto inferior direito

function buy(cid,numero)
return getPlayerStorageValue(cid,numero)
end

function onSay(cid, words, param, channel)
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
local players = getPlayerInArea(fromPos, toPos)
for i=1, #players do
   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, 5)
i = i + tempo
until i >= tempo * max
end -- do if word == atirar..
return true
end
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

function getPlayerInArea(fromPos, toPos) --by jhon992
local online = getPlayersOnline()
local players = {}
for i=1, #online do
   if isInArea(getPlayerPosition(online[i]), fromPos, toPos) then
       players[#players+1] = online[i]
   end
end
return players
end

 

 

 

O player só poderá usar o comando !atirar na área que você especificar nessa linha:

 

local fromPos,toPos = {x=10,y=10,z=7},{x=11,y=11,z=7} ---- posição do canto superior esquerdo, posição do canto inferior direito da área

 

Se ele não estiver nessa área, ele não faz nada. Vlw, espero ter ajudado.

TchubakaT
20 de julho de 2012 às 12:06

meu script de cs e esse :

 

 

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

 

 

 

 

e tem o castelo, queria por so pra usar nele. talvez 1tile na entrada do castelo daria 1storage so no castelo nao sei.'

i 1duvida. teria como nesse PERIMETRO nao pudesse atacar de arma? so com o comando !atirar? vlw'

Editado Julho 20 por Tchubaka

LeoxtibiaL
20 de julho de 2012 às 12:11

O script é igual ao que eu postei amigo, edita as posições e testa lá.

TchubakaT
20 de julho de 2012 às 12:37

posição do canto superior esquerdo, posição do canto inferior direito

nao entendi direito.

Print Castelo.

 

483375_314821911946808_1978293422_n.jpg

 

seria ai as POS?

 

lembrando que são 2 andares.

Editado Julho 20 por Tchubaka

LeoxtibiaL
20 de julho de 2012 às 12:41

A do lado de < está correta. Mas, a outra é o canto INFERIOR e não superior.

TchubakaT
20 de julho de 2012 às 13:04

entao seria <<< 1andar acima final. >>> terrio final canto ~> certo?

LeoxtibiaL
20 de julho de 2012 às 13:20

Sim, edita lá.

TchubakaT
20 de julho de 2012 às 15:26

agora so funciona se eu estiver nessa linha em preto na s.s ;x

 

564502_314845018611164_1596266213_n.jpg

 

Duvida Sanada. REP+

LeoxtibiaL
20 de julho de 2012 às 15:29

Dúvida sanada por msn. Era as posições da área.

 

 

 

local fromPos,toPos = {x=771,y=782,z=6},{x=808,y=821,z=6} ---- posição do canto superior esquerdo, posição do canto

local fromPoss,toPoss = {x=771,y=782,z=5},{x=808,y=821,z=5}

 

function buy(cid,numero)

return getPlayerStorageValue(cid,numero)

end

 

function onSay(cid, words, param, channel)

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

local players = getPlayerInArea(fromPos, toPos, fromPoss, toPoss)

for i=1, #players do

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, 5)

i = i + tempo

until i >= tempo * max

end -- do if word == atirar..

return true

end

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

 

function getPlayerInArea(fromPos, toPos, fromPoss, toPoss) --by jhon992

local online = getPlayersOnline()

local players = {}

for i=1, #online do

if isInArea(getPlayerPosition(online), fromPos, toPos) or isInArea(getPlayerPosition(online), fromPoss, toPoss) then

players[#players+1] = online

end

end

return players

end

 

 

 

 

Tópico reportado.