Need a little help with this small variables problem (putting into a string)
#9

Nevermind, thanks for helping though! I found the solution.

You can't compare 2 string variables. Just isn't made like that. to do that you have to use strmid

So final code:
Код:
CMD:orderproduct(playerid, params[])
{
	new
	    ProductID,
	    AmountDeProduct,
	    ProductSlot,
	    ProductPrice,
	    x,
	    string[128];
   	x = getPlayerBusinessID(playerid);
	if(playerVariables[playerid][pNormalName] == businessVariables[x][bOwner])
	{
	    if(sscanf(params, "dddd", ProductID, AmountDeProduct, ProductPrice, ProductSlot)) return SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/orderproduct [Product ID] [Amount] [Product Price] [ProductSlot]");

		if(businessVariables[x][bType] == 1)
		{
			if(systemItems[ProductID][iType] > 5) return SendClientMessage(playerid, COLOR_GREY, "You can only order products from Type 1-5, check /itemslist to see which products you can order");
			if(ProductSlot == 1)
			{
				strmid(businessVariables[x][bProduct1], systemItems[ProductID][iName], false, 128, 128);

			    businessVariables[x][bProductAmount1] = AmountDeProduct;
			    businessVariables[x][bProductPrice1] = ProductPrice;
			    saveBusiness(x);
			    print(systemItems[ProductID][iName]);
                format(string, sizeof(string), "You have ordered [ %d ] of %s  on slot %d and set their price to $ %d", businessVariables[x][bProductAmount1], businessVariables[x][bProduct1], ProductSlot, businessVariables[x][bProductPrice1]);
                SendClientMessage(playerid, COLOR_GREY, string);
			}
			else
			{
			    SendClientMessage(playerid, COLOR_GREY, "you dumb as hell");
			}
		}
	}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)