[HELP] Withdraw and Deposit commands -
Camacorn - 09.11.2010
Hello, me and a friend are re-scripting our biz systems, but these 2 commands are giving us problems, they return Syntax, but it doesnt actually deposit or withdraw anything, thanks in advance for your help
Command: /bswithdraw [businessid] [price]
Код:
command(bswithdraw, playerid, params[]) // Hal Olpae Keep The Credits
{
new Amount, string[ 128 ], id;
if( sscanf( params, "dd", id, Amount) )
{
SendClientMessage( playerid, WHITE, "SYNTAX: /bswithdraw [id] [amount]" );
if ( !strcmp ( Businesses[ id ][ bOwner ], GetName ( playerid ) ) )
{
if(Businesses[ id ][bVault] != -1)
{
format( string, sizeof( string ), "There is currently $%d in your business vault.", Businesses[ id ][bVault]);
SendClientMessage( playerid, GREY, string);
}
}
else
{
SendClientMessage(playerid, WHITE, "That Isn't Your Business!");
}
}
else
{
if( Player[playerid][InBusiness] == 0 )
{
if ( !strcmp ( Businesses[ Player[playerid][InBusiness] ][ bOwner ], GetName ( playerid ) ) )
{
if(Amount < 1)
{
SendClientMessage( playerid, WHITE, "Invalid amount." );
}
else
{
if(Businesses[id][bVault] >= Amount)
{
if (Player[playerid][InBusiness] == id)
{
Player[playerid][Money] += Amount;
Businesses[ id ][bVault] -= Amount;
format( string, sizeof( string ), "You have withdrawn $%d from your business vault.", Amount);
SendClientMessage( playerid, WHITE, string);
}
else
{
SendClientMessage( playerid, WHITE, "You're not at your business." );
}
}
else
{
SendClientMessage( playerid, WHITE, "You don't have enough cash to complete this transaction." );
}
}
}
else
{
SendClientMessage(playerid, WHITE, "This Isn't Your Business!");
}
}
else
{
SendClientMessage(playerid, WHITE, "You Aren't In Any Business!");
}
}
return 1;
}
Command: /bsdeposit [businessid] [price]
Код:
command(bsdeposit, playerid, params[]) // Hal Olpae Keep The Credits
{
new Amount, string[ 128 ], id;
if( sscanf( params, "dd", id, Amount) )
{
SendClientMessage( playerid, WHITE, "SYNTAX: /bsdeposit [id] [amount]" );
if ( !strcmp ( Businesses[ id ][ bOwner ], GetName ( playerid ) ) )
{
if(Businesses[ id ][bVault] != -1)
{
format( string, sizeof( string ), "There is currently $%d in your business vault.", Businesses[id][bVault]);
SendClientMessage( playerid, GREY, string);
}
}
else
{
SendClientMessage(playerid, WHITE, "That Isn't Your Business!");
}
}
else
{
if( Player[playerid][InBusiness] == 0 )
{
if ( !strcmp ( Businesses[ id ][ bOwner ], GetName ( playerid ) ) )
{
if(Amount < 1)
{
SendClientMessage( playerid, WHITE, "Invalid amount." );
}
else
{
if( Player[playerid][Money] >= Amount)
{
if( Player[playerid][InBusiness] == id )
{
Player[playerid][Money] -= Amount;
Businesses[ id ][bVault] += Amount;
format( string, sizeof( string ), "You have deposited $%d in to your business vault.", Amount);
SendClientMessage( playerid, WHITE, string);
}
else
{
SendClientMessage( playerid, WHITE, "You're not at your business." );
}
}
else
{
SendClientMessage( playerid, WHITE, "You don't have enough cash to complete this transaction." );
}
}
}
else
{
SendClientMessage(playerid, WHITE, "This Isn't Your Business!");
}
}
}
return 1;
}
Re: [HELP] Withdraw and Deposit commands -
Hal - 09.11.2010
Yes it returns "You have deposited 53 Dollars" for any amount i put in. ( i am the one who converted this and we are still having issues) I think it may be the Amount Variable. Ill check it out
EDIT: re-wrote the cmd, fixed it. MSN me Camacorn.
Re: [HELP] Withdraw and Deposit commands -
(SF)Noobanatior - 09.11.2010
change this bit in each to
pawn Код:
Player[playerid][Money] -= Amount;
Businesses[ id ][bVault] += Amount;
format( string, sizeof( string ), "You have deposited $%d in to your business vault.", Amount);
SendClientMessage( playerid, WHITE, string);
GivePlayerMoney(playerid,Player[playerid][Money]);//<---add this to each