• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

A Event Script with the following things please..

Joined
May 5, 2010
Messages
62
Reaction score
1
i have this script

Code:
function onSay(cid, words, param)

local posx = getGlobalStorageValue(75314)
local posy = getGlobalStorageValue(75315)
local posz = getGlobalStorageValue(75316)
 
local evtpos = {x=1076, y=1006, z=7}
 
	if words == '!pvp' then
		if getGlobalStorageValue(75310) ~= 10 then
			doPlayerSendCancel(cid,'NO hay eventos en este momento.')
		else	
			doTeleportThing(cid,evtpos)
		end
	elseif words == '/eventx' then
		if getPlayerAccess(cid) >= 3 then
			setGlobalStorageValue(75314, param)
		else
			doPlayerSendCancel(cid,'You not have access for use this command.')
		end
	elseif words == '/eventy' then
		if getPlayerAccess(cid) >= 3 then
			setGlobalStorageValue(75315, param)
		else
		doPlayerSendCancel(cid,'You not have access for use this command.')
		end
	elseif words == '/eventz' then
		if getPlayerAccess(cid) >= 3 then
			setGlobalStorageValue(75316, param)
		else
			doPlayerSendCancel(cid,'You not have access for use this command.')
		end
	elseif words == '/eventopvp' then
		if param == 'on' then
			if getPlayerAccess(cid) >= 3 then
				setGlobalStorageValue(75310, 10)
                                     doTeleportThing(cid,evtpos)
									 doBroadcastMessage(' '.. getCreatureName(cid) ..' Ha ACTivado el concurso de: Matar para entrar di: !pvp', MESSAGE_EVENT_ADVANCE)
                else
                        doPlayerSendCancel(cid,'You not have access for use this command.')
                end
                elseif param == 'off' then
                        if getPlayerAccess(cid) >= 3 then
                                setGlobalStorageValue(75310, 0)
doBroadcastMessage(' '.. getCreatureName(cid) ..' Ha DESactivado el concurso de: Team PvP', MESSAGE_EVENT_ADVANCE)
                else
                        doPlayerSendCancel(cid,'You not have access for use this command.')
                        end
end
 
end
end

and its about a TEAM WAR..
and i want it to be like.. two teams.. if u say !pvp u got to blue team or red.. and only like 5 people can go to each team and when its full then no more people can go in.. and each team to be in red outfit and blue outfit.. and blue team goes to a different place and red another.. can yall understand? xd well i hope u can help me.. i know it sounds difficult..
thank you!
 
Alright, then the players that won the event will get magically teleported to the temple :p.

well he is gonna give the player the award himself.. so he can tp the guy out himself.. but if your gonna make a script for it you might aswell add so he can decide the award in the talkaction, and then the creaturescript gives it :)

anyways if you have trouble making it you can use this one..

Lua:
function onStatsChange(cid, attacker, type, combat, value)

if type == 1 then
	local areaposleftupp = {x = 33035,y = 3677,z = 8}-- change
	local areaposrightdown = {x = 33055, y = 3717, z = 8} -- change
	if getCreatureHealth(cid) <= value and isInArea(cid, areaposleftupp, areaposrightdown) then
		local player = getCreatureName(cid)
		local killer = getCreatureName(attacker)
		doBroadcastMessage(player .. " got killed by " .. killer .. " in the event.")
		doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
		doCreatureAddHealth(cid,getCreatureMaxHealth(cid) -	getCreatureHealth(cid))
		if getGlobalStorageValue(xxx) == 1 then
			setGlobalStorageValue(xxx, nil) 
			doTeleportThing(attacker, getTownTemplePosition(getPlayerTown(cid)))
		else
			setGlobalStorageValue(xxx, getGlobalStorageValue(xxx)-1)
		end
	return false
	end
end
return true
end

and just make the globalstorage add 1 for each person that joins =) unless you don't wanna check the area each time someone dies.. anyways if you don't need it just ignore it
 
Lua:
local config = {
	[1] = {	
		posTeam = {x=xxx, y = yyy, z=zzz}, -- change this
		globalTeam = xxx -- change to an unused globalstorage
	},
	[2] = {
		posTeam = {x=xxx, y = yyy, z=zzz}, -- change this
		globalTeam = xxx -- change to an unused globalstorage
	},
	others = {
		itemid = xxx, -- change to an unused globalstorage
		storageId = xxx -- change to an unused playerstorageid
	}
}

function onSay(cid, words, param)
	local t = string.explode(param, ",")
if words == '!pvp' then
local team = 0
	if getGlobalStorageValue(config[1].globalTeam)+getGlobalStorageValue(config[2].globalTeam)== 10 then
		doPlayerSendCancel(cid,'NO hay eventos en este momento.')
		return true
	end
	
	if math.random(2) == 1 and getGlobalStorageValue(config[1].globalTeam) <=5 then
	team = 1
	elseif getGlobalStorageValue(config[2].globalTeam) <=5 then
	team = 2
	else
	team = 1
	end
	doTeleportThing(cid, config[team].posTeam)
	table.insert(setGlobalStorageValue(config[team].globalTeam, getCreatureName(cid)))
	setPlayerStorageValue(cid, config.others.storageId, team)
return true
end
if words = '!start' and getPlayerAccess(cid) >= 3 then

	if getGlobalStorageValue(config[1].globalTeam)+getGlobalStorageValue(config[2].globalTeam)>0 then
		doPlayerSendCancel(cid,'There is already one started.')
		return true
	end
	if(param == "") then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need to specify reward, if item is stackable please write a , then amount.")
		return true
	end
	if not t[2] then
		stack = 1
	else
		stack = t[2]
	end
	setGlobalStorageValue(config[1].globalTeam, {})
	setGlobalStorageValue(config[2].globalTeam, {})
	setGlobalStorageValue(config.others.itemid, {t[1], stack})
	doBroadcastMessage(' '.. getCreatureName(cid) ..' Ha ACTivado el concurso de: Matar para entrar di: !pvp', MESSAGE_EVENT_ADVANCE)
else
return false
end
return true
end
Lua:
local config = {
	[1] = {	
		posTeam = {x=xxx, y = yyy, z=zzz}, -- change this to team 1s position
		globalTeam = xxx -- change to an unused globalstorage
	},
	[2] = {
		posTeam = {x=xxx, y = yyy, z=zzz}, -- change this to team 2s position
		globalTeam = xxx -- change to an unused globalstorage
	},
	others = {
		itemid = xxx, -- change to an unused globalstorage
		storageId = xxx -- change to an unused playerstorageid
	}
}

function onStatsChange(cid, attacker, type, combat, value)
 local team = getPlayerStorageValue(cid, config.others.storageId)
if type == 1 then
	local areaposleftupp = {x = 33035,y = 3677,z = 8}-- change
	local areaposrightdown = {x = 33055, y = 3717, z = 8} -- change
	if getCreatureHealth(cid) <= value and isInArea(cid, areaposleftupp, areaposrightdown) then
		local player = getCreatureName(cid)
		local killer = getCreatureName(attacker)
		doBroadcastMessage(player .. " got killed by " .. killer .. " in the event.")
		doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
		doCreatureAddHealth(cid,getCreatureMaxHealth(cid) -	getCreatureHealth(cid))
		table.remove(getGlobalStorageValue(config[team].globalTeam, player))
		if #getGlobalStorageValue(config[1].globalTeam) == 0 or #getGlobalStorageValue(config[2].globalTeam)== 0 then
		local players = getGlobalStorageValue(config[killer].globalTeam)
			for i = 1, #players do
				doPlayerSendTextMessage(players[i], 22, "Congratulations, your team won!")
				doPlayerAddItem(players[i], config.others.itemid[1],config.others.itemid[2])
				doTeleportThing(players[i], getTownTemplePosition(getPlayerTown(cid)))
			end
			setGlobalStorageValue(config[1].globalTeam, {})
			setGlobalStorageValue(config[2].globalTeam, {})
		end
	return false
	end
end
return true
end

this didn't take long to make, so I'm guessing something is gonna give an error.. but hopefully nothing to big =)

don't forget to fix the areaposleftupp and areaposrightdown in the onstatschange script

edit: fixed a small bug
 
Last edited:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="PvP Event" version="1.0" author="Bogart" contact="otland.net" enabled="yes">
	<config name="config"><![CDATA[
		config = {
      t1 = "Blue Mods", -- Blue team name
      t2 = "Red Trolls", --Red Team Name
      t1s = 8001, -- Blue Team storage
      t2s = 8002, -- Red Team storage
	  tc = 1, -- players of each team
      gstg = 8003, --Teams Global storage
      tgstg = 8004, --Global Storage
      rt = {x=32382, y=32239, z=8}, -- Red Team temple
      bt = {x=32372, y=32254, z=8}, -- Blue Team Temple
      bgstg = 8005 --Another Global Storage
		}
	]]></config>
	<talkaction words="!pvp" event="script"><![CDATA[
		domodlib('config')
local nm = ((config.tc)+(config.tc)+1)
local conditionBlue = createConditionObject(CONDITION_OUTFIT)
        setConditionParam(conditionBlue, CONDITION_PARAM_TICKS, 1800 * 1000)
        addOutfitCondition(conditionBlue, {lookType = 152, lookHead = 87, lookBody = 87, lookLegs = 87, lookFeet = 87})
local conditionRed = createConditionObject(CONDITION_OUTFIT)
        setConditionParam(conditionRed, CONDITION_PARAM_TICKS, 1800 * 1000)
        addOutfitCondition(conditionRed, {lookType = 143, lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94})
function onSay(cid, words, param)
	if getGlobalStorageValue(config.bgstg) == -1 or getGlobalStorageValue(config.gstg) == nm then
			return doPlayerSendCancel(cid, "Sorry, the event is closed or full") and false
		end
				if getPlayerStorageValue(cid, config.t1s) == 1 or getPlayerStorageValue(cid, config.t2s) == 1 then
			return doPlayerSendCancel(cid, "You already are in the event!") and false
		end
			if getGlobalStorageValue(config.bgstg) == 1 and getGlobalStorageValue(config.tgstg) == -1 then
				doTeleportThing(cid, config.rt)
				setPlayerStorageValue(cid, config.t2s, 1)
				doAddCondition(cid, conditionRed)
				doPlayerSendTextMessage(cid, 21, "You're going to fight for the "..config.t2.." so pew the shit out of the "..config.t1.."")
				setGlobalStorageValue(config.tgstg, 1)
				setGlobalStorageValue(config.gstg, getGlobalStorageValue(config.gstg)+1)
					else
						if getGlobalStorageValue(config.bgstg) == 1 then       
							doTeleportThing(cid, config.bt)     		  
							setPlayerStorageValue(cid, config.t1s, 1)
							doAddCondition(cid, conditionBlue)
							doPlayerSendTextMessage(cid, 21, "You're going to fight for the "..config.t1.." so pew the shit out of the "..config.t2.."")
							setGlobalStorageValue(config.tgstg, -1)
							setGlobalStorageValue(config.gstg, getGlobalStorageValue(config.gstg)+1)
						end
				end     	
	return TRUE
end	
	]]></talkaction>
		<talkaction words="/startevent; !startevent" event="script"><![CDATA[
		domodlib('config')
		local nm1 = ((config.tc)+(config.tc))
		local nm2 = ((config.tc)+1)
function onSay(cid, words, param)
    if getGlobalStorageValue(config.bgstg) == -1 and getPlayerGroupId(cid) >= 3 then
       doBroadcastMessage("PvP Event started! say !pvp to join!, the event needs "..nm1.." players to start!", MESSAGE_STATUS_WARNING)
       setGlobalStorageValue(config.bgstg, 1)
       setGlobalStorageValue(config.t1s, nm2)
       setGlobalStorageValue(config.t2s, nm2)
       setGlobalStorageValue(config.gstg, 1)
			elseif getGlobalStorageValue(config.gstg) >= 11 then
			doBroadcastMessage("PvP Event is closed!", MESSAGE_STATUS_WARNING)
			setGlobalStorageValue(config.bgstg, -1)
				else
					doPlayerSendTextMessage(cid, 21, "Each team needs "..config.tc.." players to play before you close this!")
			end
return TRUE
end    	
]]></talkaction>
   <event type="death" name="tded" event="script"><![CDATA[
domodlib('config')
local t = {
    [8001] = "Red Trolls",
    [8002] = "Blue Mods"
    }
function onPrepareDeath(cid, corpse, deathlist)
    for k, v in pairs(t) do
        if getGlobalStorageValue(k) >= 2 then
            s = true
        elseif getGlobalStorageValue(k) == 1 and getPlayerStorageValue(cid, k) == 1 then
            for _, pid in ipairs(getPlayersOnline()) do 
                if getPlayerStorageValue(pid, k) then
                    doTeleportThing(pid, getPlayerMasterPos(pid)) 
                end
            end
            doTeleportThing(cid, getPlayerMasterPos(cid))
            doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
            doPlayerAddMana(cid, getPlayerMaxMana(cid) - getPlayerMana(cid))
            doBroadcastMessage(""..v[1].." won the PvP Event!")
        end
    end
    if s then
        if getPlayerStorageValue(cid, config.t1s) == 1 then
            setGlobalStorageValue(config.t1s, getGlobalStorageValue(config.t1s)-1)
            setPlayerStorageValue(cid, config.t1s, -1)
        elseif getPlayerStorageValue(cid, config.t2s) == 1 then
                setGlobalStorageValue(config.t2s, getGlobalStorageValue(config.t2s)-1)
                setPlayerStorageValue(cid, config.t2s, -1)
        end   
    end
    for i = 8001, 8005 do
        setGlobalStorageValue(i, -1)
    end
return true
end
]]></event>

</mod>
Well, here is what I was working on, I already had the !start;/start and the !pvp but couldn't fix the Creature Scripts.
 
Better talkaction IMO:
Lua:
local config = {
      8000, -- empty storage
      8001, -- empty storage
      8002, -- empty storage
      8003, -- empty storage
      8004, -- empty storage
      8005, -- empty storage
      "pandas" -- event name
}
local positions = {  -- random positions of ARENA WHERE EVENT IS PLAYED
{x=0,y=0,z=0},
{x=0,y=0,z=0},
{x=0,y=0,z=0},
{x=0,y=0,z=0},
{x=0,y=0,z=0}
}

local waitingRoom = {
{x=x,y=y,z=z} --- pos of waiting room
}

 
function onSay(cid, words, param)
local t = string.explode(param, ",")
if words == "!start" then
   if getGlobalStorageValue(config[1]) < 0 then
      if not tonumber(t[1]) or t[1] < 0 or t[1] == "" then
         return doPlayerSendCancel(cid, "Missing or not valid parameter")
      else
          for i = 1, 5 do
              setGlobalStorageValue(config[i], config[i] == 1 and 1 or config[i] > 3 and 0 or t[1])
          end
          doBroadcastMessage("Event " .. config[7] .. " has started")
      end
   end
elseif words == "!pvp" then
       team = 0
       if getGlobalStorageValue(start) > 0 then
          team = math.random(2)
          setGlobalStorageValue(config[team == 1 and 4 or 5],getGlobalStorageValue(config[team == 1 and 4 or 5])+1)
          for i = 4, 5 do
              if getGlobalStorageValue(config[i]) == getGlobalStorageValue(config[i-2]) then
                 v = (getGlobalStorageValue(config[i]) == getGlobalStorageValue(config[i-2]) and true or (getGlobalStorageValue(config[i]) == getGlobalStorageValue(config[i-2])-1) and "cutepanda" or false)
              end
          end
          if not v then
             doTeleportThing(cid, waitingArea)
             doPlayerSendTextMessage(MESSAGE_INFO_DESCR, "Please wait til all the spots are full")
             setPlayerStorageValue(cid, config[6], team)
             doBroadcastMessage("Currently " .. getGlobalStorageValue(config[2]) + getGlobalStorageValue(config[3]) .. " players. Players left to begin: " .. (getGlobalStorageValue(config[2]) + getGlobalStorageValue(config[3])) - (getGlobalStorageValue(config[4]) + getGlobalStorageValue(config[5])) .. ".") 
          elseif v then
                 doPlayerSendCancel(cid, "Event is full!")
          elseif v == "cutepanda" then
                 for _, pid in ipairs(getPlayersOnline()) do    
                     if getPlayerStorageValue(pid, config[6]) > 0 then
                        doTeleportThing(pid, math.random(positions))
                     end
                 end
          end
       else
           doPlayerSendCancel(cid, "The event is not available right now")
       end
end
return true
end

Missing a lot of stuff tho, like oufit changer, team checking, etc.
EDIT: Has an ugly bug which I'm too lazy to fix ;&
 
Back
Top