• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 0.X Wrong sex at character creation

Sanzenkai

Member
Joined
Aug 25, 2023
Messages
31
Reaction score
13
Hi, when i create a character and select Male it always come as a female, please help me..

Shinobi (Male) = 1
Kunoichi (Female) = 0

Znote ACC
OTX2 8.6

As you can see on the images down there, i create the character as male (1) and its 0 on the database (and the game), i already tested on the game to see if people with sex 1 is male, and it is all good, just this little part when i create the character is bugged.
 

Attachments

  • imagem_2023-09-25_132943089.png
    imagem_2023-09-25_132943089.png
    2.2 KB · Views: 11 · VirusTotal
  • imagem_2023-09-25_133109854.png
    imagem_2023-09-25_133109854.png
    2.9 KB · Views: 10 · VirusTotal
  • imagem_2023-09-25_133318699.png
    imagem_2023-09-25_133318699.png
    4 KB · Views: 9 · VirusTotal
  • createcharacter.rar
    1.9 KB · Views: 2 · VirusTotal
Solution
Neither of them do the job.. i attach the files you mentioned can you see if i did something wrong please?
You changed both files instead of one of them which is not bad but not necessary.
Try this, add below this:
PHP:
    $sex = (int)$character_data['sex'];

And change:
to:
PHP:
            'sex' => $sex,

Add:
PHP:
            'sex' => $sex,
Below:

I have attached the changed files
The POST value (selected_gender) seems to be a string which will return as 0 when parsing into database.
Znote is validating it's value here:
You can see that he's converting POST value into an integer to validate it's input (either 0 or 1)

What you could do here is trying to changing this line:
PHP:
'sex'        =>    $_POST['selected_gender'],

to:
PHP:
'sex'        =>    (int) $_POST['selected_gender'],

I rather would change this instead:
PHP:
            'sex' => $character_data['sex'],

to:
PHP:
            'sex' => (int) $character_data['sex'],

This will convert your passed value (former string) into an integer.
Both ways will probably work but doing it directly in the main function is the cleaner way.
 
Last edited:
The POST value (selected_gender) seems to be a string which will return as 0 when parsing into database.
Znote is validating it's value here:
You can see that he's converting POST value into an integer to validate it's input (either 0 or 1)

What you could do here is trying to changing this line:
PHP:
'sex'        =>    $_POST['selected_gender'],

to:
PHP:
'sex'        =>    (int) $_POST['selected_gender'],

I rather would change this instead:
PHP:
            'sex' => $character_data['sex'],

to:
PHP:
            'sex' => (int) $character_data['sex'],

This will convert your passed value (former string) into an integer.
Both ways will probably work but doing it directly in the main function is the cleaner way.
Neither of them do the job.. i attach the files you mentioned can you see if i did something wrong please?
 

Attachments

Neither of them do the job.. i attach the files you mentioned can you see if i did something wrong please?
You changed both files instead of one of them which is not bad but not necessary.
Try this, add below this:
PHP:
    $sex = (int)$character_data['sex'];

And change:
to:
PHP:
            'sex' => $sex,

Add:
PHP:
            'sex' => $sex,
Below:

I have attached the changed files
 

Attachments

Solution
You changed both files instead of one of them which is not bad but not necessary.
Try this, add below this:
PHP:
    $sex = (int)$character_data['sex'];

And change:
to:
PHP:
            'sex' => $sex,

Add:
PHP:
            'sex' => $sex,
Below:

I have attached the changed files
It worked, thanks.
Post automatically merged:

Since we are here, can you help me with something else? on my shop if you do F5 he buy the same item again.. And another problem is that sometimes he just buy the same item even if you clicked on a diferent one. There is a way to fix those problems?
Post automatically merged:

@Danger II
 

Attachments

Last edited:
Back
Top