Ulysses Stuff > Ulysses Release Archives

AutoPromote

<< < (27/29) > >>

blureh:
Where do i put this? i put it in my addons and it doesn't even load with the server?

JamminR:
Well, as is usual for most release posts here made before October 2012, make sure you're trying an updated version, IF one exists.
http://forums.ulyssesmod.net/index.php/topic,3826.msg27481.html#msg27481
If that doesn't work for you, try IMing the user?

datgregofag:
I want it so it just promotes a player from user to Respected in 3 hours, can you show me how to do that? Thank You.

Zevoxa:

--- Quote from: datgregofag on February 10, 2013, 10:30:29 AM ---I want it so it just promotes a player from user to Respected in 3 hours, can you show me how to do that? Thank You.

--- End quote ---

Go into C:\(Gmod Server Directory)\orangebox\garrysmod\addons\AutoPromote\lua\ulx\modules\AutoPromote.lua

And if I am correct (if I'm not, someone correct me), this should be the code for what you're trying to do.


--- Code: -----[[
CREDIT FOR THIS VERSION OF AUTOPROMOTE GOES TO:
HOLOGRAPHICpizza
Major_Pain
Smithy
Jay209015

Garry's Mod 13 fix by EmilHem

PRETTY SELF EXLANATORY
HOURS  IS THE POINT OF WHERE THE PLAYER WILL GET PROMOTED TO THE GROUP
NAME IS THE NAME THAT WILL GET DISPLAYED WHEN SOMEONE GETS PROMOTED
]]
promotes = {
{ hours = 3, group = "Respected", name = "Respected" },

}

---------IF A PLAYER IS A MEMBER OF THESE GROUPS THEY WONT GET PROMOTED.......EVER
excludes = { "admin", "superadmin" }

---------Chat announcement settings, msgOn  - if true then it will announce promotions(false if you want it disabled), msgcol - color of the chat announcements
settings = {
{ msgOn = true, msgcol = Color(255,225,0), effOn = true }
}

---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
--------------------- DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING---------------
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
if settings[1].effOn then
resource.AddFile( "sound/autopromote/promote.wav" )
end



function checkExcludes( ply )
for id, eX in pairs (excludes) do
if ply:IsUserGroup(eX) then
return true
end
end
return false
end

function hoursToPromote( group )
for id, blank in ipairs( promotes ) do
if group == promotes[id]["group"] then
return promotes[id]["hours"]
end
end
end

function getPromoteName( group )
for id, blank in ipairs( promotes ) do
if group == promotes[id]["group"] then
return promotes[id]["name"]
end
end
end

function loopBlock( ply )
local toMark = 0;
local fromMark = 0;
for i=1, table.Count(promotes) do
if ply.promote == promotes[i]["group"] then
toMark = i;
end
if ply:IsUserGroup( promotes[i]["group"] ) then
fromMark = i;
end
end
print("fromMark: "..tostring(fromMark).." (<) toMark: "..tostring(toMark))
if fromMark < toMark then
return true
else
return false
end
end

function groupSet( ply )
ply.plhrs = math.floor((ply:GetUTime() + CurTime() - ply:GetUTimeStart())/60/60)
ply.promote = promotes[1]["group"]
for id, blank in ipairs(promotes) do
if ply:IsUserGroup(promotes[id]["group"]) and id < table.Count(promotes) then
ply.promote = promotes[id + 1]["group"]
end
end
if not(ply:IsUserGroup(ply.promote)) and (ply.plhrs >= hoursToPromote( ply.promote )) and loopBlock(ply) then
return true
end
return false
end

function effectS( ply )
local ed = EffectData()
ed:SetEntity(ply)
util.Effect("autopromotion",ed, true, true)
local vPoint = ply:GetPos()
local effectdata = EffectData()
local r = math.random(20, 255)
local g = math.random(20, 255)
local b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
effectdata:SetOrigin( vPoint )
effectdata:SetScale( 1 )
util.Effect( "autopromotion2", effectdata )
timer.Simple( 1, function()
r = math.random(20, 255)
g = math.random(20, 255)
b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
local vPoint = ply:GetPos()
effectdata:SetOrigin( vPoint )
util.Effect( "autopromotion2", effectdata )
end)
timer.Simple( 2, function()
r = math.random(20, 255)
g = math.random(20, 255)
b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
local vPoint = ply:GetPos()
effectdata:SetOrigin( vPoint )
util.Effect( "autopromotion2", effectdata )
end)
timer.Simple( 3, function()
r = math.random(20, 255)
g = math.random(20, 255)
b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
local vPoint = ply:GetPos()
effectdata:SetOrigin( vPoint )
util.Effect( "autopromotion2", effectdata )
end)
timer.Simple( 4, function()
r = math.random(20, 255)
g = math.random(20, 255)
b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
local vPoint = ply:GetPos()
effectdata:SetOrigin( vPoint )
util.Effect( "autopromotion2", effectdata )
end)
end

function promotePlayer( ply )
if not checkExcludes( ply ) then
if groupSet( ply ) then
if settings[1].msgOn then
for ud, blank in pairs( player.GetAll()) do
ULib.tsayColor(player.GetAll()[ud],false,settings[1].msgcol,ply:Nick().." has been promoted to '"..getPromoteName(ply.promote).."'.")
end
end
if settings[1].effOn then
effectS( ply )
sound.Play( "autopromote/promote.wav", ply:GetPos( 0, 0, 0 ), 160 )
end
game.ConsoleCommand( "ulx adduserid "..ply:SteamID().." "..ply.promote.."\n" ) // I'm using this since it works and logs in the console. -EmilHem
end
end
if not timer.Exists("Promotion-" ..tostring(ply:SteamID())) then
timer.Create( "Promotion-"..tostring(ply:SteamID()), 15, 0, function() if not (ply and IsValid(ply)) then return end promotePlayer( ply ) end )
end
end

function timerStart( ply )
timer.Create( "Promotion-"..tostring(ply:SteamID()), 15, 0, function() if not (ply and IsValid(ply)) then return end promotePlayer( ply ) end )
end
hook.Add( "PlayerInitialSpawn", "timerstarting", timerStart )

function destroyTimers(ply)
if timer.Exists("Promotion-" ..tostring(ply:SteamID())) then
timer.Stop("Promotion-" ..tostring(ply:SteamID()))
timer.Destroy("Promotion-" ..tostring(ply:SteamID()))
end
end
hook.Add( "PlayerDisconnected", "PromotionCleanUP", destroyTimers )
--- End code ---

I'd suggest you also look around in there to see if you want to change anything else.

datgregofag:
TY Zevoxa and i also changed the people who wont get updated to respected like respected itself and oeprator and Vip ( well those are jut the ranks in my server).

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version