Cmds not working
#1

Код:
CMD:deposit(playerid, params[])
{
    new string[256];//the variable which will store the information of a string that we will format after wards.
    new type;//this variable will store player's input.
 	{
  	if(sscanf(params, "d", type)) return SendClientMessage(playerid, -1, "[USAGE]: /deposit [amount]");//this will check that if he inserted the write format or not,if it is and incorrect format,it will break the codes there and end the process with an error message.
    if(type == 0)//this will check that if the type = 0.
	if(GetPlayerMoney(playerid)< type)//this will check that if he is inserting a higher amount of money then he has in hand.
    {
    GivePlayerMoney(playerid,-type);//this minus his money from his hand.
    PlayerInfo[playerid][pBankAccount] += type;//this will store the minused money in player's file,and will add money to his account.
    format(string, sizeof(string), "INFO: You have successfully deposited $%d to your bank account.", type);//this is the format of the following message of how much money you deposited into your account.
    SendClientMessage(playerid, 0xFFFFFF, string);//this will send the message which we formated above,the information was stored in the variable string.
    }
    else SendClientMessage(playerid, 0xFFFFFF, "SERVER: You do not have that much amount in your hand");//this will send an error message that if a player enter's an invalid amount.Or in simple words that if he enter's a higher amount then he has in hand.
    }
	return 1;
}
Код:
CMD:withdraw(playerid, params[])
{
	new string[256];//this is the variable that will store the formated message,we will format it in the following codes.
    new type;////this variable will store player's input.
    {
    if(sscanf(params, "d", amount)) return SendClientMessage(playerid, -1, "[USAGE]: /withdraw [amount]");//this will check that if he inserted the write format or not,if it is and incorrect format,it will break the codes there and end the process with an error message.
    if(type == 0)//this will check that if the type = 0.
    if(PlayerInfo[playerid][pBankAccount] >= type)//this will check that if the inputed amount is higher then the amount in the bank account.
    {
    PlayerInfo[playerid][pBankAccount] -= type;//this will minus the the amount or money he inserted, in the command.
    GivePlayerMoney(playerid, type);//this will give the player money he wanted to withdraw from the bank.
    format(string, sizeof(string), "INFO: You have successfully withdrawn $%d from your bank account.", type);//this is the formated message.This will store the formatted message in the variable we defined as string.
    SendClientMessage(playerid, 0xFFFFFF, string);//will send the formated message we formatted above.
   	}
    else SendClientMessage(playerid, 0xFFFFFF, "SERVER: You do not have that much amount in your account");//this will send an error message that if a player enter's an invalid amount.Or in simple words that if he enter's a higher amount then he has in bank account.
 	}
	return 1;
}








They work but they do not deposit or withdraw this cmd works tho

Код:
CMD:balance(playerid, params[])
{
	 new string[256];//the variable which will store the formatted message we will format in the next line.
     format(string, sizeof(string), "You currently have $%d In your bank account.", PlayerInfo[playerid][pBankAccount]);//this is the formated message which will tell the player that how much money he deposited in the bank account.
     SendClientMessage(playerid,-1,string);//this will send the formatted above,and which was stored in the variable above.

	return 1;
}
Reply
#2

Try this
Код:
CMD:deposit(playerid, params[])
{
    new string[256];//the variable which will store the information of a string that we will format after wards.
    new type;//this variable will store player's input.
 	{
  	if(sscanf(params, "d", type)) return SendClientMessage(playerid, -1, "[USAGE]: /deposit [amount]");//this will check that if he inserted the write format or not,if it is and incorrect format,it will break the codes there and end the process with an error message.
    if(type == 0)//this will check that if the type = 0.
	if(GetPlayerMoney(playerid)< type)//this will check that if he is inserting a higher amount of money then he has in hand.
    {
    GivePlayerMoney(playerid,-type);//this minus his money from his hand.
    SetPVarInt(playerid,"Bank Account",GetPVarInt(playerid,"Bank Account")+type);
    PlayerInfo[playerid][pBankAccount] + type;//this will store the minused money in player's file,and will add money to his account.
    format(string, sizeof(string), "INFO: You have successfully deposited $%d to your bank account.", type);//this is the format of the following message of how much money you deposited into your account.
    SendClientMessage(playerid, 0xFFFFFF, string);//this will send the message which we formated above,the information was stored in the variable string.
    }
    else SendClientMessage(playerid, 0xFFFFFF, "SERVER: You do not have that much amount in your hand");//this will send an error message that if a player enter's an invalid amount.Or in simple words that if he enter's a higher amount then he has in hand.
    }
	return 1;
}
and this :v
Код:
CMD:withdraw(playerid, params[])
{
	new string[256];//this is the variable that will store the formated message,we will format it in the following codes.
    new type;////this variable will store player's input.
    {
    if(sscanf(params, "d", amount)) return SendClientMessage(playerid, -1, "[USAGE]: /withdraw [amount]");//this will check that if he inserted the write format or not,if it is and incorrect format,it will break the codes there and end the process with an error message.
    if(type == 0)//this will check that if the type = 0.
    if(PlayerInfo[playerid][pBankAccount] >= type)//this will check that if the inputed amount is higher then the amount in the bank account.
    {
    SetPVarInt(playerid,"Bank Account",GetPVarInt(playerid,"Bank Account")-type);
    PlayerInfo[playerid][pBankAccount] - type;//this will minus the the amount or money he inserted, in the command.
    GivePlayerMoney(playerid, type);//this will give the player money he wanted to withdraw from the bank.
    format(string, sizeof(string), "INFO: You have successfully withdrawn $%d from your bank account.", type);//this is the formated message.This will store the formatted message in the variable we defined as string.
    SendClientMessage(playerid, 0xFFFFFF, string);//will send the formated message we formatted above.
   	}
    else SendClientMessage(playerid, 0xFFFFFF, "SERVER: You do not have that much amount in your account");//this will send an error message that if a player enter's an invalid amount.Or in simple words that if he enter's a higher amount then he has in bank account.
 	}
	return 1;
}
tell me if it doesnt work
Reply
#3

Nope
Reply
#4

try this with deposit
Код:
CMD:deposit(playerid, params[])
{
    new string[256];//the variable which will store the information of a string that we will format after wards.
    new type;//this variable will store player's input.
 	{
  	if(sscanf(params, "d", type)) return SendClientMessage(playerid, -1, "[USAGE]: /deposit [amount]");//this will check that if he inserted the write format or not,if it is and incorrect format,it will break the codes there and end the process with an error message.
    if(type == 0)//this will check that if the type = 0.
	if(GetPlayerMoney(playerid)>= type)//this will check that if he is inserting a higher amount of money then he has in hand.
    {
    GivePlayerMoney(playerid,-type);//this minus his money from his hand.
    SetPVarInt(playerid,"Bank Account",GetPVarInt(playerid,"Bank Account")+type);
    PlayerInfo[playerid][pBankAccount] + type;//this will store the minused money in player's file,and will add money to his account.
    format(string, sizeof(string), "INFO: You have successfully deposited $%d to your bank account.", type);//this is the format of the following message of how much money you deposited into your account.
    SendClientMessage(playerid, 0xFFFFFF, string);//this will send the message which we formated above,the information was stored in the variable string.
    }
    else SendClientMessage(playerid, 0xFFFFFF, "SERVER: You do not have that much amount in your hand");//this will send an error message that if a player enter's an invalid amount.Or in simple words that if he enter's a higher amount then he has in hand.
    }
	return 1;
}
i cant really find whats wrong with /withdraw , i'll keep trying to figure out its error , tell me if the /deposit still doesnt work
EDIT: change the "d" in each sscanf line in both cmds to "u" , hope that fixes part of it too
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)