Komanda /deposit

9. Sep. 2020.
363
pregleda
2
postova
Enis666
4
Shot Caller
9. Sep. 2020.
Problem(error/warning): Ima bug kada neko oce ostavit 20k pise da nema dovoljno novca na racunu i onda moze samo po 4k ostavljat u banku, al i kad npr ima 8k u dzepu i tih 8k ostavi u banku i ako slucajno jos jednom ide /deposit 4000 ide u minus dal moze neko rec do cega je? i kako da fixam da moze ostavljat tipa max 100000$ i da izbacuje error kad nema dovoljno para na racunu ono ako kontate
Deo skripte:
CMD:deposit( playerid, params[] )
{
    new cashdeposit, curfunds = PI[ playerid ][ pAccount ], string[ 64 ];
    if(!IsPlayerInRangeOfPoint(playerid, 1.5, 1277.8170,-829.1866,1085.6328)) return Error(playerid, "Niste na salteru u banci.");
if( sscanf( params, "i", cashdeposit ))
{
Cmd( playerid, "/deposit [ iznos ]");
format( string, sizeof( string ), "BANKA: Imate %d$ na vasem bankovnom racunu.", PI[ playerid ][ pAccount ] );
SCM( playerid, SIVA, string );
return 1;
}
if( cashdeposit > PI[ playerid ][ pCash ] || cashdeposit < 1 ) return Error( playerid, "Nemate toliko novaca");
lz_GivePlayerMoney( playerid, -cashdeposit );
PI[ playerid ][ pAccount ] += cashdeposit;
SCM(playerid, 0x9EC73DAA, "==============BANKOVNI RACUN==============");
format( string, sizeof( string ), "Stari iznos: $%d", curfunds);
SCM( playerid, 0x9EC73DAA, string );
format( string, sizeof( string ), "Novac koji si ostavio: $%d",cashdeposit);
SCM( playerid, 0x9EC73DAA, string );
format( string, sizeof( string ), "Novi iznos: $%d", PI[ playerid ][ pAccount ] );
SCM( playerid, 0x9EC73DAA, string );
SCM( playerid, 0x9EC73DAA, "============================================");
SaveAccount( playerid );
return 1;
}

Debug iz server_log(ukoliko je u pitanju crashanje servera - crashdetect log):
Vaš odgovor
Wolf Corleone
2
Wheel Man
9. Sep. 2020.
CMD:deposit( playerid, params[] )
{
    new cashdeposit, curfunds = PI[ playerid ][ pAccount ], string[ 64 ];
    if(!IsPlayerInRangeOfPoint(playerid, 1.5, 1277.8170,-829.1866,1085.6328)) return Error(playerid, "Niste na salteru u banci.");
if( sscanf( params, "i", cashdeposit ))
{
Cmd( playerid, "/deposit [ iznos ]");
format( string, sizeof( string ), "BANKA: Imate %d$ na vasem bankovnom racunu.", PI[ playerid ][ pAccount ] );
SCM( playerid, SIVA, string );
return 1;
}
if( cashdeposit < curfunds && cashdeposit < 100000 )
        {
lz_GivePlayerMoney( playerid, -cashdeposit );
PI[ playerid ][ pAccount ] += cashdeposit;
SCM(playerid, 0x9EC73DAA, "==============BANKOVNI RACUN==============");
format( string, sizeof( string ), "Stari iznos: $%d", curfunds);
SCM( playerid, 0x9EC73DAA, string );
format( string, sizeof( string ), "Novac koji si ostavio: $%d",cashdeposit);
SCM( playerid, 0x9EC73DAA, string );
format( string, sizeof( string ), "Novi iznos: $%d", PI[ playerid ][ pAccount ] );
SCM( playerid, 0x9EC73DAA, string );
SCM( playerid, 0x9EC73DAA, "============================================");
SaveAccount( playerid );
    }
    else if (cashdeposit > 100000)
    {
    SCM(playerid, 0xFF0000FF, "Iznos mora biti manji od 100k$");
    }
    else
    {
    SCM(playerid, 0xFF0000FF, "Nemate toliko novaca");
    }
return 1;
}


Ne znam valja li nisam dugo nista skripto  😄
Najvjv nevalja al eto    😮

Morate biti prijavljeni da biste odgovorili na ovu temu.

Prijava

© 2026 SmartShark. All rights reserved.

Powered by Momentum|v2026.3.001 Alpha