Need Help..My cmds are not working ingame
#1

Guys i need help..Im having problem in my bank system..my /withdraw cmd is bugged...whenever i enter /withdraw at bank..it shows "unkown command"..Help me Pls

Here are my code..Im adding my deposit code ttoo..maybe u guys can spot any problem
Код:
CMD:withdraw(playerid, params[]){
	if(AdminDuty[playerid] == 1)
 	{
  		SendClientMessage(playerid,COLOR_WHITE, "You can't use this command while on-duty as admin.");
		return 1;
	}

	if(!IsPlayerInRangeOfPoint(playerid, 2477.9370,2376.9744,-39.3672))
	{
		SendClientMessage(playerid, COLOR_GREY, "You're not at the bank!");
		return 1;
	}
	new string[128], amount;

	if(sscanf(params, "d", amount))
	{
		SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /withdraw [amount]");
		format(string, sizeof(string), "  You have $%d in your account.", PlayerInfo[playerid][pBank]);
		SendClientMessage(playerid, COLOR_GRAD3, string);
		return 1;
	}

	if(amount > PlayerInfo[playerid][pBank] || amount < 1)
	{
		SendClientMessage(playerid, COLOR_GRAD2, "   You don't have that much!");
		return 1;
	}
	GivePlayerCash(playerid,amount);
	PlayerInfo[playerid][pBank]=PlayerInfo[playerid][pBank]-amount;
	format(string, sizeof(string), "  You have withdrawn $%d from your account. Current balance: $%d ", amount,PlayerInfo[playerid][pBank]);
	SendClientMessage(playerid, COLOR_YELLOW, string);
	return 1;
}

CMD:deposit(playerid, params[]) {
	if(AdminDuty[playerid] == 1)
 	{
  		SendClientMessage(playerid,COLOR_WHITE, "You can't use this command while on-duty as admin.");
		return 1;
	}

	if(!IsPlayerInRangeOfPoint(playerid, 10.0, 2477.9370,2376.9744,-39.3672))
	{
		SendClientMessage(playerid, COLOR_GREY, "You're not at the bank!");
		return 1;
	}
	new string[128], amount;

	if(sscanf(params, "d", amount))
	{
		SendClientMessage(playerid, COLOR_WHITE, "USAGE: /deposit [amount]");
		format(string, sizeof(string), "  You have $%d in your account.", PlayerInfo[playerid][pBank]);
		SendClientMessage(playerid, COLOR_GRAD3, string);
		return 1;
	}

	if(amount > GetPlayerCash(playerid) || amount < 1)
	{
		SendClientMessage(playerid, COLOR_GRAD2, "   You don't have that much.");
		return 1;
	}
	GivePlayerCash(playerid,-amount);
	new curfunds = PlayerInfo[playerid][pBank];
	PlayerInfo[playerid][pBank]=amount+PlayerInfo[playerid][pBank];
	SendClientMessage(playerid, COLOR_WHITE, "|___ BANK STATMENT ___|");
	format(string, sizeof(string), "  Old Balance: $%d", curfunds);
	SendClientMessage(playerid, COLOR_GRAD2, string);
	format(string, sizeof(string), "  Deposit: $%d",amount);
	SendClientMessage(playerid, COLOR_GRAD4, string);
	SendClientMessage(playerid, COLOR_GRAD6, "|-----------------------------------------|");
	format(string, sizeof(string), "  New Balance: $%d", PlayerInfo[playerid][pBank]);
	SendClientMessage(playerid, COLOR_WHITE, string);
	return 1;
}
Reply
#2

Mabye you copy past the CMD from other script to your script? try to check if your GM use zcmd include.

or try to use that: CMD:withdraw(playerid, params[]) instead that: CMD:withdraw(playerid, params[]){ - Just remove the "{" and tell me if it's work.

If you want +rep me brother
Reply
#3

Quote:
Originally Posted by TalD
Посмотреть сообщение
Mabye you copy past the CMD from other script to your script? try to check if your GM use zcmd include.

or try to use that: CMD:withdraw(playerid, params[]) instead that: CMD:withdraw(playerid, params[]){ - Just remove the "{" and tell me if it's work.

If you want +rep me brother
Please no... That's not the reason it's got an issue... Please, learn how structure works before suggesting things like this...
Reply
#4

Check this script please

PHP код:
CMD:withdraw(playeridparams[])
{
    if(
AdminDuty[playerid] == 1) return SendClientMessage(playeridCOLOR_WHITE"You can't use this command while on-duty as admin.");

    if(!
IsPlayerInRangeOfPoint(playerid2477.9370,2376.9744,-39.3672)) return SendClientMessage(playeridCOLOR_GREY"You're not at the bank!");

    if(
params[0] > PlayerInfo[playerid][pBank] || params[0] < 1) return SendClientMessage(playeridCOLOR_GRAD2"   You don't have that much!");
    new 
string[128];

    if(
sscanf(params"d"params[0]))
    {
        
SendClientMessage(playeridCOLOR_GRAD2"USAGE: /withdraw [amount]");
        
format(stringsizeof(string), "  You have $%d in your account."PlayerInfo[playerid][pBank]);
        
SendClientMessage(playeridCOLOR_GRAD3string);
        return 
1;
    }

    
GivePlayerMoney(playeridparams[0]);
    
PlayerInfo[playerid][pBank] = PlayerInfo[playerid][pBank]-params[0];
    
format(stringsizeof(string), " Youґre withdrawn $%d from your account. Current balance: $%d "params[0],PlayerInfo[playerid][pBank]);
    
SendClientMessage(playeridCOLOR_YELLOWstring);
    return 
1;

donґt know your function GivePlayerCash()
Reply
#5

Quote:
Originally Posted by Eloy
Посмотреть сообщение
Check this script please

PHP код:
CMD:withdraw(playeridparams[])
{
    if(
AdminDuty[playerid] == 1) return SendClientMessage(playeridCOLOR_WHITE"You can't use this command while on-duty as admin.");
    if(!
IsPlayerInRangeOfPoint(playerid2477.9370,2376.9744,-39.3672)) return SendClientMessage(playeridCOLOR_GREY"You're not at the bank!");
    if(
params[0] > PlayerInfo[playerid][pBank] || params[0] < 1) return SendClientMessage(playeridCOLOR_GRAD2"   You don't have that much!");
    new 
string[128];
    if(
sscanf(params"d"params[0]))
    {
        
SendClientMessage(playeridCOLOR_GRAD2"USAGE: /withdraw [amount]");
        
format(stringsizeof(string), "  You have $%d in your account."PlayerInfo[playerid][pBank]);
        
SendClientMessage(playeridCOLOR_GRAD3string);
        return 
1;
    }
    
GivePlayerMoney(playeridparams[0]);
    
PlayerInfo[playerid][pBank] = PlayerInfo[playerid][pBank]-params[0];
    
format(stringsizeof(string), " Youґre withdrawn $%d from your account. Current balance: $%d "params[0],PlayerInfo[playerid][pBank]);
    
SendClientMessage(playeridCOLOR_YELLOWstring);
    return 
1;

donґt know your function GivePlayerCash()
Still Same
Reply
#6

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
Please no... That's not the reason it's got an issue... Please, learn how structure works before suggesting things like this...
Can u help me dude?
Reply
#7

Does deposit actually work?
Reply
#8

seems like a runtime crash try compiling in -d3 and use crash detect and then review your log.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)