23.09.2017, 11:47
Quote:
Under:
CMD:getbccash(playerid, params[]) new name[MAX_PLAYER_NAME]; You are missing this dear friend: GetPlayerName(playerid, name, 26); // MAX_PLAYER_NAME has 24 characters, not 26 though. Also just an advice, dont write this under your signature: Scripting Systems/Commands In Money$ If you have no freaking clue how to fix your own code. |
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(playerid, params[])
{
if (playeritems[playerid][ITEM_TYPE_Breifcase] == 0) return SendClientMessage2(playerid, COLOR_RED, "You don't have a breifcase buy it from nearest store!");
new cash;
if(sscanf(params, "d", cash)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /savecash [Amount]");
new pcash = GetPlayerMoney(playerid);
if(pcash < cash) return SendClientMessage(playerid, COLOR_RED, "Error: You don't have that amount!");
new name[26];
GetPlayerName(playerid, name, 26);
dini_IntSet(AddDirFile(dir_userfiles, name), "Briefcasecash", cash);
GivePlayerMoney(playerid, -cash);
new string[256];
format(string, sizeof(string), "You have deposited %d from your briefcase. You have now %d", cash, dini_Int(AddDirFile(dir_userfiles, name), "Briefcasecash"));
SendClientMessage(playerid, COLOR_YELLOW, string);
return 1;
}
CMD:getbccash(playerid, params[])
{
if (playeritems[playerid][ITEM_TYPE_Breifcase] == 0) return SendClientMessage2(playerid, COLOR_RED, "You don't have a breifcase buy it from nearest store!");
new cash;
new name[26];
GetPlayerName(playerid, name, 26);
if(sscanf(params, "d", cash)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /getbccash [Amount]");
if(dini_Int(AddDirFile(dir_userfiles, name), "Briefcasecash") < cash) return SendClientMessage(playerid, COLOR_RED, "Error: You don't have that amount!");
dini_IntSet(AddDirFile(dir_userfiles, name), "Briefcasecash", dini_Int(AddDirFile(dir_userfiles, name), "Briefcasecash") - cash);
GivePlayerMoney(playerid, cash);
new string[256];
format(string, sizeof(string), "You have Withdrawn %d from your briefcase. You have now %d", cash, dini_Int(AddDirFile(dir_userfiles, name), "Briefcasecash"));
SendClientMessage(playerid, COLOR_YELLOW, string);
return 1;
}