SA-MP Forums Archive
INT to NAME - 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: INT to NAME (/showthread.php?tid=573648)



INT to NAME - NoDi522 - 09.05.2015

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



Re: INT to NAME - Beckett - 09.05.2015

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



Re: INT to NAME - NoDi522 - 09.05.2015

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.


Re: INT to NAME - Luis- - 09.05.2015

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



AW: INT to NAME - Mencent - 09.05.2015

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



Re: INT to NAME - Beckett - 09.05.2015

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.


Re: INT to NAME - Luis- - 09.05.2015

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


Re: INT to NAME - J4Rr3x - 09.05.2015

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


Re: INT to NAME - NoDi522 - 09.05.2015

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?


AW: INT to NAME - Mencent - 09.05.2015

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?