Postado Junho 25, 2016 8 anos ai o script http://pastebin.com/NsfJeAqa mais um video explicando - o mod é free chaitosoft só modificou ele e começou a cobrar em cima disso
Postado Julho 21, 2016 8 anos <?xml version="1.0" encoding="UTF-8"?> <mod name="Paintball event" version="1.0" author="Bogart" contact="otland.net" enabled="yes"> <description> </description> <config name="config"><![CDATA[ t = { main = { tfs_version = "0.3", --0.3 or 0.4 positions = { paintball_spawn_area = { top_left = {x = 970, y = 1040, z = 4}, --Top left pos of spawning area bottom_right = {x = 975, y = 1046, z = 7}--bottom right pos of spawning area }, waiting_room_area = { top_left = {x = 970, y = 1040, z = 7}, --Top left pos of the waiting room bottom_right = {x = 975, y = 1046, z = 7}--bottom right pos of the waiting room }, tp_to_paintball = {x = 985, y = 1052, z = 7}, --pos where the tp will be created event_ending_pos = {x = 985, y = 1052, z = 7} --pos players will be sent after event ending }, storages = {aexhaust = 2455, is_in_event = 2460, score = 2465 }, misc = { status = 'on' }, messages = { event_started = "Paintball event has started! there's a teleport near Thais temple!",--Message that will be broadcasted after the event has started event_ended = "Paintball event has ended!" --same but when event ends }, event_config = { event_duration = 15, --minutes, 0 if it's an always-open event infinite_ammo = false, winner_gets_item = true, prize_item_id = 3051, decrease_score_on_death = true, points_per_kill = 1, randomize_player_start_pos = true, ammo_per_point = 100, reset_bullets_on_death = true, min_bullets_on_spawn = 100, start_automatically = false, use_waiting_room = false, waiting_time = 3 --minutes } }, onShoot = { storages = { ammo = 2400 }, misc = { walls_id = {1115,1111,1112,5258,1385,1113}, bullets_exhaust = 500, --in ms bullet_speed = 150 }, vars = { shootdir = 0 } } } ]]></config> <movevent type="StepIn" actionid ="2880" event="script"><![CDATA[ domodlib('config') function onStepIn(cid, item, pos) local t_l = t.main.positions.paintball_spawn_area.top_left local b_r = t.main.positions.paintball_spawn_area.bottom_right doTeleportThing(cid, {x=math.random(t_l.x,b_r.x), y=math.random(t_l.y, b_r.y), z=math.random(t_l.z, b_r.z)}) doPlayerSetStorageValue(cid, t.main.storages.is_in_event,1) doPlayerSetStorageValue(cid, t.onShoot.storages.ammo, t.main.event_config.min_bullets_on_spawn) doPlayerSetStorageValue(cid, t.main.storages.score, 0) doPlayerSendTextMessage(cid,27,"Welcome to paintball, here are the commands:\n!shoot bullet --This will shot a bullet.\n!shoot ammo --This will give you "..t.main.event_config.ammo_per_point.." bullets and take 1 point from your current score (you need at least 1 point to use this command).\n!shoot info --This will show you your current score and ammo, it'll also show the current high score of the event.\nIt is strongly recommended that you bind these commands to your hotkeys.") end ]]></movevent> <globalevent name="StartPaintBall" interval="3600" event="script"><![CDATA[ domodlib('config') function onThink(interval, lastExecution, thinkInterval) if t.main.event_config.start_automatically then doBroadcastMessage(t.main.messages.event_started, MESSAGE_STATUS_WARNING) if t.main.event_config.use_waiting_room then addEvent(moveToEvent, t.main.event_config.waiting_time*1000*60) doCreateTeleport(1387,t.main.positions.waiting_room_area.top_left, t.main.positions.tp_to_paintball) else if t.main.tfs_version == "0.3" then doItemSetAttribute(doCreateItem(1387, t.main.positions.tp_to_paintball), "aid", 2880) else doSetItemActionId(doCreateItem(1387, t.main.positions.tp_to_paintball),2880) end if(t.main.event_config.event_duration > 0) then addEvent(endPaintball, t.main.event_config.event_duration*1000*60) end end end return true end function endPaintball() local score = {} if not t.main.event_config.use_waiting_room then doRemoveItem(getTileItemById(t.main.positions.tp_to_paintball,1387).uid) end for _, pid in ipairs(getPlayersOnline()) do if getPlayerStorageValue(pid, t.main.storages.is_in_event) > 0 then table.insert(score, {getCreatureName(pid), getPlayerStorageValue(pid, t.main.storages.score)}) doPlayerSetStorageValue(pid, t.main.storages.is_in_event, 0) doPlayerSetStorageValue(pid, t.main.storages.score, 0) doPlayerSetStorageValue(pid, t.onShoot.storages.ammo, 0) doTeleportThing(pid, t.main.positions.event_ending_pos) end end table.sort(score, function(a, b) return a[2] > b[2] end) if table.getn(score) > 0 then if t.main.event_config.winner_gets_item then for _, pid in ipairs(getPlayersOnline()) do if getCreatureName(pid) == score[1][1] then doPlayerAddItem(pid, t.main.event_config.prize_item_id) break end end end doBroadcastMessage("Paintball event has ended, "..score[1][1].." won paintball event with "..score[1][2].." points", MESSAGE_STATUS_WARNING) end end local t_l = t.main.positions.paintball_spawn_area.top_left local b_r = t.main.positions.paintball_spawn_area.bottom_right function moveToEvent() for _, pid in ipairs(getPlayersOnline()) do if isInRange(getCreaturePosition(pid), t.main.positions.waiting_room_area.top_left, t.main.positions.waiting_room_area.bottom_right) then doTeleportThing(pid, {x=math.random(t_l.x,b_r.x), y=math.random(t_l.y, b_r.y), z=math.random(t_l.z, b_r.z)}) doPlayerSetStorageValue(pid, t.main.storages.is_in_event,1) doPlayerSetStorageValue(pid, t.onShoot.storages.ammo, t.main.event_config.min_bullets_on_spawn) doPlayerSetStorageValue(pid, t.main.storages.score, 0) doPlayerSendTextMessage(pid,27,"Welcome to paintball, here are the commands:\n!shoot bullet --This will shot a bullet.\n!shoot ammo --This will give you "..t.main.event_config.ammo_per_point.." bullets and take 1 point from your current score (you need at least 1 point to use this command).\n!shoot info --This will show you your current score and ammo, it'll also show the current high score of the event.\nIt is strongly recommended that you bind these commands to your hotkeys.") end end doRemoveItem(getTileItemById(t.main.positions.tp_to_paintball,1387).uid) addEvent(endPaintball, t.main.event_config.event_duration*1000*60) end ]]></globalevent> <talkaction words="!shoot" event="script"><![CDATA[ domodlib('config') function onSay(cid, words, param, channel) local k = string.explode(param, ",") if(k[1] ~= nil) then if(string.upper(k[1]) == 'END') and getPlayerGroupId(cid) >= 3 then endPaintball() end if(string.upper(k[1]) == 'START') and getPlayerGroupId(cid) >= 3 then doBroadcastMessage(t.main.messages.event_started, MESSAGE_STATUS_WARNING) if t.main.event_config.use_waiting_room then addEvent(moveToEvent, t.main.event_config.waiting_time*1000*60) doCreateTeleport(1387,t.main.positions.waiting_room_area.top_left, t.main.positions.tp_to_paintball) else if t.main.tfs_version == "0.3" then doItemSetAttribute(doCreateItem(1387, t.main.positions.tp_to_paintball), "aid", 2880) else doSetItemActionId(doCreateItem(1387, t.main.positions.tp_to_paintball),2880) end if(t.main.event_config.event_duration > 0) then addEvent(endPaintball, t.main.event_config.event_duration*1000*60) end end end if(string.upper(k[1]) == 'INFO') then local score = {} local output = "You have " .. getPlayerStorageValue(cid, t.main.storages.score) .. " points.\nYou have "..getPlayerStorageValue(cid, t.onShoot.storages.ammo).." ammo left.\n------------------\nThe current high score in paintball is:\n" for _, pid in ipairs(getPlayersOnline()) do if getPlayerStorageValue(pid, t.main.storages.is_in_event) then table.insert(score, {getCreatureName(pid), getPlayerStorageValue(pid, t.main.storages.score)}) end end local lx = table.getn(score) if(lx > 3) then lx = 3 end table.sort(score, function(a, b) return a[2] > b[2] end) for k = 1,lx do output = output .. k..". "..score[k][1] .." [".. score[k][2] .."].\n" end doPlayerPopupFYI(cid, output) end if (string.upper(k[1]) == 'AMMO') then if(t.main.event_config.infinite_ammo) then doPlayerSendTextMessage(cid, 27, "Ammo is infinite, there's no need to buy more.") else if getPlayerStorageValue(cid, t.main.storages.score) > 0 then doPlayerSetStorageValue(cid, t.main.storages.score, getPlayerStorageValue(cid, t.main.storages.score)-1) doPlayerSetStorageValue(cid, t.onShoot.storages.ammo, getPlayerStorageValue(cid,t.onShoot.storages.ammo)+t.main.event_config.ammo_per_point) doPlayerSendTextMessage(cid, 27, "You have received " .. t.main.event_config.ammo_per_point .. " bullets and you have lost 1 score point.") doSendMagicEffect(getCreaturePosition(cid),4) else doPlayerSendTextMessage(cid, 27, "You do not have enough score points to buy ammo, you need ".. 1-(getPlayerStorageValue(cid, t.main.storages.score)).. " more.") end end end if (string.upper(k[1]) == 'BULLET') then if(getPlayerStorageValue(cid, t.main.storages.is_in_event) == 1) then if getPlayerStorageValue(cid, t.main.storages.exhaust) <= 1 then if(getPlayerStorageValue(cid, t.onShoot.storages.ammo) > 0) then if t.main.misc.status == 'on' then if(t.main.event_config.infinite_ammo == false) then doPlayerSetStorageValue(cid, t.onShoot.storages.ammo, getPlayerStorageValue(cid, t.onShoot.storages.ammo)-1) end doPlayerSetStorageValue(cid, t.main.storages.exhaust, 2) lineAnimation(getPlayerLookDirection(cid),getCreaturePosition(cid),12,cid,1,0,1,0,0,0,1,0) addEvent(doPlayerSetStorageValue,t.onShoot.misc.bullets_exhaust, cid, t.main.storages.exhaust,1) end else doPlayerSendCancel(cid, "You're out of ammo, exchange ammo for points with !shoot ammo or get killed for a recharge.") doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) end else doPlayerSendCancel(cid, "Gun is on cooldown") doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) end else doPlayerSendCancel(cid, "You need to be in the event.") doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) end end end return true end function lineAnimation(lookDir,playerPos,effect,cid,fvar,fpos,ffound,fposV,fcheck,fvcid,floopCounter,fvpid, name) local var = fvar local pos = fpos local found = ffound local posV = fposV local check = fcheck local vcid = fvcid local loopCounter = floopCounter local vpid = fvpid local storage = t.main.storages.exhaust if var < 2 then vcid = cid end pos = playerPos if not isInWallArray(convert(lookDir,pos)) then--isInWallArray({x=convert(lookDir,pos).x, y=convert(lookDir,pos).y,z=convert(lookDir,pos).z}) then --isInArray(t.onShoot.misc.walls_id, getThingfromPos({x=convert(lookDir,pos).x, y=convert(lookDir,pos).y,z=convert(lookDir,pos).z, stackpos=0}).itemid) then doSendDistanceShoot(pos, convert(lookDir,pos),effect) pos = convert(lookDir,pos) var=var+1 posV = convertV(lookDir,playerPos) for _, pid in ipairs(getPlayersOnline()) do if (getCreaturePosition(pid).x == pos.x and getCreaturePosition(pid).y == pos.y and getCreaturePosition(pid).z == pos.z) then --if loopCounter > 2 then vpid = pid --end if (vpid ~= vcid) then if var > 2 then if (getCreaturePosition(pid).x == posV.x and getCreaturePosition(pid).y == posV.y and getCreaturePosition(pid).z == posV.z) then killPlayer(pid,pos,getCreatureName(vcid)) if (lookDir == 0) or (lookDir == 2) then var = 6 else var = 8 end end end killPlayer(pid,pos,vcid) if (lookDir == 0) or (lookDir == 2) then var = 6 else var = 8 end end end loopCounter = loopCounter +1 end if (lookDir == 0) or (lookDir == 2) then if var ~= 6 then addEvent(lineAnimation, t.onShoot.misc.bullet_speed, lookDir,pos,effect,nil,var,pos,found,posV,check,vcid,loopCounter,vpid) else var = 1 end else if var ~= 8 then addEvent(lineAnimation, t.onShoot.misc.bullet_speed, lookDir,pos,effect,nil,var,pos,found,posV,check,vcid,loopCounter,vpid) else var = 1 end end else doSendMagicEffect(convert(lookDir,pos),2) var = 1 end end local ret = {} function convert(lookDir,pos) local positions = { [0] = {x = pos.x, y = pos.y-1, z = pos.z}, [1] = {x = pos.x+1, y = pos.y, z = pos.z}, [2] = {x = pos.x, y = pos.y+1, z = pos.z}, [3] = {x = pos.x-1, y = pos.y, z = pos.z} } ret = positions[lookDir] return ret end local ret = {} function convertV(lookDir,pos) local positions = { [0] = {x = pos.x, y = pos.y+1, z = pos.z}, [1] = {x = pos.x-1, y = pos.y, z = pos.z}, [2] = {x = pos.x, y = pos.y-1, z = pos.z}, [3] = {x = pos.x+1, y = pos.y, z = pos.z} } ret = positions[lookDir] return ret end function killPlayer(cid,pos, killer) local t_l = t.main.positions.paintball_spawn_area.top_left local b_r = t.main.positions.paintball_spawn_area.bottom_right doTeleportThing(cid, {x=math.random(t_l.x,b_r.x), y=math.random(t_l.y, b_r.y), z=math.random(t_l.z, b_r.z)}) doSendMagicEffect(pos,2) doPlayerSendTextMessage(cid, 27, "You've been killed by "..getCreatureName(killer)..".") doPlayerSetStorageValue(killer, t.main.storages.score, getPlayerStorageValue(killer, t.main.storages.score)+t.main.event_config.points_per_kill) doPlayerSendTextMessage(killer, 27, "You've killed "..getCreatureName(cid)..".") doBroadcastMessage("[Event] Paintball: "..getCreatureName(killer).." has killed "..getCreatureName(cid)..".", MESSAGE_STATUS_WARNING) if t.main.event_config.decrease_score_on_death then doPlayerSetStorageValue(cid, t.main.storages.score, getPlayerStorageValue(cid, t.main.storages.score)-1) end if t.main.event_config.reset_bullets_on_death then doPlayerSetStorageValue(cid, t.onShoot.storages.ammo, t.main.event_config.min_bullets_on_spawn) end end function isInWallArray(pos) for k = 0, table.getn(t.onShoot.misc.walls_id) do if getTileItemById(pos, t.onShoot.misc.walls_id[k]).itemid == t.onShoot.misc.walls_id[k] then --this doesn't even make sense but tried other ways and it gave errors, so meh 2lazy2search return true end end return false end function endPaintball() local score = {} if not t.main.event_config.use_waiting_room then doRemoveItem(getTileItemById(t.main.positions.tp_to_paintball,1387).uid) end for _, pid in ipairs(getPlayersOnline()) do if getPlayerStorageValue(pid, t.main.storages.is_in_event) > 0 then table.insert(score, {getCreatureName(pid), getPlayerStorageValue(pid, t.main.storages.score)}) doPlayerSetStorageValue(pid, t.main.storages.is_in_event, 0) doPlayerSetStorageValue(pid, t.main.storages.score, 0) doPlayerSetStorageValue(pid, t.onShoot.storages.ammo, 0) doTeleportThing(pid, t.main.positions.event_ending_pos) end end table.sort(score, function(a, b) return a[2] > b[2] end) if table.getn(score) > 0 then if t.main.event_config.winner_gets_item then for _, pid in ipairs(getPlayersOnline()) do if getCreatureName(pid) == score[1][1] then doPlayerAddItem(pid, t.main.event_config.prize_item_id) break end end end doBroadcastMessage("Painball event has ended, "..score[1][1].." won paintball event with "..score[1][2].." points", MESSAGE_STATUS_WARNING) end end local t_l = t.main.positions.paintball_spawn_area.top_left local b_r = t.main.positions.paintball_spawn_area.bottom_right function moveToEvent() for _, pid in ipairs(getPlayersOnline()) do if isInRange(getCreaturePosition(pid), t.main.positions.waiting_room_area.top_left, t.main.positions.waiting_room_area.bottom_right) then doTeleportThing(pid, {x=math.random(t_l.x,b_r.x), y=math.random(t_l.y, b_r.y), z=math.random(t_l.z, b_r.z)}) doPlayerSetStorageValue(pid, t.main.storages.is_in_event,1) doPlayerSetStorageValue(pid, t.onShoot.storages.ammo, t.main.event_config.min_bullets_on_spawn) doPlayerSetStorageValue(pid, t.main.storages.score, 0) doPlayerSendTextMessage(pid,27,"Welcome to paintball, here are the commands:\n!shoot bullet --This will shot a bullet.\n!shoot ammo --This will give you "..t.main.event_config.ammo_per_point.." bullets and take 1 point from your current score (you need at least 1 point to use this command).\n!shoot info --This will show you your current score and ammo, it'll also show the current high score of the event.\nIt is strongly recommended that you bind these commands to your hotkeys.") end end doRemoveItem(getTileItemById(t.main.positions.tp_to_paintball,1387).uid) addEvent(endPaintball, t.main.event_config.event_duration*1000*60) end ]]></talkaction> </mod>
Postado Julho 22, 2016 8 anos Autor @Dudy9701 ja tenho o evento, mas vlw ae. Meu servidor https://www.facebook.com/Heavennoobwar
Postado Agosto 4, 2016 8 anos Funciona TSF 0.4 do jeito que o script esta? tem tbm os codigos PHP? Editado Agosto 4, 2016 8 anos por doido mudanca (veja o histórico de edições)
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.