INT to NAME
#1

Hey. I need your help. So how to do this:

I have my /createbiz command. And when i create biz it creates 3d text like this:

~ Biz for sale - (here should show biz name not int,its shows e.g. '4') ~


CODE:

PHP код:
stock BusinessType(BIZID)
{
    new 
string[30];
    switch(
BusinessInfo[BIZID][bType])
    {
        case 
5string "Cvijecara";
        case 
4string "GunShop";
        case 
3string "24/7";
        case 
2string "Bar";
        case 
1string "Ducan sa odjecom";
    }
    return 
string;

CODE of 3D:

PHP код:
new poruka[256];
    
format(poruka,sizeof(poruka),""COLOR_SIVA"~{FFFFFF} Firma na prodaju -"COLOR_WG" %d"COLOR_SIVA" ~\n{FFFFFF}Cijena:"COLOR_ZELENA" $%d\n\n{FFFFFF}Ukoliko zelite kupiti firmu: /kupifirmu",level,BusinessInfo[id][bPrice]);
    
Create3DTextLabel(poruka,-1,BusinessInfo[id][bEntranceX], BusinessInfo[id][bEntranceY], BusinessInfo[id][bEntranceZ],30,0,0); 
Reply
#2

pawn Код:
// In your format, I can't re-do your format as I don't understand anything.

format(poruka,sizeof(poruka),"Business Name: %s",BusinessType(id));
Reply
#3

PHP код:
new poruka[256]; 
    
format(poruka,sizeof(poruka),""COLOR_SIVA"~{FFFFFF} Business on sale -"COLOR_WG" %d"COLOR_SIVA" ~\n{FFFFFF}Price:"COLOR_ZELENA" $%d\n\n{FFFFFF}For buy type: /kupifirmu",level,BusinessInfo[id][bPrice]); 
    
Create3DTextLabel(poruka,-1,BusinessInfo[id][bEntranceX], BusinessInfo[id][bEntranceY], BusinessInfo[id][bEntranceZ],30,0,0); 
++ Example which you gave doesn't work.
Reply
#4

According to your code, it's showing the level of the business not the ID.

Simply do this;
pawn Код:
format(poruka,sizeof(poruka),""COLOR_SIVA"~{FFFFFF} Business on sale -"COLOR_WG" %s"COLOR_SIVA" ~\n{FFFFFF}Price:"COLOR_ZELENA" $%d\n\n{FFFFFF}For buy type: /kupifirmu",BusinessType(id),BusinessInfo[id][bPrice]);
Also, I've sorted out your stock function;
pawn Код:
stock BusinessType(BIZID)
{
    new string[30];
    switch(BusinessInfo[BIZID][bType])
    {
        case 1: string = "Ducan sa odjecom";
        case 2: string = "Bar";
        case 3: string = "24/7";
        case 4: string = "GunShop";
        case 5: string = "Cvijecara";
    }
    return string;
}
Reply
#5

Hello!

Do you mean it like this?
PHP код:
new poruka[256];
format(poruka,sizeof(poruka),""COLOR_SIVA"~{FFFFFF} Firma na prodaju -"COLOR_WG" %s"COLOR_SIVA" ~\n{FFFFFF}Cijena:"COLOR_ZELENA" $%d\n\n{FFFFFF}Ukoliko zelite kupiti firmu: /kupifirmu",BusinessType(id),BusinessInfo[id][bPrice]);
Create3DTextLabel(poruka,-1,BusinessInfo[id][bEntranceX], BusinessInfo[id][bEntranceY], BusinessInfo[id][bEntranceZ],30,0,0); 
Reply
#6

Quote:
Originally Posted by NoDi522
Посмотреть сообщение
PHP код:
new poruka[256]; 
    
format(poruka,sizeof(poruka),""COLOR_SIVA"~{FFFFFF} Business on sale -"COLOR_WG" %d"COLOR_SIVA" ~\n{FFFFFF}Price:"COLOR_ZELENA" $%d\n\n{FFFFFF}For buy type: /kupifirmu",level,BusinessInfo[id][bPrice]); 
    
Create3DTextLabel(poruka,-1,BusinessInfo[id][bEntranceX], BusinessInfo[id][bEntranceY], BusinessInfo[id][bEntranceZ],30,0,0); 
++ Example which you gave doesn't work.
There's something wrong with your stock function then.
Reply
#7

Quote:
Originally Posted by DaniceMcHarley
Посмотреть сообщение
There's something wrong with your stock function then.
He's not even using the stock function.
Reply
#8

pawn Код:
stock BusinessType(BIZID)
{
    new string[30];
    switch(BusinessInfo[BIZID][bType])
    {
        case 1: strpack(string, "Ducan sa odjecom"); // Use 'strpack' instead of 'format'! 'format' is more slower
        case 2: strpack(string, "Bar");
        case 3: strpack(string, "24/7");
        case 4: strpack(string, "GunShop");
        case 5: strpack(string, "Cvijecara");
    }
    return string;
}

new poruka[256];
format(poruka, sizeof(poruka), COLOR_SIVA"~{FFFFFF} Firma na prodaju -"COLOR_WG" %s"COLOR_SIVA" ~\n{FFFFFF}Cijena:"COLOR_ZELENA" $%d\n\n{FFFFFF}Ukoliko zelite kupiti firmu: /kupifirmu",BusinessType(id),BusinessInfo[id][bPrice]); // if you want to show biz name, change 'BusinessType(id)' with 'BusinessInfo[id][bName]' or something similar.
Create3DTextLabel(poruka,-1,BusinessInfo[id][bEntranceX], BusinessInfo[id][bEntranceY], BusinessInfo[id][bEntranceZ],30,0,0);
For strpack see this post: http://forum.sa-mp.com/showpost.php?...25&postcount=4
Reply
#9

When I do what you said guys i get something like this:

"This business is for sale - 7"\nType: /kupifirmu to buy business.

As you see i get 7 and i don't have any idea why. Would you check my /createbiz code?
Reply
#10

If you do it like this, are you get the number again?
PHP код:
format(poruka,sizeof(poruka),""COLOR_SIVA"~{FFFFFF} Firma na prodaju -"COLOR_WG" %s"COLOR_SIVA" ~\n{FFFFFF}Cijena:"COLOR_ZELENA" $%d\n\n{FFFFFF}Ukoliko zelite kupiti firmu: /kupifirmu",BusinessType(id),BusinessInfo[id][bPrice]); 
If so, can you show me your whole command?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)