Price or item does not update
#1

This is a item purchase script I'm going to do, when I click on item and it will be added into your cart. ItemCache has ten slots which is max_cart_item but when I click on them, it does not add to your list.

Код:
	if(GetPVarInt(playerid, "UI_Purchase"))
	{
	    new index_id = PlayerCache_GetFree(playerid);
	    for(new x = 0; x < 10; x ++)
	    {
	        if(clickedid == Store_UI[x])
	        {
	            if(PlayerCache_GetFree(playerid))
	            {
	            	PlayerInfo[playerid][ItemCache][index_id] = x;
	            	SetPVarInt(playerid, "PriceCount", GetPVarInt(playerid, "PriceCount") + ReturnItemPrice(x));
					if(PlayerInfo[playerid][ItemCache][x])
					{
					    if(GetPVarInt(playerid, "PriceCount") - ReturnItemPrice(PlayerInfo[playerid][ItemCache][index_id]) > 0)
					    {
					    	SetPVarInt(playerid, "PriceCount", GetPVarInt(playerid, "PriceCount") - ReturnItemPrice(PlayerInfo[playerid][ItemCache][index_id]));
						}
						else
						{
						    SetPVarInt(playerid, "PriceCount", 0);
						}
						PlayerInfo[playerid][ItemCache][index_id] = -1;
					}
				}
				new price[24];
				format(price, 24, "~g~$%s", MoneyFormat(GetPVarInt(playerid, "PriceCount")));
				PlayerTextDrawSetString(playerid, Store_Cart[playerid], price);
	        }
	    }
Код:
stock PlayerCache_GetFree(playerid)
{
	for(new i = 0; i < 10; i ++)
	{
		if(!PlayerInfo[playerid][ItemCache][i])
			return i+1;
	}
	return -1;
}
Reply
#2

Did you add debug messages inside the if statements to see if the statements are returning true?
Reply
#3

Quote:
Originally Posted by AndreiWow
Посмотреть сообщение
Did you add debug messages inside the if statements to see if the statements are returning true?
I will PKcheck it out tomorrow then update the topic
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)