SA-MP Forums Archive
Why my command dont work? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Why my command dont work? (/showthread.php?tid=295719)



dcmd command problem. - Admigo - 07.11.2011

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


Re : Why my command dont work? - Alvin007 - 07.11.2011

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.


Re: Why my command dont work? - Admigo - 07.11.2011

I just have the command at bottom of script.


Re: Why my command dont work? - Kingunit - 07.11.2011

Are you sure you used dcmd in a correct way?


Re: Why my command dont work? - SmiT - 07.11.2011

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.


Respuesta: Re: Why my command dont work? - Donuts - 07.11.2011

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.


Re: Why my command dont work? - Admigo - 07.11.2011

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?