SA-MP Forums Archive
Adding a text - 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: Adding a text (/showthread.php?tid=651133)



number of arguments does not match definition PLS HELP - Zeus666 - 14.03.2018

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;
}



Re: Adding a text - Maximun - 14.03.2018

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


Re: Adding a text - Zeus666 - 14.03.2018

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

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

GetPlayerName(targetid) ...


Re: Adding a text - Maximun - 14.03.2018

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;




Re: Adding a text - Zeus666 - 14.03.2018

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));



Re: Adding a text - Maximun - 14.03.2018

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;




Re: Adding a text - Zeus666 - 14.03.2018

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