Adding a text
#1

Hi. I want to add a text to box, but i can't. Pls help I want to add "Target ID's Backpack"





Код:
stock ShowTargetInventory(playerid, targetid)
{
	new str[180];
    if(!IsPlayerNPC(targetid))
    {
		gItemList="";
		for(new item;item<MAX_ITEMS;item++)
		{
			if(!strlen(_GetItemNamePVar(targetid,item))||!_GetItemAmountPVar(targetid,item))continue;
			format(gItemList,sizeof(gItemList),"%s\n%d\t\t%s",gItemList,_GetItemAmountPVar(targetid,item),_GetItemNamePVar(targetid,item));
		}
		format(gItemList,sizeof(gItemList),"%s",gItemList);

		format(str,sizeof(str),""COL_WHITE"%s "COL_GREEN"%i |"COL_WHITE" %i",GetBackpackName(targetid),pInfo[targetid][BackpackSlotsUsed],pInfo[targetid][BackpackSlots]);
		ShowPlayerDialog(playerid,INV_DIALOG_ID,DIALOG_STYLE_LIST,str,gItemList,"Select","Close");
	}
	return 1;
}
Reply
#2

Do you want make a distance between them inline, or what? Be bit clearly please..
Reply
#3

I want to add the text, it doesn't matter the distance.

But I don't know how to add that text.

GetPlayerName(targetid) ...
Reply
#4

Why, you can't put it by yourself? Which stuff is bothering you in this line?
PHP код:
stock ShowTargetInventory(playeridtargetid)
{
    new 
str[180];
    if(!
IsPlayerNPC(targetid))
    {
        
gItemList="";
        for(new 
item;item<MAX_ITEMS;item++)
        {
            if(!
strlen(_GetItemNamePVar(targetid,item))||!_GetItemAmountPVar(targetid,item))continue;
            
format(gItemList,sizeof(gItemList),"%s\n%d\t\t%s",gItemList,_GetItemAmountPVar(targetid,item),_GetItemNamePVar(targetid,item));
        }
        
format(gItemList,sizeof(gItemList),"%s",gItemList);
        
format(str,sizeof(str),""COL_WHITE"%s "COL_GREEN"%i |"COL_WHITE" %i "COL_GREEN"Name Of The Target |"COL_WHITE" %s"GetBackpackName(targetid), pInfo[targetid][BackpackSlotsUsed], pInfo[targetid][BackpackSlots], GetPlayerName(targetid));
        
ShowPlayerDialog(playerid,INV_DIALOG_ID,DIALOG_STYLE_LIST,str,gItemList,"Select","Close");
    }
    return 
1;

Reply
#5

I didn't know where to add "Name of the target" and where to add [targetinv]

thank you.


errors:

Код:
(19914) : warning 202: number of arguments does not match definition
(19914) : warning 202: number of arguments does not match definition
Код:
format(str,sizeof(str),""COL_WHITE"%s "COL_GREEN"%i |"COL_WHITE" %i "COL_GREEN"Rucsacul lui |"COL_WHITE" %s", GetBackpackName(targetid), pInfo[targetid][BackpackSlotsUsed], pInfo[targetid][BackpackSlots], GetPlayerName(targetid));
Reply
#6

Try it now
PHP код:
stock ShowTargetInventory(playeridtargetid)
{
    new 
str[180], NameTarget[MAX_PLAYER_NAME];
    
GetPlayerName(targetidNameTargetsizeof(NameTarget));
    if(!
IsPlayerNPC(targetid))
    {
        
gItemList="";
        for(new 
item;item<MAX_ITEMS;item++)
        {
            if(!
strlen(_GetItemNamePVar(targetid,item))||!_GetItemAmountPVar(targetid,item))continue;
            
format(gItemList,sizeof(gItemList),"%s\n%d\t\t%s",gItemList,_GetItemAmountPVar(targetid,item),_GetItemNamePVar(targetid,item));
        }
        
format(gItemList,sizeof(gItemList),"%s",gItemList);
        
format(str,sizeof(str),""COL_WHITE"%s "COL_GREEN"%i |"COL_WHITE" %i "COL_GREEN"Name Of The Target |"COL_WHITE" %s"GetBackpackName(targetid), pInfo[targetid][BackpackSlotsUsed], pInfo[targetid][BackpackSlots], NameTarget);
        
ShowPlayerDialog(playerid,INV_DIALOG_ID,DIALOG_STYLE_LIST,str,gItemList,"Select","Close");
    }
    return 
1;

Reply
#7

Works perfectly. Thank you. If you can help me at this error too i will be very glad https://sampforum.blast.hk/showthread.php?tid=651106
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)