Raised This Month: $ Target: $400
 0% 

SteamID Converter


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
gladius
Veteran Member
Join Date: Jul 2008
Location: Santiago, Chile
Old 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(PLUGINVERSIONAUTHOR)
    
    
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(szMotd99"http://steamcommunity.com/profiles/%s"getSteamId64(mysteam35))
        
client_print(0print_chatszMotd)
        
set_task(2.0"OpenPerfil"id)
    }
    else
    {
        
client_print(0print_chat"STEAMCOMUNNITY: NO es una SteamId Correcta"
    }
    
}

public 
ShowPerfil2(id)
{
    new 
mysteam[18] = "76561197960300967" // I tried it on LAN
    
    
if(isSteamId64Valid(mysteam))
    {
        
client_print(0print_chat"STEAMCOMUNNITY: STEAMID %s"getSteamId(mysteam"0")) // "0" = gametype
    
}
    else
    {
        
client_print(0print_chat"STEAMCOMUNNITY: NO es una SteamId Correcta"
    }
    
}

public 
OpenPerfil(id)
{
    
show_motd(idszMotd"Steam Perfil")
}

isSteamIdValid(steam[]) 
{
    new 
numerror[128]
    new 
Regex:re regex_match(steam"STEAM_[0-1]:[0-1]:(\d+)"numerror127)
    
    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 0clientId 0//, gameType = 0
    
    
replace_all(steamsize"STEAM_""")
    
    new 
Parts[3][18]
    
str_explode(steam':'Parts317)
    
    
//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(Result35"%s%i"SuperNumFriendId)
    return 
Result
}

isSteamId64Valid(steam64[]) 
{
    new 
sub_steam64[18]
    
str_substr(steam640sub_steam64179)
    
    if(
equal(sub_steam64SuperNum) && (strlen(steam64) == 17))
    {
        return 
true
    
}
    return 
false
}

getSteamId(steam64[], gameType[]) 
{
    new 
sub_steam64[18], steam64_num
    str_substr
(steam649sub_steam64178)
    
    
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 == 0)
    {
        
authServer 0
    
}
    
    
//Calculate clientId
    
new clientid = ((steam64_num-60265728) - authServer) / 2
    
    
//Return steamId
    
new Result[36]
    
formatex(Result35"STEAM_%s:%i:%i"gameTypeauthServerclientid)
    
    return 
Result
}

//By Exolent
str_explode(const string[], delimiteroutput[][], output_sizeoutput_len
{
    new 
iposlen strlen(string)
    
    do {
        
pos += (copyc(output[i], output_lenstring[pos], delimiter) + 1)
    }
    while(
pos len && ++output_size)
        
    return 
i
}  

//By Exolent
str_substr(const string[], startoutput[], output_lenlen 0
{
    if(
len == || len output_len)
    {
        
len output_len
    
}
    
    return 
copy(outputlenstring[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.
gladius is offline
Send a message via MSN to gladius Send a message via Skype™ to gladius
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:58.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode