Raised This Month: $12 Target: $400
 3% 

encode base64


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nutu_
AlliedModders Donor
Join Date: Mar 2016
Location: Germany
Old 03-10-2020 , 05:56   encode base64
Reply With Quote #1

Code:
error 017: undefined symbol "base64_encode"
error 088: number of arguments does not match definition
I've got these errors

base64.inc
PHP Code:
#include <amxmodx>

static const Codes64[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/"

public Encode64(s[])
{
    new 
i=0,a=0,x=0,b=0,Result
    
for (i=1;i<strlen(s);i++) {
        
str_to_num(s[i])
        
256 x
        a 
8
        
while (>= 6) {
            
6
            x 
/ (<< a)
            
% (<< a)
            
Result += Codes64[1]
        }
    }
    if (
0) {
        
<< (a);
        
Result += Codes64[1];
    }
    return 
Result;
}

public 
Decode64(s[])
{
    new 
i=0,a=0,x=0,b=0,Result,ch[1]
    for (
1istrlen(s);i++) {
        for (new 
index 0Codes64[index]; index++)
            if (
s[i]==Codes64[index]) {
            
x=index-1
            
break
        }
        if (
>= 0) {
            
64 x
            a 
6
            
if (>= 8) {
                
8
                x 
>> a
                b 
% (<< a)
                
256
                Result 
+= num_to_word(x,ch,1)
            }
        }
        else exit;
    }
    return 
Result;

error line
PHP Code:
public get_graph_link(const szName[], szMotd[], iLen)
{
    static 
szName64[64];
    new 
iPos;
    
base64_encode(szNameszName64charsmax(szName64));
    
replace_all(szName64charsmax(szName64), "=""%%3D");
    
    
iPos += formatex(szMotd[iPos], iLen"<html><head></head><body bgcolor=^"#000000^"><div align=^"center^">");
    
iPos += formatex(szMotd[iPos], iLen"<strong><span style=^"color:#ffffff^">%s</span></strong><br /><br />", szName);
    
iPos += formatex(szMotd[iPos], iLen"<strong><span style=^"color:#ff0000;^">Day</span></strong><br />");
    
iPos += formatex(szMotd[iPos], iLen"<img src=^"http://www.gametracker.com/images/graphs/player_time.php?nameb64=%s&host=%s&start=-1d^" width=^"200^" height=^"150^"/><br /><br />",
    
szName64g_szIp);
    
iPos += formatex(szMotd[iPos], iLen"<strong><span style=^"color:#ff0000;^">Week</span></strong><br />");
    
iPos += formatex(szMotd[iPos], iLen"<img src=^"http://www.gametracker.com/images/graphs/player_time.php?nameb64=%s&host=%s&start=-1w^" width=^"200^" height=^"150^"/><br /><br />",
    
szName64g_szIp);
    
iPos += formatex(szMotd[iPos], iLen"<strong><span style=^"color:#ff0000;^">Month</span></strong><br />");
    
iPos += formatex(szMotd[iPos], iLen"<img src=^"http://www.gametracker.com/images/graphs/player_time.php?nameb64=%s&host=%s&start=-1m^" width=^"200^" height=^"150^"/><br /><br />",
    
szName64g_szIp);
    
iPos += formatex(szMotd[iPos], iLen"</div></body></html>");

PHP Code:
base64_encode(szNameszName64charsmax(szName64)); 
__________________
a simple act of caring creates an endless ripple.
Nutu_ is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 03-10-2020 , 06:01   Re: encode base64
Reply With Quote #2

You have a function called Encode64 and one called Decode64 but you call something named base64_encode. Any bells ringing?
__________________
HamletEagle is offline
Nutu_
AlliedModders Donor
Join Date: Mar 2016
Location: Germany
Old 03-10-2020 , 06:05   Re: encode base64
Reply With Quote #3

alright, thanks, i didnt even notice, i changed them and now i got this error
Code:
error 035: argument type mismatch (argument 1)
error 088: number of arguments does not match definition
same line, never edited something in .inc file before
__________________
a simple act of caring creates an endless ripple.
Nutu_ is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 03-10-2020 , 06:30   Re: encode base64
Reply With Quote #4

Well, you didn't show how you changed and what you changed.
__________________
HamletEagle is offline
Nutu_
AlliedModders Donor
Join Date: Mar 2016
Location: Germany
Old 03-10-2020 , 07:01   Re: encode base64
Reply With Quote #5

PHP Code:
#include <amxmodx>

static const Codes64[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/"

public base64_encode(s[])
{
    new 
i=0,a=0,x=0,b=0,Result
    
for (i=1;i<strlen(s);i++) {
        
str_to_num(s[i])
        
256 x
        a 
8
        
while (>= 6) {
            
6
            x 
/ (<< a)
            
% (<< a)
            
Result += Codes64[1]
        }
    }
    if (
0) {
        
<< (a);
        
Result += Codes64[1];
    }
    return 
Result;
}

public 
base64_decode(s[])
{
    new 
i=0,a=0,x=0,b=0,Result,ch[1]
    for (
1istrlen(s);i++) {
        for (new 
index 0Codes64[index]; index++)
            if (
s[i]==Codes64[index]) {
            
x=index-1
            
break
        }
        if (
>= 0) {
            
64 x
            a 
6
            
if (>= 8) {
                
8
                x 
>> a
                b 
% (<< a)
                
256
                Result 
+= num_to_word(x,ch,1)
            }
        }
        else exit;
    }
    return 
Result;

__________________
a simple act of caring creates an endless ripple.
Nutu_ is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 03-10-2020 , 15:55   Re: encode base64
Reply With Quote #6

So now you have a function called base64_encode that takes one argument and you call base64_encode(szName, szName64, charsmax(szName64)); (3 arguments). Read your code please.
__________________
HamletEagle is offline
Reply


Thread Tools
Display Modes

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:19.


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