Making a bank system tut
#1

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
   COMMAND:registerbank(playerid, params[])
   {
    if( !fexist( BankPath(playerid) ) ) // this will check if you dont already have a bank file
    {
        if( !strlen( params ) ) return SendClientMessage(playerid, COLOR_RED, "Usage: /registerbank [pin]"); // if you didnt enter anything in the params, it shows this message
        if( strlen( params ) < 4 || strlen( params ) > 4 ) return SendClientMessage(playerid, COLOR_RED, "A pin has 4 numbers, please use numbers only! "); // if the params have under 4 characters or above 4 characters it shows the message
        if( !isnumeric( params ) ) return SendClientMessage(playerid, COLOR_RED, "Numbers only please! "); // when the player doesnt enter numbers, it shows him the message
        new Buffer[129], Message[128]; // create some variables which we will use to format a message, and where we will save the password in
        new INI:file = INI_Open( BankPath(playerid) ); // opening the file using the variable 'file'
        WP_Hash( Buffer, sizeof Buffer, params ); // hashing the params, so you got an encrypted pin code
        INI_WriteString( file, "Bank_Password", Buffer ); // saves the password inside the file
        INI_WriteInt( file, "Bank_Wealth", 0 ); // setting the bank health to 0 so you will have the line in it
        INI_WriteInt( file, "Bank_Logged", 1 ); // you are now logged in
        INI_Close( file ); // closing the file
        INI_ParseFile( BankPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid); // parsing all the things that are in the file in your variables
        format( Message, sizeof Message, "Thank you for registering %s! Your bank pin is: %s", GetName(playerid), params ); // formatting a message, you should know how this works
        SendClientMessage( playerid, COLOR_YELLOW, Message ); // sending the message.. duh :)
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED, "You already have a bank account and dont need to register. "); // if you already have a file, you get this message and stops the command
        return 0;
    }
    return 1;
   }
   return 0;
}
i have
a samp
zcmd
y ini included
https://sampforum.blast.hk/showthread.php?tid=284995
Everything waz looking good now time to put in commands
Код:
C:\Documents and Settings\Sa-mp\Desktop\Server\gamemodes\CnR.pwn(187) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Sa-mp\Desktop\Server\gamemodes\CnR.pwn(187) : error 017: undefined symbol "cmd_registerbank"
C:\Documents and Settings\Sa-mp\Desktop\Server\gamemodes\CnR.pwn(187) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Sa-mp\Desktop\Server\gamemodes\CnR.pwn(187) : fatal error 107: too many error messages on one line
Reply


Messages In This Thread
Making a bank system tut - by trapstar2020 - 18.08.2012, 04:13
Re: Making a bank system tut - by Avi57 - 18.08.2012, 04:17
Re: Making a bank system tut - by trapstar2020 - 18.08.2012, 04:26
Re: Making a bank system tut - by Avi57 - 18.08.2012, 04:28
Re: Making a bank system tut - by trapstar2020 - 18.08.2012, 04:34
Re: Making a bank system tut - by Avi57 - 18.08.2012, 04:44
Re: Making a bank system tut - by trapstar2020 - 18.08.2012, 04:48
Re: Making a bank system tut - by Avi57 - 18.08.2012, 04:50
Re: Making a bank system tut - by trapstar2020 - 18.08.2012, 04:51
Re: Making a bank system tut - by Avi57 - 18.08.2012, 04:53

Forum Jump:


Users browsing this thread: 1 Guest(s)