General > Developers Corner

Chat icon problem With ulx

<< < (2/2)

JamminR:

--- Quote from: Nightmare2244 on March 30, 2016, 05:36:07 AM ---but leaves my SuperAdmin having the shield of the admin now.

Heres the code now:

--- Code: ---if TextTable[i]:IsUserGroup("owner") then
icon = OwnerIcon
elseif TextTable[i]:IsSuperAdmin() then
icon = AdminIcon
elseif TextTable[i]:IsAdmin() then
icon = SuperAdminIcon
--- End code ---

--- End quote ---
You need to adjust your icon assignment order too. :)
Your code currently assigns AdminIcon to icon if IsSuperAdmin, and SuperAdminIcon to icon if IsAdmin.

I'll also go ahead and give you a tip; learn how to use Gmod relative paths.
If you share this code as an addon with others, the files they have aren't going to be the same as your c:/garrysmod/garrysmod/Materials/. Gmod's "Material" command starts in <server root>/Materials. So, changing your Material statements, as an example from your first post for ownericon to Material("icon16/shield_rainbow.png") should work, and be transportable as a pack to others.

Nightmare2244:

--- Quote from: JamminR on March 30, 2016, 08:05:23 PM ---You need to adjust your icon assignment order too. :)
Your code currently assigns AdminIcon to icon if IsSuperAdmin, and SuperAdminIcon to icon if IsAdmin.

I'll also go ahead and give you a tip; learn how to use Gmod relative paths.
If you share this code as an addon with others, the files they have aren't going to be the same as your c:/garrysmod/garrysmod/Materials/. Gmod's "Material" command starts in <server root>/Materials. So, changing your Material statements, as an example from your first post for ownericon to Material("icon16/shield_rainbow.png") should work, and be transportable as a pack to others.

--- End quote ---

Very true, I jused used my whole path so if error did wanna appear about it, I wouldn't have to take the time to fix it. I am just experimenting with it, but yes I should use relative paths.

Navigation

[0] Message Index

[*] Previous page

Go to full version