|
Veteran Member
Join Date: Jul 2008
Location: Santiago, Chile
|

09-27-2011
, 20:12
SteamID Converter
|
#1
|
SteamID Converter
Version: 1.0
Descripcion:
Podrás convertir tu SteamID ( STEAM_0:1:17619 ) a SteamID 64 y viceversa
Aún no es una versión oficial ni de presentación para New Plugins Submissions
Código:
PHP Code:
#include <amxmodx> #include <regex>
#define PLUGIN "SteamID Converter" #define VERSION "1.0" #define AUTHOR "GlaDiuS"
new szMotd[100]
new SuperNum[] = "765611979"
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_clcmd("say /steam", "ShowPerfil"); register_clcmd("say /steam2", "ShowPerfil2"); }
public ShowPerfil(id) { new mysteam[36] = "STEAM_0:1:17619" // I tried it on LAN /*new mysteam[36] get_user_authid(id, mysteam, 35)*/ if(isSteamIdValid(mysteam)) { formatex(szMotd, 99, "http://steamcommunity.com/profiles/%s", getSteamId64(mysteam, 35)) client_print(0, print_chat, szMotd) set_task(2.0, "OpenPerfil", id) } else { client_print(0, print_chat, "STEAMCOMUNNITY: NO es una SteamId Correcta") } }
public ShowPerfil2(id) { new mysteam[18] = "76561197960300967" // I tried it on LAN if(isSteamId64Valid(mysteam)) { client_print(0, print_chat, "STEAMCOMUNNITY: STEAMID %s", getSteamId(mysteam, "0")) // "0" = gametype } else { client_print(0, print_chat, "STEAMCOMUNNITY: NO es una SteamId Correcta") } }
public OpenPerfil(id) { show_motd(id, szMotd, "Steam Perfil") }
isSteamIdValid(steam[]) { new num, error[128] new Regex:re = regex_match(steam, "STEAM_[0-1]:[0-1]:(\d+)", num, error, 127) if(re >= REGEX_OK) { return true } return false }
getSteamId64(steam[], size) { /* STEAM_X:Y:ZZZZZZZZ X, game you are playing (CS, DOD, L4D, TF2, etc) Y, Some people have a 0, some people have a 1 Z, is your own num. */ new authServer = 0, clientId = 0//, gameType = 0 replace_all(steam, size, "STEAM_", "") new Parts[3][18] str_explode(steam, ':', Parts, 3, 17) //gameType = str_to_num(Parts[0]) authServer = str_to_num(Parts[1]) clientId = str_to_num(Parts[2]) //Calculate SteamID64 new FriendId = 60265728 + authServer + (clientId * 2) new Result[18] formatex(Result, 35, "%s%i", SuperNum, FriendId) return Result }
isSteamId64Valid(steam64[]) { new sub_steam64[18] str_substr(steam64, 0, sub_steam64, 17, 9) if(equal(sub_steam64, SuperNum) && (strlen(steam64) == 17)) { return true } return false }
getSteamId(steam64[], gameType[]) { new sub_steam64[18], steam64_num str_substr(steam64, 9, sub_steam64, 17, 8) steam64_num = str_to_num(sub_steam64) //If the steamID64 is even, the authServer is 0 //If the steamID64 is odd, the authServer is 1 new authServer = 1 if(steam64_num % 2 == 0) { authServer = 0 } //Calculate clientId new clientid = ((steam64_num-60265728) - authServer) / 2 //Return steamId new Result[36] formatex(Result, 35, "STEAM_%s:%i:%i", gameType, authServer, clientid) return Result }
//By Exolent str_explode(const string[], delimiter, output[][], output_size, output_len) { new i, pos, len = strlen(string) do { pos += (copyc(output[i], output_len, string[pos], delimiter) + 1) } while(pos < len && ++i < output_size) return i }
//By Exolent str_substr(const string[], start, output[], output_len, len = 0) { if(len == 0 || len > output_len) { len = output_len } return copy(output, len, string[start]) }
PS1: No lo he optimizado, avisen cualquier cosa.
PS2: Cabe destacar que ese código estaba escrito en php y yo hice todos los cambios necesarios y además de agregar lo necesario para dejarlo en Pawn
(Amxx).
PS3: Sorry javivi te usé de ejemplo  ♥
__________________
Proyects
Kreedz Chile Mod [100%] (Fixing some details).
Last edited by gladius; 09-28-2011 at 11:53.
|
|