Is this right?
#1

I didnt test this yet, I want to find out if this is going to work or not, if you have 500 dollars or more phone price comes up in green, otherwisde it will come up in red, is the code for it right? Thx

pawn Код:
if(GetPlayerMoney(playerid) >= 500))
            {
                format(option1,sizeof(option1),"Phone {GREEN}$500");
            }
            if(GetPlayerMoney(playerid) < 500))
            {
                format(option1,sizeof(option1),"Phone {RED}$500");
            }
            format(text,sizoef(text),"%s\n%s",option1,option2);

            ShowPlayerDialog(playerid, 247, DIALOG_STYLE_LIST, "Shop:", text, "Buy", "Cancel");
Reply
#2

pawn Код:
if(GetPlayerMoney(playerid) >= 500)
            {
                format(option1,sizeof(option1),"Phone {GREEN}$500");
            }
            if(GetPlayerMoney(playerid) < 500)
            {
                format(option1,sizeof(option1),"Phone {RED}$500");
            }
            format(text,sizoef(text),"%s\n%s",option1,option2);

            ShowPlayerDialog(playerid, 247, DIALOG_STYLE_LIST, "Shop:", text, "Buy", "Cancel");
Reply
#3

The code is correct, however the colours won't show.

I'm guessing "GREEN" and "RED" are definitions.
You should place a quotation mark before the define name, then add a "#" (without quotation marks) at the start of the name.Then place a quotation mark where you want the text to start again (After the definition name).

Like so:
pawn Код:
if(GetPlayerMoney(playerid) >= 500)
            {
                format(option1,sizeof(option1),"Phone "#GREEN"$500");
            }
            if(GetPlayerMoney(playerid) < 500) //You also had an extra bracket here.
            {
                format(option1,sizeof(option1),"Phone "#RED"$500");
            }
            format(text,sizoef(text),"%s\n%s",option1,option2);

            ShowPlayerDialog(playerid, 247, DIALOG_STYLE_LIST, "Shop:", text, "Buy", "Cancel");
You should also ensure that your in-string colour definitions look like:
pawn Код:
#define RED {FF0000}
Reply
#4

funky edit the one you just post, on the first getplayermoney it has another extra
Reply
#5

Quote:
Originally Posted by Tanush123
Посмотреть сообщение
funky edit the one you just post, on the first getplayermoney it has another extra
Just noticed that - I was looking at the less obvious things haha.
Reply
#6

error 029: invalid expression, assumed zero
error 017: undefined symbol "option1"
error 017: undefined symbol "option1"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
Reply
#7

Quote:
Originally Posted by HondaCBR
Посмотреть сообщение
error 029: invalid expression, assumed zero
error 017: undefined symbol "option1"
error 017: undefined symbol "option1"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
pawn Код:
if(GetPlayerMoney(playerid) >= 500)
            {
                format(option1,sizeof(option1),"Phone "#GREEN"$500");
            }
            if(GetPlayerMoney(playerid) < 500) //You also had an extra bracket here.
            {
                format(option1,sizeof(option1),"Phone "#RED"$500");
            }
            format(text,sizeof(text),"%s\n%s",option1,option2);

            ShowPlayerDialog(playerid, 247, DIALOG_STYLE_LIST, "Shop:", text, "Buy", "Cancel");
Try that, just noticed you had another 'extra' bracket. You also spelt sizeof wrong...
Reply
#8

pawn Код:
if(GetPlayerMoney(playerid) >= 100)
            {
                format(option1,sizeof(option1),"Telefon Komurkowy {00FC11}$100");
            }
            if(GetPlayerMoney(playerid) < 100)
            {
                format(option1,sizeof(option1),"Telefon Komurkowy {FF0000}$100");
            }
            if(GetPlayerMoney(playerid) >= 100)
            {
                format(option2,sizeof(option2),"Telefon Komurkowy {00FC11}$100");
            }
            if(GetPlayerMoney(playerid) < 100)
            {
                format(option2,sizeof(option2),"Telefon Komurkowy {FF0000}$100");
            }
            format(text,sizeof(text),"%s\n%s",option1,option2);

            ShowPlayerDialog(playerid, 247, DIALOG_STYLE_LIST, "Sklep:", text, "Kup", "Anuluj");
Код:
 error 017: undefined symbol "option1"
 error 017: undefined symbol "option1"
 error 029: invalid expression, assumed zero
 fatal error 107: too many error messages on one line
Reply
#9

Could you show us the lines where the errors occur?

Thanks
Reply
#10

pawn Код:
format(option1,sizeof(option1),"Telefon Komurkowy {00FC11}$100");
all errors are there and the last error is fatal error, therefore i think thesame errors will come up on all the format(option... lines.

any ideas?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)