General > Developers Corner

Encouraging members to wear tag

<< < (2/2)

PAL-18:
Awesome! Many thanks

PAL-18:

--- Quote from: Cobalt on June 07, 2014, 10:08:33 PM ---
--- Code: ---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 )
--- End code ---

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.

--- End quote ---

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

Navigation

[0] Message Index

[*] Previous page

Go to full version