• 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!

Simple Team Balance SCRIPT

antoniolagos

Member
Joined
Apr 10, 2010
Messages
34
Reaction score
6
I was looking for an auto balance script, but I didn´t foundd exactly what I need.

Well, I need working scripts that when a player login, change all outfit in color white, but If there is more white players than black players, then outfit changes to black.

I dont need anything else in this script, I mean No teleport, no message on login, just nothing else.

Usefull information:

White colours: lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0
Black colours: lookHead = 114, lookBody = 114, lookLegs = 114, lookFeet = 114

PLEASE HELP ME. IS THE LAST THING I NEED FOR MY SERVER TO BE PERFECT.

IM SORRY MY ENGLISH XD
 
data/creature scripts/creaturescripts.xml:
XML:
  	<event type="login" name="tlog" event="script" value="tlog.lua"/>
    	<event type="logout" name="tout" event="script" value="tout.lua"/>
    	<event type="death" name="tded" event="script" value="tded.lua"/>
data/creature scripts/tlog.lua:
Lua:
local t = {
     t1 = "black",
     t2 = "white",
     gstg = 7000
     }
local conditionBlack = createConditionObject(CONDITION_OUTFIT)
        setConditionParam(conditionBlue, CONDITION_PARAM_TICKS, 1800 * 1000)
        addOutfitCondition(conditionBlue, {lookType = 152, lookHead = 114, lookBody = 114, lookLegs = 114, lookFeet = 114})
local conditionWhite = createConditionObject(CONDITION_OUTFIT)
        setConditionParam(conditionRed, CONDITION_PARAM_TICKS, 1800 * 1000)
        addOutfitCondition(conditionRed, {lookType = 143, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0})

function onLogin(cid)
    if getPlayerGroupId(cid) < 3 then
       if getGlobalStorageValue(t.gstg) == 1 then
          doAddCondition(cid, conditionBlack)
	  setPlayerStorageValue(cid, 6666, 1)
	  doPlayerSendTextMessage(cid, 21, "You're going to fight for the "..t.t1.." so pew the shit out of the "..t.t2.."")
          setGlobalStorageValue(t.gstg, -1)
          else
          doAddCondition(cid, conditionWhite)
          setPlayerStorageValue(cid, 6667, 1)
	  doPlayerSendTextMessage(cid, 21, "You're going to fight for the "..t.t2.." so pew the shit out of the "..t.t1.."")
          setGlobalStorageValue(t.gstg, 1)
       end
    end
return TRUE
end
data/creature scripts/tout.lua:
Lua:
function onLogout(cid)
    if getPlayerStorageValue(cid, 6666) == 1 then
	setPlayerStorageValue(cid, 6666, -1)
        setGlobalStorageValue(t.gstg, 1)
    elseif getPlayerStorageValue(cid, 6667) == 1 then
	setPlayerStorageValue(cid, 6667, -1)
        setGlobalStorageValue(t.gstg, -1)
    end
return true
end
data/creature scripts/tded.lua:
Lua:
function onDeath(cid, corpse, killer)
    if getPlayerStorageValue(cid, 6666) == 1 then
	setPlayerStorageValue(cid, 6666, -1)
        setGlobalStorageValue(t.gstg, 1)
    elseif getPlayerStorageValue(cid, 6667) == 1 then
	setPlayerStorageValue(cid, 6667, -1)
        setGlobalStorageValue(t.gstg, -1)
    end
return true
end

if you don't want the messages delete the lines that contain doPlayerSendTextMessage and if you wish you can delete the t1 and t2 of the local.
 
Last edited:
It works perfect! thanks very much! that script set a global storage when a player login and then it take it off when the player logout. Nice scripts thanks again. I added it to my server ;)
 
Lua:
doPlayerSendTextMessage(cid, 21, "You\'re going to fight for the t.t1 so pew the shit out of the t.t2")
Are you sure it work perfect? I think it should be :
Lua:
doPlayerSendTextMessage(cid, 21, "You're going to fight for the ".. t.t1 .." so pew the shit out of the ".. t.t2)
 
Lua:
doPlayerSendTextMessage(cid, 21, "You\'re going to fight for the t.t1 so pew the shit out of the t.t2")
Are you sure it work perfect? I think it should be :
Lua:
doPlayerSendTextMessage(cid, 21, "You're going to fight for the ".. t.t1 .." so pew the shit out of the ".. t.t2)

oh yeah, was testing something, forgot to edit.
 
Back
Top