Ulysses

General => Developers Corner => Topic started by: PAL-18 on May 30, 2014, 07:59:12 PM

Title: Encouraging members to wear tag
Post by: PAL-18 on May 30, 2014, 07:59:12 PM
I have a few members in my gaming community who simply refuse to wear the tag, even for a few minutes and I was wondering if a coder who has some time to kill can make the following:

Players who are given reserve permission on the server who are also wearing the tag in their name get the reserved slot.  But if the player isn't wearing the tag, they dont get the reserved slot.

Thanks in advance for anyone considering to help me.
Title: Re: Encouraging members to wear tag
Post by: Valgoid on June 07, 2014, 09:48:07 PM
Alright,
first off make 2 groups, one for the vip who want to wear tags, and another one for the vip who dont want to wear tabs. Name ulx group for the vips who want to have one "VIP" and the others "VIP1". Then, set the permissions from there.

Edit: Hope this helps you.
Title: Re: Encouraging members to wear tag
Post by: MrPresident on June 07, 2014, 10:01:01 PM
I think he wants it to be dynamic. Detect if the player is wearing the tag and then allow them to join as reserved if they are.
Title: Re: Encouraging members to wear tag
Post by: Cobalt on June 07, 2014, 10:08:33 PM
Code: [Select]
function CheckTag( ply )
if string.find( ply:Nick(), "your tag here" ) then
return true
else
return false
end
end

hook.Add( "PlayerInitialSpawn", "CheckName", function( ply )
if CheckTag( ply ) then
ply.tag = true
else
ply.tag = false
end
end )

hook.Add( "ULibPlayerNameChanged", "CheckNameChange", function( ply )
if IsValid( ply ) then
if CheckTag( ply ) then
if ply.tag = false then
ply:ChatPrint( "Thank you for putting on the tag." )
end
ply.tag = true
else
ply.tag = false
end
end
end )

Actually this won't work but you need to check for the tag in the ulx code for reserved slots. Use the same method. Then use the above when you want to give people wearing the tag other benefits in-game.
Title: Re: Encouraging members to wear tag
Post by: Valgoid on June 07, 2014, 10:10:26 PM
Ok, thanks Cobalt, I think I might use that script.
Title: Re: Encouraging members to wear tag
Post by: PAL-18 on June 11, 2014, 11:43:49 AM
Awesome! Many thanks
Title: Re: Encouraging members to wear tag
Post by: PAL-18 on June 13, 2014, 04:48:09 PM
Code: [Select]
function CheckTag( ply )
if string.find( ply:Nick(), "your tag here" ) then
return true
else
return false
end
end

hook.Add( "PlayerInitialSpawn", "CheckName", function( ply )
if CheckTag( ply ) then
ply.tag = true
else
ply.tag = false
end
end )

hook.Add( "ULibPlayerNameChanged", "CheckNameChange", function( ply )
if IsValid( ply ) then
if CheckTag( ply ) then
if ply.tag = false then
ply:ChatPrint( "Thank you for putting on the tag." )
end
ply.tag = true
else
ply.tag = false
end
end
end )

Actually this won't work but you need to check for the tag in the ulx code for reserved slots. Use the same method. Then use the above when you want to give people wearing the tag other benefits in-game.

I assume, i should add that code to "addons\ulx\lua\ulx\modules\slots.lua" but where in that file?