String problem
#1

Hello guys, I have got a problem.. It doesnt shows what I want the listitem line shows wrong number (ascii i guess) and this is begin of code

pawn Код:
//FROM ENUM
vAgeSlot1[30]

new CharacterChecking [MAX_PLAYERS] [vChecking];

//THIS IS FIRST PART OF USING this variable:

format(CharacterChecking [playerid] [vAgeSlot1], 30, "Enter gender please!");
new string[220];
format (string, sizeof (string), "{FF9900}Meno postavy:\n%s\n \n{FF9900}Pohlavie postavy:\n%s\n \n{FF9900}Age of character:\n%s\n \n{FFFF00}Vytvoriť postavu", PouzivateloveInformacie [playerid] [pPostava1], VytvaranieKontrola [playerid] [vPohlavieSlot1], [B]CharacterChecking [playerid] [vAgeSlot1][/B]);
ShowPlayerDialog(playerid, 15, DIALOG_STYLE_LIST, "{FF9900}V{FFCC00}ytvбranie postavy {FF9900}(slot č.1)", string, "Pokračovať", "Ukončiť");

//Then I set the variable to number in another dialog:

new age = strval (inputtext);
               
if (age >= 18 && age <= 80)
{
    CharacterChecking [playerid] [vAgeSlot1] = age;
    new string[190];
    format (string, sizeof (string), "{FF9900}Meno postavy:\n%s\n \n{FF9900}Pohlavie postavy:\n%s\n \n{FF9900}Age of character:\n%i\n \n{FFFF00}Vytvoriť postavu", PouzivateloveInformacie [playerid] [pPostava1], VytvaranieKontrola [playerid] [vPohlavieSlot1], [B]CharacterChecking [playerid] [vAgeSlot1][/B]);
                    ShowPlayerDialog(playerid, 15, DIALOG_STYLE_LIST, "{FF9900}V{FFCC00}ytvбranie postavy {FF9900}(slot č.1)", string, "Pokračovať", "Ukončiť");
                }
I translated the problematic lines, hope you understand
Reply
#2

This part CharacterChecking [playerid] [vAgeSlot1] doesn't look like the others,Can you post the new right after that enum?and what is that [/B]?

Edit: oh nvm...I think you messed up by using the [b ][ /b] inside [CODE ][ /CODE]
Reply
#3

vAgeSlot1 should be an integer and not a string.

pawn Код:
//FROM ENUM
vAgeSlot1

new CharacterChecking [MAX_PLAYERS] [vChecking];

//THIS IS FIRST PART OF USING this variable:

new string[220];
format (string, sizeof (string), "{FF9900}Meno postavy:\n%s\n \n{FF9900}Pohlavie postavy:\n%s\n \n{FF9900}Age of character:\nEnter gender please!\n \n{FFFF00}Vytvoriť postavu", PouzivateloveInformacie [playerid] [pPostava1], VytvaranieKontrola [playerid] [vPohlavieSlot1]);
ShowPlayerDialog(playerid, 15, DIALOG_STYLE_LIST, "{FF9900}V{FFCC00}ytvбranie postavy {FF9900}(slot č.1)", string, "Pokračovať", "Ukončiť");

//Then I set the variable to number in another dialog:

new age = strval (inputtext);

if (age >= 18 && age <= 80)
{
    CharacterChecking [playerid] [vAgeSlot1] = age;
    new string[190];
    format (string, sizeof (string), "{FF9900}Meno postavy:\n%s\n \n{FF9900}Pohlavie postavy:\n%s\n \n{FF9900}Age of character:\n%i\n \n{FFFF00}Vytvoriť postavu", PouzivateloveInformacie [playerid] [pPostava1], VytvaranieKontrola [playerid] [vPohlavieSlot1], CharacterChecking [playerid] [vAgeSlot1]);
    ShowPlayerDialog(playerid, 15, DIALOG_STYLE_LIST, "{FF9900}V{FFCC00}ytvбranie postavy {FF9900}(slot č.1)", string, "Pokračovať", "Ukončiť");
}
Reply
#4

aww, I wanted to make it with Bold font, to show where is it.. But it didnt work

//Konstantinos, but I need to set a variable to string like I had "Enter gender please" I am using it in some other dialog, is it possible to make it?
Reply
#5

I probably got it working, listitem line shows good but I dont understand this:

pawn Код:
format (CharacterChecking [playerid] [vAgeSlot1], 30, "%i", age);
printf ("%i", CharacterChecking [playerid] [vAgeSlot1]);
Why to console it outputs 50 when I type 20? But in dialog it shows that it is 20..
Reply
#6

If you keep it as string, then you need to use %s placeholder and not for integers.

pawn Код:
printf ("%s", CharacterChecking [playerid] [vAgeSlot1]);
Reply
#7

Nice thanx dude, it works!
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)