English TopNotch - Get USGN username (ingame) icon

17 comments
29.05.16 08:55:48 pm
like 12 like it!
2 kb, 45 Downloads
TopNotch
User
Offline Off
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 (20)).
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.
imageimageimageimageimage
edited 18×, last 27.03.17 07:14:01 pm
ok This file has been reviewed and approved by Yates (29.05.16 08:59:37 pm)

Comments

17 comments
Goto Page
To the start Previous 1 Next To the start

Log in!

You need to log in to be able to write comments!Log in
06.06.16 08:25:56 am
like I like it!
Up
apex2d
User
Offline Off
no1'll ever hide again
04.06.16 08:32:58 pm
like I like it!
Up
Borealis
Moderator
Offline Off
@user hope you remember 4D: 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!
03.06.16 10:33:21 am
like I like it!
Up
it is good for offline users? cause sometimes my router is always turning off...
30.05.16 11:27:10 pm
like I like it!
Up
Promaster
User
Offline Off
I think some server might find this code usefull, but yeah nice code with only that small lines! One like from me
30.05.16 07:10:51 pm
like I like it!
Up
DarwinFTW
User
Offline Off
Very usele..*ehm* Useful!
1 like = 1 TopNotch
30.05.16 05:42:49 pm
like I like it!
Up
Goo
User
Offline Off
is lua
30.05.16 04:10:34 pm
like I like it!
Up
P_206
BANNED
Offline Off
Cool script , Make sure that it function's Correctly Before you will Upload a another file , And thanks
30.05.16 03:50:14 pm
Up
TopNotch
User
Offline Off
@user VADemon: Thank you for the suggestion, the script now checks if USGN is online, otherwise it won't proceed.
30.05.16 02:55:50 pm
Up
VADemon
User
Offline Off
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.
30.05.16 10:37:31 am
Up
TopNotch
User
Offline Off
@user ohaz: Added wget.
30.05.16 09:15:43 am
Up
ohaz
User
Online On
Pure Lua: Uses cURL.
Only 1kb: Requires "huge" cURL file.
30.05.16 06:52:04 am
like I like it!
Up
MikuAuahDark
User
Offline Off
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.
29.05.16 11:15:40 pm
Up
Hajt
User
Offline Off
In my opinion better solution is download the list of all users into one file and then load it to an array.
Code:
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.
29.05.16 11:01:23 pm
like I like it!
Up
Jite
User
Offline Off
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.
29.05.16 10:26:42 pm
like I like it!
Up
Untitled
User
Offline Off
Dope.
29.05.16 10:12:12 pm
like I like it!
Up
AtomKuh
User
Offline Off
Thanks for uploading this
29.05.16 08:57:57 pm
like I like it!
Up
G3tWr3ck3d
User
Offline Off
Verry usefull
To the start Previous 1 Next To the start