/fdeposit and /fwithdraw problem -
TV94 - 05.01.2012
Help me please, in my mod i have the next codes:
/fdeposit:
Код:
if(strcmp(cmd, "/fdeposit", true) == 0)
{
if(IsAMember(playerid))
{
if (PlayerToPoint(30.0, playerid,-2159.122802,641.517517,1052.381713) || PlayerToPoint(30.0, playerid,2324.419921,-1145.568359,1050.710083) || PlayerToPoint(30.0, playerid,1277.9442,-837.3730,1085.6328) || PlayerToPoint(30.0, playerid,1710.433715,-1669.379272,20.225049) || PlayerToPoint(30.0, playerid,942.171997,-16.542755,1000.929687) || PlayerToPoint(30.0, playerid,964.106994,-53.205497,1001.124572))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /fdeposit [amount]");
format(string, sizeof(string), " You Have $%d in your hq.", PlayerInfo[playerid][pAccf]);
SendClientMessage(playerid, COLOR_GRAD3, string);
return 1;
}
new cashdeposit = strval(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /fdeposit [amount]");
format(string, sizeof(string), " You Have $%d in your hq.", PlayerInfo[playerid][pAccf]);
SendClientMessage(playerid, COLOR_GRAD3, string);
return 1;
}
if (cashdeposit > GetPlayerMoney(playerid) || cashdeposit < 1)
{
SendClientMessage(playerid, COLOR_GRAD2, " You don't have that much.");
return 1;
}
GivePlayerMoney(playerid,-cashdeposit);
new curfunds = PlayerInfo[playerid][pAccf];
PlayerInfo[playerid][pAccf]=cashdeposit+PlayerInfo[playerid][pAccf];
SendClientMessage(playerid, COLOR_WHITE, "|___ SAFE BOX ___|");
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][pAccf]);
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
}
return 1;
}
and /fwithdraw:
Код:
if(strcmp(cmd, "/fwithdraw", true) == 0)
{
if(PlayerInfo[playerid][pLeader] == 5 || PlayerInfo[playerid][pLeader] == 6 || PlayerInfo[playerid][pLeader] == 12 || PlayerInfo[playerid][pLeader] == 13 || PlayerInfo[playerid][pLeader] == 15 || PlayerInfo[playerid][pLeader] == 16)
{
if (PlayerToPoint(30.0, playerid,-2159.122802,641.517517,1052.381713) || PlayerToPoint(30.0, playerid,2324.419921,-1145.568359,1050.710083) || PlayerToPoint(30.0, playerid,1277.9442,-837.3730,1085.6328) || PlayerToPoint(30.0, playerid,1710.433715,-1669.379272,20.225049) || PlayerToPoint(30.0, playerid,942.171997,-16.542755,1000.929687) || PlayerToPoint(30.0, playerid,964.106994,-53.205497,1001.124572))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /fwithdraw [amount]");
format(string, sizeof(string), " You Have $%d in your hq.", PlayerInfo[playerid][pAccf]);
SendClientMessage(playerid, COLOR_GRAD3, string);
return 1;
}
new cashdeposit = strval(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /fwithdraw [amount]");
format(string, sizeof(string), " You Have $%d in your hq.", PlayerInfo[playerid][pAccf]);
SendClientMessage(playerid, COLOR_GRAD3, string);
return 1;
}
if (cashdeposit > PlayerInfo[playerid][pAccf] || cashdeposit < 1)
{
SendClientMessage(playerid, COLOR_GRAD2, " You dont have that much !");
return 1;
}
//ConsumingMoney[playerid] = 1;
GivePlayerMoney(playerid,cashdeposit);
PlayerInfo[playerid][pAccf]=PlayerInfo[playerid][pAccf]-cashdeposit;
format(string, sizeof(string), " You Have Withdrawn $%d from your hq Total: $%d ", cashdeposit,PlayerInfo[playerid][pAccf]);
SendClientMessage(playerid, COLOR_YELLOW, string);
return 1;
}
}
return 1;
}
When player use /fdeposit the system put the amount of money in familybank but it doesn't take the money from player, and when player use /fwithdraw the system take the amount of money from familybank but it doesn't give the money to player. What's wrong with my code?
Re: /fdeposit and /fwithdraw problem -
TV94 - 05.01.2012
Someone can help me?