Files

> > CS2D > Lua Scripts > TopNotch - Get USGN username (ingame)
Files overviewCS2D overviewLua Scripts overview

English TopNotch - Get USGN username (ingame) >

17 comments2 kb, 498 Downloads

old TopNotch - Get USGN username (ingame)

TopNotch
User Off Offline

Hello guys,

It's been a while I've uploaded a file to Unreal Software... But today I'm bringing you an useful tool.
With this small script, you can convert a USGN ID to a USGN name, and vice versa.

Actually there is already a file in the file archive, which probably does about the same (file cs2d Get USGN Name ).
The difference is, his script weighs 2.55MB and this one 1kb and is pure Lua. And,... also allows finding a usgn id by username.

> Features
• USGN ID to Username
• Username to USGN ID
• Added sample join message
• Added sample commands:
- !nametoid <name>
- !idtoname <usgn id>


> Functions
Spoiler >


> Config
Spoiler >


> Requirements
• cURL
• wget (optional)


30-05-2016:
FIXED
Checks if USGN is online before actually doing the requests


https://github.com/topn0tch/usgnconvert

Have fun.
edited 18×, last 27.03.17 07:14:01 pm
Approved by Yates

Download Download

2 kb, 498 Downloads

Comments

17 comments
To the start Previous 1 Next To the start

Log in!

You need to log in to be able to write comments!Log in

old

apex2d
User Off Offline

no1'll ever hide again
I like it!

old

GeoB99
Moderator Off Offline

@user Vennece: Every time you either convert a name into U.S.G.N. ID or vice versa, a packet request will be sent to the website to acquire the specific user's data so no, it's not recommendable for offline users or those who have instant loss with the Internet connection.

For that matter, I've been thinking same like user Hajt just past days. I guess you might want to implement his idea as it can be very useful in particular cases. Overall, this script isn't just lightweight but also you've came with a new idea in hand. Great!
I like it!

old

Vennece
User Off Offline

it is good for offline users? cause sometimes my router is always turning off...
I like it!

old

Promaster
User Off Offline

I think some server might find this code usefull, but yeah nice code with only that small lines! One like from me
I like it!

old

DarwinFTW
User Off Offline

Very usele..*ehm* Useful!
1 like = 1 TopNotch
I like it!

old

Mami Tomoe
User Off Offline

is lua
I like it!

old

P_206
BANNED Off Offline

Cool script , Make sure that it function's Correctly Before you will Upload a another file , And thanks
I like it!

old

TopNotch
User Off Offline

@user VADemon: Thank you for the suggestion, the script now checks if USGN is online, otherwise it won't proceed.

old

VADemon
User Off Offline

How does it handle server errors like 403, 404, timeouts?
Doesn't io.popen stop execution of everything else until curl is finished?
Basically +1 to @user Hajt's comment.

old

ohaz
User Off Offline

Pure Lua: Uses cURL.
Only 1kb: Requires "huge" cURL file.

old

MikuAuahDark
User Off Offline

Wait, does Linux version of CS2D is compiled with -DLUA_USE_LINUX? If it doesn't, io.popen will throw "popen not supported" instead. However, this is not the case for Windows build of CS2D and io.popen will work as expected.

Also the "Linux" requirement doesn't needed here because Windows build of cURL can be download in here.

Anyway, the idea of using cURL is nice.
I like it!

old

Hajt
User Off Offline

In my opinion better solution is download the list of all users into one file and then load it to an array.
1
2
3
4
5
6
7
8
-- wget -O /home/cs2d/users.txt 'http://www.unrealsoftware.de/users.php?raw&s=0&c=4294967295'
users = {}
local file = io.open("/home/cs2d/users.txt", "r")
for line in file:lines() do
	local userid, name = line:match("([^,]+),([^,]+)")
	table.insert(users, tonumber(userid), name)
end
file:close()

Why? It'll work always even if Unreal Software doesn't work and io.popen freezes the server while sending requests. Moreover you can add auto-update by using crontab to get newest list of users.

old

Jite
User Off Offline

Quote
The difference is, his script weighs 2.55MB and mine 1kb and is pure Lua. And,... also allows finding a usgn id by username.


Yey, that's worth to upload the script.
I like it!

old

Untitled
User Off Offline

Dope.
I like it!

old

AtomKuh
User Off Offline

Thanks for uploading this
I like it!

old

G3tWr3ck3d
User Off Offline

Verry usefull
I like it!
To the start Previous 1 Next To the start