SA-MP Forums Archive
problem with ini file - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: problem with ini file (/showthread.php?tid=601050)



problem with ini file - ratxrat - 16.02.2016

i create for bank system , this my code
PHP код:
CMD:ceksaldo(playeridparams[]) //check balance bank
{
    new 
result[128];
    
//number = PlayerData[playerid][pbank];
    
format(result,sizeof(result), "Saldo Bank Kamu $%i.",PlayerData[playerid][pbank]);
    
SendClientMessage(playeridwhijauresult);
    return 
1;
}
CMD:nabung(playeridparams[]) //deposit
{
    new  
jumlah;
    if(
sscanf(params"i"jumlah)) return SendClientMessage(playeridwungu"> USAGE: /nabung [jumlah]");
    if (
jumlah <= PlayerInfo[playerid][pMoney] )
    {
           
PlayerInfo[playerid][pMoney]-=jumlah;
        
PlayerData[playerid][pbank]+=jumlah;
    }
    else
    
SendClientMessage(playeridCOLOR_RED,"Uang tidak cukup!");
    return 
1;
}
CMD:ambil(playeridparams[]) //withdraw
{
    new  
jumlah;
    if(
sscanf(params"i"jumlah)) return SendClientMessage(playeridwungu"> USAGE: /ambil [jumlah]");
    if (
jumlah <= PlayerData[playerid][pbank] )
    {
        
PlayerInfo[playerid][pMoney]+=jumlah;
        
PlayerData[playerid][pbank]-=jumlah;
    }
    else
    
SendClientMessage(playeridCOLOR_RED,"Uang di bank tidak cukup!");
    
    
    return 
1;

when i check /ceksaldo for balance bank show
Quote:

Saldo Bank Kamu $0

but at ini file
Quote:

bank = 800

for desposit and withdraw same problem cannot take value from ini file


Re: problem with ini file - Amunra - 16.02.2016

Are u Use Y_INI Or Dini ?


Re: problem with ini file - ratxrat - 16.02.2016

im use y_ini


Re: problem with ini file - Amunra - 16.02.2016

PHP код:
CMD:ceksaldo(playeridparams[]) //check balance bank
{
    new 
result[128];
    
//number = PlayerData[playerid][pbank];
    
new INI:File INI_Open(//FileSave(playerid));
    
INI_Int("Uang"/*Change with your Variable Save*/,PlayerData[playerid][pbank]);
    
INI_Close(//FileSave);
    
format(result,sizeof(result), "Saldo Bank Kamu $%i.",PlayerData[playerid][pbank]);
    
SendClientMessage(playeridwhijauresult);
    return 
1;
}
stock FileSave(playerid)
{
    new 
string[128],playername[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,playername,sizeof(playername));
    
format(string,sizeof(string),"Bank/%s",playername);
    
/*Change Bank/%s to Your FILE Name*/
    
return string;

Test that !


Re: problem with ini file - ratxrat - 16.02.2016

i will try dude