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
#2

show me line 187 !
Reply
#3

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

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

make it as a fs please ty
Reply
#6

Here u go : Bank.pwn
Reply
#7

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

what ?
Reply
#9

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

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 !
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)