SA-MP Forums Archive
Making a bank system tut - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: Making a bank system tut (/showthread.php?tid=369784)



Making a bank system tut - trapstar2020 - 18.08.2012

Код:
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



Re: Making a bank system tut - Avi57 - 18.08.2012

show me line 187 !


Re: Making a bank system tut - trapstar2020 - 18.08.2012

Код:
COMMAND:registerbank(playerid, params[])



Re: Making a bank system tut - Avi57 - 18.08.2012

should i make whole script for you ?
Just put it as FS ok ?


Re: Making a bank system tut - trapstar2020 - 18.08.2012

make it as a fs please ty


Re: Making a bank system tut - Avi57 - 18.08.2012

Here u go : Bank.pwn


Re: Making a bank system tut - trapstar2020 - 18.08.2012

pass a couple of repts around n u will not be forgotten


Re: Making a bank system tut - Avi57 - 18.08.2012

what ?


Re: Making a bank system tut - trapstar2020 - 18.08.2012

i cant rep u again until i pass a couple around u been a life saver for me tonight


Re: Making a bank system tut - Avi57 - 18.08.2012

Ohk
No problem and i Like Helping Guys
Hope i will Help you More and next time if you have small errors or warnings, dont post here just Pm me !

Cheers !