Closed tr1xy closed 4 years ago
isnull
@Y-Less that won't work for some reason, here is the code: https://pastebin.com/iSprFqZv
print("AAAA"); is being called even tho I just selected the Dialog's Item (no actual input) (DIALOG_STYLE_LIST)
EDIT: btw I noticed that the ID is missing (iirc Dialog_ShowCallbackData used to have it as the last param) and It'd be very useful here as I could create better conditions (I think at least)
btw Ignore the if(!response) inside that code block (I was testing something)
I removed the IDs because they are not needed if you're using callbacks - there's only one dialog that can trigger the response (not true for public callbacks I suppose).
That ain't solving my problem though, why is inputtext not null? @Y-Less
It's \1
. I saw some messages about this, but you deleted them, in which you checked inputtext[0] == '\1'
, which is exactly what isnull(inputtext)
does.
I used if(inputtext[0] == '\1')
but I need ! =
there so I thought it worked but in fact it did not and that's why I deleted the message...
@Y-Less Here is everytyhing:
// Auth > Register
stock Auth_DoRegister(playerid, step = 0)
{
switch(step)
{
case 0:
{
inline passwordDialog(id, dialogid, response, listitem, string:inputtext[])
{
#pragma unused id, dialogid, listitem
if(!response) {
Kick(playerid);
return;
}
if(strlen(inputtext) < MIN_PASSWORD_LENGTH) {
va_SendErrorMessage(playerid, "Žao nam je ali Vaša lozinka mora da ima minimalno %d karaktera!", MIN_PASSWORD_LENGTH);
Auth_DoRegister(playerid);
return;
}
strcpy(PlayerPassword[playerid], inputtext);
va_SendServerMessage(playerid, "Okej, uneli ste "SERVER"%s "WHITE"za lozinku naloga.", inputtext);
Auth_DoRegister(playerid, step + 1);
}
new string[450];
format(string, sizeof(string), ""WHITE"Dobro nam došli, "SERVER"%s\n\n"WHITE"Ovaj nalog "DARK_ORANGE"nije registrovan "WHITE"na našem serveru.\nDa biste ga registrovali, unesite željenu lozinku.\nUnošenjem lozinke zapocinjete proces registracije naloga.\n\n"INDIANRED"Napomene:\n\t"INDIANRED"- Lozinka mora imati minimalno %d karaktera\n\t"INDIANRED"- Lozinka mora da bude sacinjena od brojeva i slova\n\t"INDIANRED"- Ova lozinka ce Vam biti potrebna za logovanje na nalog", PlayerName[playerid], MIN_PASSWORD_LENGTH);
Dialog_ShowCallback(playerid, using inline passwordDialog, DIALOG_STYLE_PASSWORD, va_return(""ORANGE_RED"(%d/4) Lozinka", step + 1), string, D_CONFIRM, D_CANCEL);
}
case 1:
{
inline genderDialog(id, dialogid, response, listitem, string:inputtext[])
{
#pragma unused id, dialogid, inputtext
if(!response) {
Auth_DoRegister(playerid, step - 1);
return;
}
PlayerGender{playerid} = (listitem + 1);
va_SendServerMessage(playerid, "Okej, izabrali ste "SERVER"%s "WHITE"pol.", listitem == 0 ? "muški" : "ženski");
Auth_DoRegister(playerid, step + 1);
}
Dialog_ShowCallback(playerid, using inline genderDialog, DIALOG_STYLE_LIST, va_return(""ORANGE_RED"(%d/4) Pol", step + 1), ""WHITE"Muško\n"WHITE"Žensko", D_CONFIRM, D_CANCEL);
}
case 2:
{
inline skinTone(id, dialogid, response, listitem, string:inputtext[])
{
#pragma unused id, dialogid, inputtext
if(!response) {
Auth_DoRegister(playerid, step - 1);
return;
}
PlayerSkinTone{playerid} = (listitem + 1);
va_SendServerMessage(playerid, "Okej, izabrali ste "SERVER"%s "WHITE"ton kože.", listitem == 0 ? "svetliji" : "tamniji");
Auth_DoRegister(playerid, step + 1);
}
Dialog_ShowCallback(playerid, using inline skinTone, DIALOG_STYLE_LIST, va_return(""ORANGE_RED"(%d/4) Ton kože", step + 1), ""WHITE"Svetliji\nTamniji", D_CONFIRM, D_CANCEL);
}
case 3:
{
inline playerRefferal(id, dialogid, response, listitem, string:inputtext[])
{
#pragma unused id, dialogid
if(!response) {
Auth_DoRegister(playerid, step - 1);
return;
}
// This condition is called even though I did not enter anything...
if(inputtext[0] != '\1') //
{
print("AAAA");
inline doSqlCheck()
{
if(cache_num_rows())
{
PlayerRefferal{playerid} = REFFERAL_PLAYER;
cache_get_value_name_int(0, "player_id", PlayerRefferalDBID[playerid]);
va_SendServerMessage(playerid, "Okej, izabrali ste "SERVER"%s "WHITE"za Vašeg preporucitelja.", inputtext[0]);
}
else
{
va_SendErrorMessage(playerid, "Nismo uspeli pronaci "FIREBRICK"%s "WHITE"u databazi!", inputtext[0]);
Auth_DoRegister(playerid, step);
}
MySQL_TQueryInline(dbHandler, using inline doSqlCheck, "SELECT `player_id` FROM `player_profile` WHERE `player_name` = '%e'", inputtext[0]);
}
}
else
{
switch(listitem)
{
case 0:
{
Dialog_ShowCallback(playerid, using inline playerRefferal, DIALOG_STYLE_INPUT, va_return(""ORANGE_RED"(%d/4) Refferal", step + 1), ""WHITE"Molimo Vas unesite username Vašeg prijatelja:", D_CONFIRM, D_CANCEL);
}
case 1:
{
PlayerRefferal{playerid} = REFFERAL_SERVER_LIST;
SendServerMessage(playerid, "Okej, izabrali ste "SERVER"listu servera "WHITE"za preporucitelja.");
}
}
}
}
Dialog_ShowCallback(playerid, using inline playerRefferal, DIALOG_STYLE_LIST, va_return(""ORANGE_RED"(%d/4) Kako ste saznali za naš server?", step + 1), ""WHITE"Od prijatelja\nLista servera (Game-State/SACNR Monitor)\nFacebook Grupe\nDrugo", D_CONFIRM, D_CANCEL);
}
default:
{
inline doHash()
{
bcrypt_get_hash(PlayerPassword[playerid]);
Auth_FinishRegistration(playerid);
}
BCrypt_HashInline(PlayerPassword[playerid], 12, using inline doHash);
}
}
return;
}
Hastebin: https://hastebin.com/uxuvivubey.cpp
Look at the line 81
I used SendClientMessage
and inputtext[0]
was Od prijatelja
which is dialog's first line (item)
lmao what
EDIT:
Could it be that the problem lies here (I used using inline playerRefferal
inside inline playerRefferal
?
I think that it works if I remove that... (not sure, I was testing yesterday so I forgot):
Dialog_ShowCallback(playerid, using inline playerRefferal, DIALOG_STYLE_INPUT, va_return(""ORANGE_RED"(%d/4) Refferal", step + 1), ""WHITE"Molimo Vas unesite username Vašeg prijatelja:", D_CONFIRM, D_CANCEL);
EDIT 2: Could be related to #402
Yeah, issue confirmed, inputtext somehow interheits the arguments of the dialog's item (DIALOG_STYLE_LIST), Code used:
inline test(id, dialogid, response, listitem, string:inputtext[])
{
#pragma unused id, dialogid, response, listitem
SendClientMessage(playerid, -1, inputtext);
}
Dialog_ShowCallback(playerid, using inline test, DIALOG_STYLE_LIST, "TITLE", "1\n2\n3\n4", "X", "O");
I selected Second Item and I got 2
in chat
EDIT: AH, Fcking SAMP bugs, this happens in normal ones too smh
You probably can create workaround for this or something like that ?
I noticed that even if player do not enter anything, inputtext still won't be \0
This is what I get when I printf the value passed to inputtext: