ULX

Author Topic: Need help with coding  (Read 7187 times)

0 Members and 4 Guests are viewing this topic.

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: Need help with coding
« Reply #15 on: July 01, 2015, 09:56:03 AM »
So what do I do with the second code?
(Sorry, I'm probaly stupid :P)
What do you mean?  Do you want to make the tag hsv along with the name?  Do you want to add more groups?

Offline Janjakob2000

  • Jr. Member
  • **
  • Posts: 65
  • Karma: 0
Re: Need help with coding
« Reply #16 on: July 01, 2015, 11:02:51 AM »
What do you mean?  Do you want to make the tag hsv along with the name?  Do you want to add more groups?
I want to make the tag hsv along with the name.

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: Need help with coding
« Reply #17 on: July 01, 2015, 05:35:58 PM »
I want to make the tag hsv along with the name.
I'm having problems with my ssd, so it might take me a day or two... but basically just move the group check to the tag instead of the name (or leave it on both).

Offline Janjakob2000

  • Jr. Member
  • **
  • Posts: 65
  • Karma: 0
Re: Need help with coding
« Reply #18 on: July 02, 2015, 06:03:28 AM »
I'm having problems with my ssd, so it might take me a day or two... but basically just move the group check to the tag instead of the name (or leave it on both).

I'll just wait for you to tell me what to do, as I don't want to break anything.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Need help with coding
« Reply #19 on: July 02, 2015, 10:11:47 AM »
Experiment. Look at the code. There are bits in it that relate to checking a group.
Make a copy of the file, put it somewhere that if you break it you can put the working copy back.
Then try moving the portion that you think looks like a group check in front of the portion that is where you want it.
So far, few of the questions I've seen you ask are 'help me learn' question as much as they are 'tell me what to do by doing it for me'.
Not to say that's not allowed here, but it's misleading with your topic title.

"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Janjakob2000

  • Jr. Member
  • **
  • Posts: 65
  • Karma: 0
Re: Need help with coding
« Reply #20 on: July 02, 2015, 11:13:24 AM »
Experiment. Look at the code. There are bits in it that relate to checking a group.
Make a copy of the file, put it somewhere that if you break it you can put the working copy back.
Then try moving the portion that you think looks like a group check in front of the portion that is where you want it.
So far, few of the questions I've seen you ask are 'help me learn' question as much as they are 'tell me what to do by doing it for me'.
Not to say that's not allowed here, but it's misleading with your topic title.

What I was meaning to say is, in what directory do I put these codes, do I put it in addons/apple_chat_manage_tags/cl_chattags
or do I create for both a seperate file?
e.g.:
addons/apple_chat_manage_tags/newfile.lua
which has the second code of what Aaron made.

I know how to code, but I'm bad at directorys and where to put files at.

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: Need help with coding
« Reply #21 on: July 02, 2015, 10:21:51 PM »
What I was meaning to say is, in what directory do I put these codes, do I put it in addons/apple_chat_manage_tags/cl_chattags
or do I create for both a seperate file?
e.g.:
addons/apple_chat_manage_tags/newfile.lua
which has the second code of what Aaron made.

I know how to code, but I'm bad at directorys and where to put files at.
All you do is replace the original file.  You shouldn't have to change anything except the contents of that file you first mentioned.

EDIT:  I just switched everything over to my other hard drive (I think my SSD is failing), if you still need help I can do it tomorrow.
« Last Edit: July 02, 2015, 10:24:13 PM by Aaron113 »

Offline Janjakob2000

  • Jr. Member
  • **
  • Posts: 65
  • Karma: 0
Re: Need help with coding
« Reply #22 on: July 02, 2015, 11:45:38 PM »
All you do is replace the original file.  You shouldn't have to change anything except the contents of that file you first mentioned.

EDIT:  I just switched everything over to my other hard drive (I think my SSD is failing), if you still need help I can do it tomorrow.
I would really appreciate it if you would make it the tag along with the username rainbow.
(Like stated above)

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: Need help with coding
« Reply #23 on: July 03, 2015, 08:53:25 AM »
I would really appreciate it if you would make it the tag along with the username rainbow.
(Like stated above)
I'll let you figure out how to incorporate it into my code so you're at least trying to do something.

Code: [Select]
if table.HasValue(hsv_tags, ply:GetUserGroup()) then
table.insert(addchat, "<hsv>".. teamnick .."</hsv>")
table.insert(addchat, Color(50, 50, 50, 255))
table.insert(addchat, "| ")
table.insert(addchat, "<hsv>"..ply:Nick() .."</hsv>")
else
table.insert(addchat, teamcolor)
table.insert(addchat, teamnick)
table.insert(addchat, Color(50, 50, 50, 255))
table.insert(addchat, "| ")
table.insert(addchat, teamcolor)
table.insert(addchat, ply:Nick())
end

Offline Janjakob2000

  • Jr. Member
  • **
  • Posts: 65
  • Karma: 0
Re: Need help with coding
« Reply #24 on: July 04, 2015, 04:26:47 AM »
I'll let you figure out how to incorporate it into my code so you're at least trying to do something.

Code: [Select]
if table.HasValue(hsv_tags, ply:GetUserGroup()) then
table.insert(addchat, "<hsv>".. teamnick .."</hsv>")
table.insert(addchat, Color(50, 50, 50, 255))
table.insert(addchat, "| ")
table.insert(addchat, "<hsv>"..ply:Nick() .."</hsv>")
else
table.insert(addchat, teamcolor)
table.insert(addchat, teamnick)
table.insert(addchat, Color(50, 50, 50, 255))
table.insert(addchat, "| ")
table.insert(addchat, teamcolor)
table.insert(addchat, ply:Nick())
end

Basically, if I add "premium" at line 1 near IsUserGroup(), it would check for the group premium, and make the teamnick, so I think the tag the user has, which in this case is [Premium] , will be rainbow colored along with ..ply:Nick() ..
If the player isn't premium (else at line 6), they will just keep their regular name, without any rainbow because they are not in the premium group.

Now, if I'm correct, I should place this code into my cl_chat_apple_tag.lua file, located at addons/apple_manage_chat_tags/lua/autorun
but I have 1 problem, if I want to create another group, do I just create another if table.HasValue below this code and do the same thing over, but then instead remove hsv_tags and remove the <hsv></hsv>, or not?
« Last Edit: July 04, 2015, 04:31:02 AM by Janjakob2000 »

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: Need help with coding
« Reply #25 on: July 04, 2015, 02:55:23 PM »
Basically, if I add "premium" at line 1 near IsUserGroup(), it would check for the group premium, and make the teamnick, so I think the tag the user has, which in this case is [Premium] , will be rainbow colored along with ..ply:Nick() ..
If the player isn't premium (else at line 6), they will just keep their regular name, without any rainbow because they are not in the premium group.
You wouldn't change the group check, you would add groups to the table.  You would want to change the "superadmin" in hsv_tags to premium.

but I have 1 problem, if I want to create another group, do I just create another if table.HasValue below this code and do the same thing over, but then instead remove hsv_tags and remove the <hsv></hsv>, or not?
Do you mean group as in another style of chat tag?  or just adding another group to the hsv tags?

Offline Janjakob2000

  • Jr. Member
  • **
  • Posts: 65
  • Karma: 0
Re: Need help with coding
« Reply #26 on: July 05, 2015, 12:33:15 AM »
You wouldn't change the group check, you would add groups to the table.  You would want to change the "superadmin" in hsv_tags to premium.
Do you mean group as in another style of chat tag?  or just adding another group to the hsv tags?

"You wouldn't change the group check, you would add groups to the table.  You would want to change the "superadmin" in hsv_tags to premium."

Can you explain me how that would work then?

Also, I just want another chat tag, for staff ranks such as superadmin, admin, owner ect., just like the normal addon provides that, the apple_chat_manage_tags one, but then in your format like you provided before.

Offline Janjakob2000

  • Jr. Member
  • **
  • Posts: 65
  • Karma: 0
Re: Need help with coding
« Reply #27 on: July 28, 2015, 07:36:22 AM »
You wouldn't change the group check, you would add groups to the table.  You would want to change the "superadmin" in hsv_tags to premium.
Do you mean group as in another style of chat tag?  or just adding another group to the hsv tags?
It really has been a while, I've tryed to learn lua, I've came far, but I still don't know how to do this, can you maybe like explain me what to do, because I don't know what I have to do...

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: Need help with coding
« Reply #28 on: July 28, 2015, 07:52:12 AM »
Do you understand what a table is?  Perhaps you should read up on it or experiment with it.

You add your hsv tag groups to the hsv_tags table and it automatically does it for you.  If you want to apply some other type of effect, you need to add an elseif check behind my first if check.