Why my command dont work?
#1

Heey all,
I made deposit command for your house.
But when i am in house and i have enough money its says unknown command.
Code:
Код:
dcmd_deposit(playerid,params[])
{
 	new amount;
	new str[256],str1[256],pname[24],housenumber;
	housenumber = GetHouseID(playerid);
	GetPlayerName(playerid, pname, 24);
	
	if (sscanf(params, "d", amount)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /deposit [amount]");
	if(IsInOwnHouse[playerid] == 0)
	{
		 SendClientMessage(playerid,COLOR_RED,"You need to be in your house for this command!");
		 return 1;
	}
	if(GetPlayerMoney(playerid) < amount) return SendClientMessage(playerid,COLOR_RED,"You dont have so much money!");
	if(amount < 1) return SendClientMessage(playerid,COLOR_RED,"Invalid Amount!");
	if((hInfo[housenumber][HouseStorage] + amount) >= 250000000) return SendClientMessage(playerid,COLOR_RED,"You have reached the maximum storage!");
	else
	{
		format(str1, sizeof(str1), "Houses/houseid%d", housenumber);
		str = dini_Get(str1,"HouseStorage");
	 	hInfo[housenumber][HouseStorage] = (hInfo[housenumber][HouseStorage] + amount);
	 	//file = INI_Open(filename);
		//INI_WriteInt(file, "HouseStorage", hInfo[housenumber][HouseStorage]);
		dini_IntSet(str1, "HouseStorage", hInfo[housenumber][HouseStorage]);
		//INI_Close(file);
		GivePlayerMoney(playerid, -amount);
		SendClientMessage(playerid, COLOR_LIGHTBLUE,"You have successfully deposited some money into your house storage!");
	}

	
   	return 1;
}
Pls how can i fix this?

Thanks Admigo
Reply
#2

I think that this happened to me twice , try to change the command's place to an other place i forgot how i've fixed it.
Reply
#3

I just have the command at bottom of script.
Reply
#4

Are you sure you used dcmd in a correct way?
Reply
#5

Try -
pawn Код:
dcmd_deposit(playerid,params[])
{
    new amount, str[256],str1[256],pname[24],housenumber;
    housenumber = GetHouseID(playerid);
    GetPlayerName(playerid, pname, 24);

    if (sscanf(params, "d", amount)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /deposit [amount]");
    if(IsInOwnHouse[playerid] == 0)  return SendClientMessage(playerid,COLOR_RED,"You need to be in your house for this command!");tPlayerMoney(playerid) < amount) return SendClientMessage(playerid,COLOR_RED,"You dont have so much money!");
    if(amount < 1) return SendClientMessage(playerid,COLOR_RED,"Invalid Amount!");
    if((hInfo[housenumber][HouseStorage] + amount) >= 250000000) return SendClientMessage(playerid,COLOR_RED,"You have reached the maximum storage!");
    format(str1, sizeof(str1), "Houses/houseid%d", housenumber);
    str = dini_Get(str1,"HouseStorage");
     hInfo[housenumber][HouseStorage] = (hInfo[housenumber][HouseStorage] + amount);
    //file = INI_Open(filename);
    //INI_WriteInt(file, "HouseStorage", hInfo[housenumber][HouseStorage]);
    dini_IntSet(str1, "HouseStorage", hInfo[housenumber][HouseStorage]);
    //INI_Close(file);
    GivePlayerMoney(playerid, -amount);
    SendClientMessage(playerid, COLOR_LIGHTBLUE,"You have successfully deposited some money into your house storage!");
    return 1;
}
If it doesn't work, try debugging it.
Reply
#6

Quote:
Originally Posted by admigo
Посмотреть сообщение
I just have the command at bottom of script.
Debug it yourself add printf's to the command once every check or function is processed.

I recommend you to use zcmd not dcmd.
Reply
#7

Quote:
Originally Posted by SmiT
Посмотреть сообщение
Try -
pawn Код:
dcmd_deposit(playerid,params[])
{
    new amount, str[256],str1[256],pname[24],housenumber;
    housenumber = GetHouseID(playerid);
    GetPlayerName(playerid, pname, 24);

    if (sscanf(params, "d", amount)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /deposit [amount]");
    if(IsInOwnHouse[playerid] == 0)  return SendClientMessage(playerid,COLOR_RED,"You need to be in your house for this command!");tPlayerMoney(playerid) < amount) return SendClientMessage(playerid,COLOR_RED,"You dont have so much money!");
    if(amount < 1) return SendClientMessage(playerid,COLOR_RED,"Invalid Amount!");
    if((hInfo[housenumber][HouseStorage] + amount) >= 250000000) return SendClientMessage(playerid,COLOR_RED,"You have reached the maximum storage!");
    format(str1, sizeof(str1), "Houses/houseid%d", housenumber);
    str = dini_Get(str1,"HouseStorage");
     hInfo[housenumber][HouseStorage] = (hInfo[housenumber][HouseStorage] + amount);
    //file = INI_Open(filename);
    //INI_WriteInt(file, "HouseStorage", hInfo[housenumber][HouseStorage]);
    dini_IntSet(str1, "HouseStorage", hInfo[housenumber][HouseStorage]);
    //INI_Close(file);
    GivePlayerMoney(playerid, -amount);
    SendClientMessage(playerid, COLOR_LIGHTBLUE,"You have successfully deposited some money into your house storage!");
    return 1;
}
If it doesn't work, try debugging it.
Same problem:Unknown command.
Someone have other code for deposit and withdraw with dini?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)