• Print

Author Topic: Private repo/Targetting  (Read 10639 times)

0 Members and 1 Guest are viewing this topic.

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Private repo/Targetting
« on: January 26, 2017, 05:28:13 am »
I actually have two questions I just didn't want to make two threads. My first question is, is there a way to have a free version of GitHub's private repositories? I have a project I'm working on and I'd like to keep it private but I don't want to have to pay for a private repository and I'd like to be able to work on it when I'm not at home, so I need somewhere where I can access it when I'm not.


My second question is about ULX targeting, how do you get it to match partial names? The project I'm working on has some admin commands in them, and the only thing I can think of is if the string matches any part of the target's name, which I'm using
Code: Lua
  1. if string.find( text[ 2 ], string.lower( v:Nick() ) )
where text is the text in a PlayerSay hook that was exploded. Now that I'm writing that... I see that it's going to check if that string is in the person's name which is a partial match... But to add on to that, how is it when you have a single person (PlayerArg) command it will give the list of names that have the partial match in them? Like if they used !goto or something on 'a' but it can't target all the people with 'a' in their name, so it says a list of the players it could've been?




EDIT: I don't feel like spamming threads so I do have another question, what's the safest way of using Net messaging so that client's can't exploit them?
« Last Edit: January 26, 2017, 05:30:17 am by iViscosity »
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline Bytewave

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 718
  • Karma: 116
  • :)
    • My Homepage
Re: Private repo/Targetting
« Reply #1 on: January 26, 2017, 10:19:21 am »
1. BitBucket offers free private repositories if you're willing to use something new. Think Github with a slightly different UI. Still uses git on the backend, so not a huge change.

3. Validity checks. If you have, say, a net message that sends player-saved data to the server (a la a "loadout" of weapons), make sure the player should actually be able to have those weapons. If it were TTT, for example, don't let them have a gravity gun if they aren't allowed to. Or, if the addon is for certain ranks only, you can verify who sent the net message and if they have the correct permissions.
It's hard to judge security without context though. A use-case would help in determining how exactly to "secure" your net messages.
bw81@ulysses-forums ~ % whoami
Homepage

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Re: Private repo/Targetting
« Reply #2 on: January 26, 2017, 01:25:52 pm »
GitLab is also a good alternative that allows you to have private git repositories. You can also apply for GitHub's student developer pack if you are... well, a student, and get their private repo plan for free for a certain amount of time.
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Private repo/Targetting
« Reply #3 on: January 28, 2017, 04:16:56 pm »
For your second question, you should answer it yourself by reviewing the relevant source code: https://github.com/TeamUlysses/ulib/blob/3e3e5fed7fbdaa7884f35330e0f1628948c4ddc8/lua/ulib/shared/player.lua#L291
Experiencing God's grace one day at a time.

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: Private repo/Targetting
« Reply #4 on: March 07, 2017, 08:35:20 am »
For your second question, you should answer it yourself by reviewing the relevant source code: https://github.com/TeamUlysses/ulib/blob/3e3e5fed7fbdaa7884f35330e0f1628948c4ddc8/lua/ulib/shared/player.lua#L291

I've got a question, would I be able to steal this from you?

I can give credits if so, but if you don't want me to that's fine but it would be very useful for what I'm trying to do.
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Private repo/Targetting
« Reply #5 on: March 07, 2017, 02:45:23 pm »
You're free to steal it as long as you follow the license -- https://creativecommons.org/licenses/by-nc-sa/3.0/

Though, another option is to simply use ULib for targeting. It's quite handy. :)
Experiencing God's grace one day at a time.

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: Private repo/Targetting
« Reply #6 on: March 08, 2017, 08:15:43 am »
Ok so say I had an example like this:

Code: Lua
  1.  
  2. local Player = FindMetaTable( "Player" )
  3.  
  4. function Player:EXP_GiveExp( exp )
  5.    self.EXP_Exp = self.EXP_Exp + exp
  6.    self:CheckLevel()
  7.    self:EXP_UpdateAll()
  8. end
  9.  
(While all of those are defined)

Would I be able to do something like this in an admin file or something?:

Code: Lua
  1. function EXP.Admin_GiveExperience( admin, target, exp )
  2.     local targ = ULib.getUser( target, true, admin )
  3.  
  4.     targ:EXP_GiveExp( exp )
  5.  
  6.  
  7.     ulx.fancyLogAdmin( admin, string.format( EXP.AdminCommandMessage, admin:Nick(), " gave ", exp, " to ", targ:Nick() ) )
  8. end
  9.  


Even if I'm not in the ULX environment?
« Last Edit: March 08, 2017, 08:27:35 am by iViscosity »
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2727
  • Karma: 430
    • |G4P| Gman4President
Re: Private repo/Targetting
« Reply #7 on: March 08, 2017, 12:57:35 pm »
Yes. You can call ULib anywhere you want. I thought we've been over this?

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2727
  • Karma: 430
    • |G4P| Gman4President
Re: Private repo/Targetting
« Reply #8 on: March 08, 2017, 12:59:06 pm »
The only time you would run into issues with mod load order (like I mentioned before) is if you're trying to call ULib functions outside of other functions that are getting run when the file loads but only if that file loads before ULib loads.

pretty much anything inside of a function that you call after the gamemode loads (so your experience function for example) is perfectly safe to use Ulib functions.

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: Private repo/Targetting
« Reply #9 on: March 09, 2017, 09:44:47 am »
My question was: will things like ulx..fancyLogAdmin() work when not in ulx environment?
And the other is: is that how getUser works because it's used automatically when in a ulx command.
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Private repo/Targetting
« Reply #10 on: March 09, 2017, 11:34:06 am »
What do you mean by environment? ULX runs in both the client and server Lua states. You can call any ULX or ULib function you desire in both as they are global tables.
Experiencing God's grace one day at a time.

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: Private repo/Targetting
« Reply #11 on: March 09, 2017, 12:39:12 pm »
I guess I never said what I meant by environment, I mean in the 'lua/ulx/<modules>/'. Something like that.

So both ULib and ulx functions are global, and can be called anywhere? I just want to make sure even thought I'm sure you've both probably answered and I'm just not understanding. And that is now ULib.getUser works, correct?
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2727
  • Karma: 430
    • |G4P| Gman4President
Re: Private repo/Targetting
« Reply #12 on: March 09, 2017, 02:32:10 pm »
lua doesn't work that way..

The only time code can't be used anywhere in lua is if you define it as local, in which case they can only be used in the file they're created, or inside of the function they're created in.

Otherwise, it's global and you can call it from any file you want.

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: Private repo/Targetting
« Reply #13 on: March 09, 2017, 03:38:43 pm »
That's something new to me, I actually didn't know that. Sorry if I'm frustrating you all I was just trying to understand. I didn't know lua worked like that.
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2727
  • Karma: 430
    • |G4P| Gman4President
Re: Private repo/Targetting
« Reply #14 on: March 09, 2017, 04:46:39 pm »
Lua loads into one giant environment.

Well.. 2.

One clientside and 1 serverside.

  • Print