Help with includes
#1

hi , i have big problem with the includes ,
so i have Register/login using Y_Ini , can i make commandes using Zcmd+ini ? for an example make a /changepass command , witch include need i ? thank you .
Reply
#2

Yes, you can.
pawn Код:
CMD:changepass( playerid, params[ ] )
{
    new
        Name[ MAX_PLAYER_NAME ];

    if( isnull( params ) ) return SendClientMessage( playerid, -1, "Usage: /changepass <New Password>" );
    GetPlayerName( playerid, Name, MAX_PLAYER_NAME );
    format( Path, sizeof( Path ),/* Your File Location Path Here! */ "Users\%s.ini", Name );

    new INI:File = INI_Open( Path );
    INI_SetTag( File, "data" /* Change it to the tag's name you are using */);
    INI_WriteString( File, "Password", params ); // If you are using for hashed_password like Whirlpool then change params to the variable you will make "new buf[ 129 ];" etc..
    INI_Close( File );
    return 1;
}
Reply
#3

Thank you a lot ! so with Y_ini +zcmd i can create every commande like : /givemoney /ban /slap /givegun..
Reply
#4

Not tested:

pawn Код:
CMD:changepassword(playerid, params[])
{
    if(sscanf(params, "s[128]", new_password))
        return 0; //You can also return a usage message here.
       
    new
        INI:File = INI_Open(YOUR_ACCOUNT_DIRECTORY);

    INI_SetTag(File,"data");
    INI_WriteInt(File,"Password", udb_hash(new_password));
    INI_Close(File);
    return true;
}
Beat to it. And yes, you can create anything your mind imagines with ZCMD & sscanf.. Well, not everything.
Reply
#5

It doesn't need for the rest, because OnPlayerDisconnect Callback it saves the Data
For example it GetPlayerMoney( playerid ); and it saves the money to the file.
Although about the /ban command it depends on what code do you have.
Reply
#6

oh i see thank you all
Reply
#7

Quote:
Originally Posted by 2KY
Посмотреть сообщение
Not tested:

pawn Код:
CMD:changepassword(playerid, params[])
{
    if(sscanf(params, "s[128]", new_password))
        return 0; //You can also return a usage message here.
       
    new
        INI:File = INI_Open(YOUR_ACCOUNT_DIRECTORY);

    INI_SetTag(File,"data");
    INI_WriteInt(File,"Password", udb_hash(new_password));
    INI_Close(File);
    return true;
}
Beat to it. And yes, you can create anything your mind imagines with ZCMD & sscanf.. Well, not everything.
Not working...
the Errors :
Код:
C:\DOCUME~1\ADMINI~1\Bureau\ALAE\LATDM\GAMEMO~1\LATDM.pwn(179) : warning 217: loose indentation
C:\DOCUME~1\ADMINI~1\Bureau\ALAE\LATDM\GAMEMO~1\LATDM.pwn(199) : error 029: invalid expression, assumed zero
C:\DOCUME~1\ADMINI~1\Bureau\ALAE\LATDM\GAMEMO~1\LATDM.pwn(199) : error 017: undefined symbol "cmd_changepassword"
C:\DOCUME~1\ADMINI~1\Bureau\ALAE\LATDM\GAMEMO~1\LATDM.pwn(199) : error 029: invalid expression, assumed zero
C:\DOCUME~1\ADMINI~1\Bureau\ALAE\LATDM\GAMEMO~1\LATDM.pwn(199) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
NB: i have defined the zcmd include .

this is my Public :
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
CMD:changepassword(playerid, params[])
{
    if(sscanf(params, "s[128]", new_password))
        return 0; //You can also return a usage message here.

    new
        INI:File = INI_Open(YOUR_ACCOUNT_DIRECTORY);

    INI_SetTag(File,"data");
    INI_WriteInt(File,"Password", udb_hash(new_password));
    INI_Close(File);
    return true;
}

    return 1;
}
Thank u for helping.
Reply
#8

You cannot use ZCMD into a callback, like OnPlayerCommandText. If you have the ZCMD then:
pawn Код:
#include < a_samp >
#include < zcmd >
// At The Top

public OnPlayerCommandText( playerid, cmdtext[ ] )
{
    return 0;
}
// Somewhere in your script "Note: Not inside any Callback!"

CMD:changepass( playerid, params[ ] )
{
    // Code Here!
    return 1;
}
// Rest
Reply
#9

oh yea you've right ! thank you , and about the login/register systeme the bad include to use is Y_ini it sometimes works and sometimes not , so i'm looking for an other register/login system WITHOUT using Y_ini....
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)