Ulysses Stuff > Ulysses Release Archives

AutoPromote

<< < (11/29) > >>

HOLOGRAPHICpizza:
I made a few changes to Smithy's version and uploaded it to garrymod.org and updated the post.

v3.1 Changelog:

* Now loads as a ULX module.
* Calls ULX promote function directly, instead of through a console command.
Thanks Major_Pain and Smithy!

Ploo:
So wait, this is the new version, and I should disregard my problem and download this?

A new version released the very day I need it, how perfect. :D

Does not seem to work, the old one worked some-what... :S


--- Code: ---if not SERVER then return end

--AutoPromote 2.0
--Automaticly promotes players to different groups based on UTime.

--[[
CREDIT FOR THIS VERSION OF AUTOPROMOTE GOES TO:
HOLOGRAPHICpizza
Major_Pain
Smithy
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 = 2, group = "member", name = "Member" },
{ hours = 5, group = "bronze", name = "Bronze Member" },
{ hours = 20, group = "silver", name = "Silver Member" },
{ hours = 50, group = "gold", name = "Gold Member" },
{ hours = 100, group = "platinum", name = "Platinum Member" }
}

---------IF A PLAYER IS A MEMBER OF THESE GROUPS THEY WONT GET PROMOTED.......EVER
excludes = { "dj", "donator", "mod", "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

local cID = 1

function checkExcludes( ply )
for id, eX in pairs (excludes) do
if not ply:IsUserGroup(excludes[id]) then
exclude = false
else
exclude = true
end
end
return exclude
end

function groupSet( ply )
local plhrs = math.floor((ply:GetUTime() + CurTime() - ply:GetUTimeStart())/60/60)
while plhrs >= promotes[cID].hours and cID < table.Count(promotes) do
cID = cID + 1
groupTS = promotes[cID-1].group
end
if cID == table.Count(promotes) then
groupTS = promotes[table.Count(promotes)].group
return true
else
if cID <= 2 then
if plhrs >= promotes[1].hours then
return true
end
else
if plhrs >= promotes[cID-1].hours then
return true
end
end
end
return false
end

function promotePlayer( ply )
if not checkExcludes( ply ) then
cID = 1
if  groupSet( ply ) and not ply:IsUserGroup(groupTS) then
if settings[1].msgOn then
for ud, blank in pairs( player.GetAll()) do
if cID == table.Count(promotes) then
cID = table.Count(promotes) + 1
return true
else
ULib.tsayColor(player.GetAll()[ud],false,settings[1].msgcol,ply:Nick().." has been promoted to '"..promotes[cID-1].name.."'.")
end
end
cID = 1
if settings[1].effOn then
effectS( ply )
WorldSound( "autopromote/promote.wav", ply:GetPos( 0, 0, 0 ), 160, 100 )
end
ulx.adduser(nil, ply, groupTS)
--game.ConsoleCommand("ulx adduser "..string.format("%q", ply:Nick() ).." "..groupTS.."\n")
end
end
if not timer.IsTimer("Promotion-" ..tostring(ply:SteamID())) then
timer.Create("Promotion-" ..tostring(ply:SteamID()), 10, 0, promotePlayer, ply)
end
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 timerStart( ply )
timer.Create("Promotion-" ..tostring(ply:SteamID()), 10, 0, promotePlayer, ply)
end
hook.Add( "PlayerInitialSpawn", "timerstarting", timerStart)

function destroyTimers(ply)
if timer.IsTimer("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 ---

smithy:
Add me on steam Ploo and I'll try and help you. :)

JamminR:
Smithy released a version of his own within holographic pizza's.
Prob should have made his own release - Smithy's Autopromote or something similar.

smithy:
It's not a new script though, its based from HOLO's.
Version 3.1 that HOLO released is just my v3 version in modular form, with slight fixes. We worked together on 3.1.
There is no need for a new thread for the same addon, am I right?
Anyway Ploo if you are still having problems add me on steam, like I said it has been tested and works fine - so its probably misconfiguration somewhere.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version