Inventory item on the same line.
#1

So, I'm doing an inventory system and would like to know how I do to show the intens in the same line, for example, I have a cell phone and money, and I would not like to skip a line to show by yesterday in each line, Look what I did:

PHP код:
if(GetPlayerMoney(playerid) >= 1format(strglobalsizeof(strglobal), "[Itens]: Dinheiro:[$%d]"GetPlayerMoney(playerid)); //linha 1
if(PlayerData[playerid][pCelular] == 1format(strglobalsizeof(strglobal), "[Itens 2]: Celular"GetPlayerMoney(playerid)); //linha 2
                
SendClientMessage(playerid, -1strglobal); 
So, the logic would be right, but it would not be the way I wanted it to be, how can I do to show the item on the same line?
Reply
#2

https://sampwiki.blast.hk/wiki/Strcat
Reply
#3

Create another format and mix the two sentences then show them.
Create each line with another variable.I only think that it can work not sure..

Also try to mix these sentences with + sign like SendClientMessage(playerid, -1, str1 + str2); OR By this method SendClientMessage(playerid, -1, str1 " " str2);
Reply
#4

PHP код:
new marijuana[32] = "Marijuana";
new 
cocaina[32] = "Marijuana";
if(
PlayerData[playerid][pMarijuana] == 1)
{
strcat(marijuana" :[%d]"PlayerData[playerid][pMarijuana]);
}
if(
PlayerData[playerid][pCocaina] == 1)
{
strcat(cocaina" :[%d]"PlayerData[playerid][pCocaina]);
}
SendClientMessage(playeridCOLOR_SEAGREENstrglobal); 
I did not understand anything, look what I did, I got angry at it, did not have the logic I wanted, I do not think you understood, I want everything in the same line. Example;

Quote:

Marijuana: [1] Cocaнna: [3]

You are understanding like this;
Quote:

Marijuana: [1]
Cocaнna: [3]

If it does not have only shows what it has, in a single line.
Reply
#5

PHP код:
new mar PlayerData[playerid][pMarijuana], coc PlayerData[playerid][pCocaina];
if(
mar == && coc == 1) {
    
format(strglobalsizeof(strglobal), "Cocaine: [%i] Marijuana: [%i]"cocmar);
    return 
SendClientMessage(playeridCOLOR_SEAGREENstrglobal);  

I think that's what you meant?
Reply
#6

Quote:
Originally Posted by oMa37
Посмотреть сообщение
PHP код:
new mar PlayerData[playerid][pMarijuana], coc PlayerData[playerid][pCocaina];
if(
mar == && coc == 1) {
    
format(strglobalsizeof(strglobal), "Cocaine: [%i] Marijuana: [%i]"cocmar);
    return 
SendClientMessage(playeridCOLOR_SEAGREENstrglobal);  

I think that's what you meant?
No, this logic I had already thought, I want to put the definitions in the same line, and if you do not have no shows and if you have the same line, everything in the same line, I tried to do no one else support me,...
Reply
#7

Is your inventory on textdraws? OR its on dialogs.
Reply
#8

In SendClientMessage your inventory.
Reply
#9

Use strcat, it's faster than format and you can use it without using format in another line. (Thanks to Gammix & SickAttack for the tip)

How to use strcat properly:
PHP код:
new str[40];
strcat(str"Marijuana: [");
strcat(strMarijuana_Variable);
strcat(str"] Cocaine: [");
strcat(strCocaine_Variable);
strcat(str"].");
SendClientMessage(playerid0x828282FFstr); 
How strcat is used:
PHP код:
new str[40];
strcat(str"Marijuana: [%d] Cocaine: [%d].");
format(strsizeof(str), strMarijuana_VariableCocaine_Variable);
SendClientMessage(playerid0x828282FFstr); 
EDIT: Changed the variable size, thanks oMa37.
Reply
#10

Don't you think size 75 is a bit too much? :c
It's not even 40.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)