[HELP] .::::: Needed Some Help
#1

I have Downloaded KEVIN"S REGISTER + LOGIN + BANK + SYSTEM

I edited it and removed the register and bank sytem as i only want bank system which saves player money when they deposit it

__but i meessed up the script create the file of player name but wont changes the values . like it stay on 0 only
__________________________________________________ ___________

//i got the following output..

pawn Код:
#include <a_samp>

#include <utils>

#define FILTERSCRIPT

#if defined FILTERSCRIPT
#define COLOR_GREY 0xBEBEBEAA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_GRAD5 0xE3E3E3FF
#define COLOR_GRAD1 0xB4B5B7FF
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_GRAD4 0xD8D8D8FF
#define COLOR_GRAD6 0xF0F0F0FF
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_GRAD3 0xCBCCCEFF

forward ShowStats(playerid,targetid);
forward OnPlayerUpdate(playerid);


enum pInfo
{
    pBank,
};

new PlayerInfo[MAX_PLAYERS][pInfo];
new gPlayerLogged[MAX_PLAYERS];
new gPlayerAccount[MAX_PLAYERS];
new ConsumingMoney[MAX_PLAYERS];



public OnFilterScriptInit()
{
    print("\n$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$");
    print(" Kevin433's Login/Register Filterscript");
    print("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n");
    SetTimer("CustomPickups", 1000, 1);
    return 1;
}




public OnPlayerConnect(playerid)
{
    new playrname[MAX_PLAYER_NAME];
    new connect[128];
    GetPlayerName(playerid, playrname, sizeof(playrname));
    format(connect, sizeof(connect), "%s.cer", playrname);
    if(fexist(connect))
    {
        gPlayerAccount[playerid] = 1;
        return 1;
    }
    else
    {
        gPlayerAccount[playerid] = 0;
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    OnPlayerUpdate(playerid);
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[256];
    new idx;
    cmd = strtok(cmdtext, idx);
    new tmp[256];
    //new playername[MAX_PLAYER_NAME];
    new string[256];

   
   

//=================[Bank System]================================================================
    if(strcmp(cmd, "/bank", true) == 0 || strcmp(cmd, "/deposit", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {

            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /bank [amount]");
                format(string, sizeof(string), "  You Have $%d in your account.", PlayerInfo[playerid][pBank]);
                SendClientMessage(playerid, COLOR_GRAD3, string);
                return 1;
            }
            new cashdeposit = strval(tmp);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /bank [amount]");
                format(string, sizeof(string), "  You Have $%d in your account.", PlayerInfo[playerid][pBank]);
                SendClientMessage(playerid, COLOR_GRAD3, string);
                return 1;
            }
            if (cashdeposit > GetPlayerMoney(playerid) || cashdeposit < 1)
            {
                SendClientMessage(playerid, COLOR_GRAD2, "   You dont have that much");
                return 1;
            }
            GivePlayerMoney(playerid,-cashdeposit);
            new curfunds = PlayerInfo[playerid][pBank];
            PlayerInfo[playerid][pBank]=cashdeposit+PlayerInfo[playerid][pBank];
            SendClientMessage(playerid, COLOR_WHITE, "|___ BANK STATMENT ___|");
            format(string, sizeof(string), "  Old Balance: $%d", curfunds);
            SendClientMessage(playerid, COLOR_GRAD2, string);
            format(string, sizeof(string), "  Deposit: $%d",cashdeposit);
            SendClientMessage(playerid, COLOR_GRAD4, string);
            SendClientMessage(playerid, COLOR_GRAD6, "|-----------------------------------------|");
            format(string, sizeof(string), "  New Balance: $%d", PlayerInfo[playerid][pBank]);
            SendClientMessage(playerid, COLOR_WHITE, string);
            return 1;
        }
        return 1;
    }
    if(strcmp(cmd, "/withdraw", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {

            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /withdraw [amount]");
                format(string, sizeof(string), "  You Have $%d in your account.", PlayerInfo[playerid][pBank]);
                SendClientMessage(playerid, COLOR_GRAD3, string);
                return 1;
            }
            new cashdeposit = strval(tmp);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /withdraw [amount]");
                format(string, sizeof(string), "  You Have $%d in your account.", PlayerInfo[playerid][pBank]);
                SendClientMessage(playerid, COLOR_GRAD3, string);
                return 1;
            }
            if (cashdeposit > PlayerInfo[playerid][pBank] || cashdeposit < 1)
            {
                SendClientMessage(playerid, COLOR_GRAD2, "   You dont have that much !");
                return 1;
            }
            ConsumingMoney[playerid] = 1;
            GivePlayerMoney(playerid,cashdeposit);
            PlayerInfo[playerid][pBank]=PlayerInfo[playerid][pBank]-cashdeposit;
            format(string, sizeof(string), "  You Have Withdrawn $%d from your account Total: $%d ", cashdeposit,PlayerInfo[playerid][pBank]);
            SendClientMessage(playerid, COLOR_YELLOW, string);
            return 1;
        }
        return 1;
    }
    if(strcmp(cmd, "/balance", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            format(string, sizeof(string), "  You Have $%d in your account.",PlayerInfo[playerid][pBank]);
            SendClientMessage(playerid, COLOR_YELLOW, string);
        }
        return 1;
    }
    return 0;
}



public OnPlayerUpdate(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(gPlayerLogged[playerid])
        {
            new string3[32];
            new pname3[MAX_PLAYER_NAME];
            GetPlayerName(playerid, pname3, sizeof(pname3));
            format(string3, sizeof(string3), "%s.cer", pname3);
            new File: pFile = fopen(string3, io_write);
            if (pFile)
            {
                new var[32];
                new File: hFile = fopen(string3, io_append);
                format(var, 32, "Bank=%d\n",PlayerInfo[playerid][pBank]);fwrite(hFile, var);
                fclose(hFile);
            }
        }
    }
    return 1;
}

stock ini_GetKey( line[] )
{
    new keyRes[128];
    keyRes[0] = 0;
    if ( strfind( line , "=" , true ) == -1 ) return keyRes;
    strmid( keyRes , line , 0 , strfind( line , "=" , true ) , sizeof( keyRes) );
    return keyRes;
}

stock ini_GetValue( line[] )
{
    new valRes[128];
    valRes[0]=0;
    if ( strfind( line , "=" , true ) == -1 ) return valRes;
    strmid( valRes , line , strfind( line , "=" , true )+1 , strlen( line ) , sizeof( valRes ) );
    return valRes;
}


strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}

public ShowStats(playerid,targetid)
{
    if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))
    {
        new name[MAX_PLAYER_NAME];
        GetPlayerName(targetid, name, sizeof(name));
        new Float:px,Float:py,Float:pz;
        GetPlayerPos(targetid, px, py, pz);
        new coordsstring[256];
        new bank = PlayerInfo[targetid][pBank];
        SendClientMessage(playerid, COLOR_GREEN,"________________________________________________");
        format(coordsstring, sizeof(coordsstring),"*** %s ***",name);
        SendClientMessage(playerid, COLOR_WHITE,coordsstring);
        format(coordsstring, sizeof(coordsstring), "Bank:[$%d]",bank);
        SendClientMessage(playerid, COLOR_GRAD5,coordsstring);
        SendClientMessage(playerid, COLOR_GREEN,"________________________________________________");
    }
}





public OnPlayerRequestSpawn(playerid)
{
    if(IsPlayerConnected(playerid))
    {
            new string3[32];
            new playername3[MAX_PLAYER_NAME];
            GetPlayerName(playerid, playername3, sizeof(playername3));
            format(string3, sizeof(string3), "%s.ini", playername3);
            new File: hFile = fopen(string3, io_write);
            if (hFile)
            {
                new var[32];
                format(var, 32, "Bank=%d\n",PlayerInfo[playerid][pBank]);fwrite(hFile, var);
                fclose(hFile);

            }
    }
    return 1;
}

public OnPlayerSpawn(playerid)
{
   
    new string2[64];
    new playername2[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername2, sizeof(playername2));
    format(string2, sizeof(string2), "%s.cer", playername2);
    new File: UserFile = fopen(string2, io_read);
    if ( UserFile )
    {

       
        {
                new key[ 256 ] , val[ 256 ];
                new Data[ 256 ];
                while ( fread( UserFile , Data , sizeof( Data ) ) )
                {
                key = ini_GetKey( Data );
                if( strcmp( key , "Bank" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pBank] = strval( val ); }
                }//end while
                fclose(UserFile);//close the file after everything has been read in the while
        }

        ConsumingMoney[playerid] = 1;

    }
    return 1;
}


#endif
Reply
#2

Just download a bank script that is by itself, theres hundreds out there, just search.
Reply
#3

i have searched a lot but no one is like this...
it is good..
if u wanna help me tell me my mistake

__________

also if u can .. then tell me a good script
Reply
#4

Tell mE someone please i request you all
Reply
#5

maybe u removed the save function or something and as mrcoolballs said there are hundreds of bank systems out there try this one : https://sampforum.blast.hk/showthread.php?tid=149300
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)