Simple help
#8

Quote:
Originally Posted by GoldenMan
Посмотреть сообщение
by the way i want to fix /savecash to
its saving the cash after doing /savecash but when i type and save another amount its not adding in old one its
cutting my all money and setting it to taht much in last u saved so pls help me and i want to make this cod ewith

MAX_CASH 20000
so please help me in this ok

PHP код:
CMD:savecash(playeridparams[])
{
    if (
playeritems[playerid][ITEM_TYPE_Breifcase] == 0) return SendClientMessage2(playeridCOLOR_RED"You don't have a breifcase buy it from nearest store!");
    new 
cash;
    if(
sscanf(params"d"cash)) return SendClientMessage(playeridCOLOR_WHITE"Usage: /savecash [Amount]");
    new 
pcash GetPlayerMoney(playerid);
    if(
pcash cash) return SendClientMessage(playeridCOLOR_RED"Error: You don't have that amount!");
    new 
name[26];
    
GetPlayerName(playeridname26);
    
dini_IntSet(AddDirFile(dir_userfilesname), "Briefcasecash"cash);
    
GivePlayerMoney(playerid, -cash);
    new 
string[256];
    
format(stringsizeof(string), "You have deposited %d from your briefcase. You have now %d"cashdini_Int(AddDirFile(dir_userfilesname), "Briefcasecash"));
    
SendClientMessage(playeridCOLOR_YELLOWstring);
    return 
1;
}
CMD:getbccash(playeridparams[])
{
    if (
playeritems[playerid][ITEM_TYPE_Breifcase] == 0) return SendClientMessage2(playeridCOLOR_RED"You don't have a breifcase buy it from nearest store!");
    new 
cash;
    new 
name[26];
    
GetPlayerName(playeridname26);
    if(
sscanf(params"d"cash)) return SendClientMessage(playeridCOLOR_WHITE"Usage: /getbccash [Amount]");
    if(
dini_Int(AddDirFile(dir_userfilesname), "Briefcasecash") < cash) return SendClientMessage(playeridCOLOR_RED"Error: You don't have that amount!");
    
dini_IntSet(AddDirFile(dir_userfilesname), "Briefcasecash"dini_Int(AddDirFile(dir_userfilesname), "Briefcasecash") - cash);
    
GivePlayerMoney(playeridcash);
    new 
string[256];
    
format(stringsizeof(string), "You have Withdrawn %d from your briefcase. You have now %d"cashdini_Int(AddDirFile(dir_userfilesname), "Briefcasecash"));
    
SendClientMessage(playeridCOLOR_YELLOWstring);
    return 
1;

you should load the existing data ,add it up with data you providing and save
stop using file based system start using SQL for data transaction
Reply


Messages In This Thread
Simple help - by GoldenMan - 23.09.2017, 06:19
Re: Simple help - by GoldenMan - 23.09.2017, 07:44
Re: Simple help - by AzaMx - 23.09.2017, 08:06
Re: Simple help - by GoldenMan - 23.09.2017, 08:22
Re: Simple help - by GoldenMan - 23.09.2017, 10:06
Re: Simple help - by whadez - 23.09.2017, 10:20
Re: Simple help - by GoldenMan - 23.09.2017, 11:47
Re: Simple help - by SyS - 23.09.2017, 14:57
Re: Simple help - by GoldenMan - 23.09.2017, 19:57

Forum Jump:


Users browsing this thread: 1 Guest(s)