Dialog problem. Registration.
#1

Pff! the only reason behind why I hate dialogs is I can't get it work :/

So, I am just creating a Registration and Login system and I am creating a dialog like this :

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_REG:
        {
            if ( response == 0 )
            {
                new Str [ 128 ] , Str2 [ 128 ] ;
                format ( Str , 128 , ""#COLOR_RED"» "#COLOR_WHITE"You need to "#COLOR_HIGHGREEN"register "#COLOR_WHITE"on this server in order to play." ) ;
                format ( Str2 , 128 , ""#COLOR_RED"» "#COLOR_WHITE"You have been "#COLOR_RED"KICKED "#COLOR_WHITE"as registration is compulsary." ) ;
                SendClientMessage ( playerid , -1 , Str ) ;
                SendClientMessage ( playerid , -1 , Str2 ) ;
                Kick ( playerid ) ;
            }
            else
            {
                PlayerRegister ( playerid , inputtext ) ;
                new Str [ 128 ] , Str2 [ 128 ] , Str3 [ 128 ] ;
                format ( Str , 128 , ""#COLOR_RED"» "#COLOR_WHITE"Account : "#COLOR_RED"%s "#COLOR_WHITE"has been registered "COLOR_HIGHGREEN"successfully!" , GetName ( playerid ) ) ;
                format ( Str2 , 128 , ""#COLOR_RED"» "#COLOR_DARKBLUE"Thank you "#COLOR_WHITE"for registration! You may proceed by selecting your skin and spawn" ) ;
                format ( Str3 , 128 , ""#COLOR_RED"» "#COLOR_WHITE"%s just regitered their account on the server! "#COLOR_HIGHGREEN"We "COLOR_WHITE"welcome %s behalf of all our members" , GetName ( playerid ) , GetName ( playerid ) ) ;
                SendClientMessage ( playerid , -1 , Str ) ;
                SendClientMessage ( playerid , -1 , Str2 ) ;
                SendClientMessageToAll ( -1 , Str3 ) ;
            }
        }

The problem is when the player presses Leave he should be kicked and he is kicked but his account is still created in the scrip folder.

Help me :/


and If can anyone help me with Y_INI problem - HERE!

NOTE: I am testing my script on my friends PC where the Y_INI problem I am facing does not exist.


Help will be highly appreciated.


Ronaldo_raul
Reply
#2

Try this:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_REG:
        {
            if (!response)
            {
                new Str [ 128 ] , Str2 [ 128 ] ;
                format ( Str , 128 , ""#COLOR_RED"» "#COLOR_WHITE"You need to "#COLOR_HIGHGREEN"register "#COLOR_WHITE"on this server in order to play." ) ;
                format ( Str2 , 128 , ""#COLOR_RED"» "#COLOR_WHITE"You have been "#COLOR_RED"KICKED "#COLOR_WHITE"as registration is compulsary." ) ;
                SendClientMessage ( playerid , -1 , Str ) ;
                SendClientMessage ( playerid , -1 , Str2 ) ;
                Kick ( playerid ) ;
                return 1;
            }
            else
            {
                PlayerRegister ( playerid , inputtext ) ;
                new Str [ 128 ] , Str2 [ 128 ] , Str3 [ 128 ] ;
                format ( Str , 128 , ""#COLOR_RED"» "#COLOR_WHITE"Account : "#COLOR_RED"%s "#COLOR_WHITE"has been registered "COLOR_HIGHGREEN"successfully!" , GetName ( playerid ) ) ;
                format ( Str2 , 128 , ""#COLOR_RED"» "#COLOR_DARKBLUE"Thank you "#COLOR_WHITE"for registration! You may proceed by selecting your skin and spawn" ) ;
                format ( Str3 , 128 , ""#COLOR_RED"» "#COLOR_WHITE"%s just regitered their account on the server! "#COLOR_HIGHGREEN"We "COLOR_WHITE"welcome %s behalf of all our members" , GetName ( playerid ) , GetName ( playerid ) ) ;
                SendClientMessage ( playerid , -1 , Str ) ;
                SendClientMessage ( playerid , -1 , Str2 ) ;
                SendClientMessageToAll ( -1 , Str3 ) ;
            }
        }
Reply
#3

If Firecat's code doesn't work try.

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch( 
dialogid )
    {
        case 
DIALOG_REG:
        {
            if (!
response)
            {
                new 
Str 128 ] , Str2 128 ] ;
                
format Str 128 ""#COLOR_RED"» "#COLOR_WHITE"You need to "#COLOR_HIGHGREEN"register "#COLOR_WHITE"on this server in order to play." ) ;
                
format Str2 128 ""#COLOR_RED"» "#COLOR_WHITE"You have been "#COLOR_RED"KICKED "#COLOR_WHITE"as registration is compulsary." ) ;
                
SendClientMessage playerid , -Str ) ;
                
SendClientMessage playerid , -Str2 ) ;
                
Kick playerid ) ;
            }
            else if (
response)
            {
                
PlayerRegister playerid inputtext ) ;
                new 
Str 128 ] , Str2 128 ] , Str3 128 ] ;
                
format Str 128 ""#COLOR_RED"» "#COLOR_WHITE"Account : "#COLOR_RED"%s "#COLOR_WHITE"has been registered "COLOR_HIGHGREEN"successfully!" , GetName ( playerid ) ) ;
                
format Str2 128 ""#COLOR_RED"» "#COLOR_DARKBLUE"Thank you "#COLOR_WHITE"for registration! You may proceed by selecting your skin and spawn" ) ;
                
format Str3 128 ""#COLOR_RED"» "#COLOR_WHITE"%s just regitered their account on the server! "#COLOR_HIGHGREEN"We "COLOR_WHITE"welcome %s behalf of all our members" , GetName ( playerid ) , GetName ( playerid ) ) ;
                
SendClientMessage playerid , -Str ) ;
                
SendClientMessage playerid , -Str2 ) ;
                
SendClientMessageToAll ( -Str3 ) ;
            }
        } 
Reply
#4

Quote:
Originally Posted by FireCat
Посмотреть сообщение
Try this:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_REG:
        {
            if (!response)
            {
                new Str [ 128 ] , Str2 [ 128 ] ;
                format ( Str , 128 , ""#COLOR_RED"» "#COLOR_WHITE"You need to "#COLOR_HIGHGREEN"register "#COLOR_WHITE"on this server in order to play." ) ;
                format ( Str2 , 128 , ""#COLOR_RED"» "#COLOR_WHITE"You have been "#COLOR_RED"KICKED "#COLOR_WHITE"as registration is compulsary." ) ;
                SendClientMessage ( playerid , -1 , Str ) ;
                SendClientMessage ( playerid , -1 , Str2 ) ;
                Kick ( playerid ) ;
                return 1;
            }
            else
            {
                PlayerRegister ( playerid , inputtext ) ;
                new Str [ 128 ] , Str2 [ 128 ] , Str3 [ 128 ] ;
                format ( Str , 128 , ""#COLOR_RED"» "#COLOR_WHITE"Account : "#COLOR_RED"%s "#COLOR_WHITE"has been registered "COLOR_HIGHGREEN"successfully!" , GetName ( playerid ) ) ;
                format ( Str2 , 128 , ""#COLOR_RED"» "#COLOR_DARKBLUE"Thank you "#COLOR_WHITE"for registration! You may proceed by selecting your skin and spawn" ) ;
                format ( Str3 , 128 , ""#COLOR_RED"» "#COLOR_WHITE"%s just regitered their account on the server! "#COLOR_HIGHGREEN"We "COLOR_WHITE"welcome %s behalf of all our members" , GetName ( playerid ) , GetName ( playerid ) ) ;
                SendClientMessage ( playerid , -1 , Str ) ;
                SendClientMessage ( playerid , -1 , Str2 ) ;
                SendClientMessageToAll ( -1 , Str3 ) ;
            }
        }
Quote:
Originally Posted by Alexis1999
Посмотреть сообщение
If Firecat's code doesn't work try.

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch( 
dialogid )
    {
        case 
DIALOG_REG:
        {
            if (!
response)
            {
                new 
Str 128 ] , Str2 128 ] ;
                
format Str 128 ""#COLOR_RED"» "#COLOR_WHITE"You need to "#COLOR_HIGHGREEN"register "#COLOR_WHITE"on this server in order to play." ) ;
                
format Str2 128 ""#COLOR_RED"» "#COLOR_WHITE"You have been "#COLOR_RED"KICKED "#COLOR_WHITE"as registration is compulsary." ) ;
                
SendClientMessage playerid , -Str ) ;
                
SendClientMessage playerid , -Str2 ) ;
                
Kick playerid ) ;
            }
            else if (
response)
            {
                
PlayerRegister playerid inputtext ) ;
                new 
Str 128 ] , Str2 128 ] , Str3 128 ] ;
                
format Str 128 ""#COLOR_RED"» "#COLOR_WHITE"Account : "#COLOR_RED"%s "#COLOR_WHITE"has been registered "COLOR_HIGHGREEN"successfully!" , GetName ( playerid ) ) ;
                
format Str2 128 ""#COLOR_RED"» "#COLOR_DARKBLUE"Thank you "#COLOR_WHITE"for registration! You may proceed by selecting your skin and spawn" ) ;
                
format Str3 128 ""#COLOR_RED"» "#COLOR_WHITE"%s just regitered their account on the server! "#COLOR_HIGHGREEN"We "COLOR_WHITE"welcome %s behalf of all our members" , GetName ( playerid ) , GetName ( playerid ) ) ;
                
SendClientMessage playerid , -Str ) ;
                
SendClientMessage playerid , -Str2 ) ;
                
SendClientMessageToAll ( -Str3 ) ;
            }
        } 
How the hell is possible D:

Both code's doesn't seems to be working :/




My whole OnDialogResponse callback:

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_REG:
        {
            if (!response)
            {
                new Str [ 128 ] , Str2 [ 128 ] ;
                format ( Str , 128 , ""#COLOR_RED"» "#COLOR_WHITE"You need to "#COLOR_HIGHGREEN"register "#COLOR_WHITE"on this server in order to play." ) ;
                format ( Str2 , 128 , ""#COLOR_RED"» "#COLOR_WHITE"You have been "#COLOR_RED"KICKED "#COLOR_WHITE"as registration is compulsary." ) ;
                SendClientMessage ( playerid , -1 , Str ) ;
                SendClientMessage ( playerid , -1 , Str2 ) ;
                Kick ( playerid ) ;
            }
            else if (response)
            {
                PlayerRegister ( playerid , inputtext ) ;
                new Str [ 128 ] , Str2 [ 128 ] , Str3 [ 128 ] ;
                format ( Str , 128 , ""#COLOR_RED"» "#COLOR_WHITE"Account : "#COLOR_RED"%s "#COLOR_WHITE"has been registered "COLOR_HIGHGREEN"successfully!" , GetName ( playerid ) ) ;
                format ( Str2 , 128 , ""#COLOR_RED"» "#COLOR_DARKBLUE"Thank you "#COLOR_WHITE"for registration! You may proceed by selecting your skin and spawn" ) ;
                format ( Str3 , 128 , ""#COLOR_RED"» "#COLOR_WHITE"%s just regitered their account on the server! "#COLOR_HIGHGREEN"We "COLOR_WHITE"welcome %s behalf of all our members" , GetName ( playerid ) , GetName ( playerid ) ) ;
                SendClientMessage ( playerid , -1 , Str ) ;
                SendClientMessage ( playerid , -1 , Str2 ) ;
                SendClientMessageToAll ( -1 , Str3 ) ;
            }
        }
        case DIALOG_LOG:
        {
            if ( !response ) return Kick ( playerid );
            if ( response )
            {
                if ( strlen ( inputtext ) >= 4 && strlen ( inputtext ) <= 35 )
                {
                    PlayerLogin ( playerid , inputtext ) ;
                    PTimer [ playerid ] = SetTimerEx ( "PlayTime" , 1000 , 1 , "i" , playerid ) ;
                }
                else
                {
                    ShowPlayerDialog ( playerid , DIALOG_LOG , DIALOG_STYLE_INPUT , "{FF0000}Password Incorrent {FFFFFF}- {80FF00}Login" , "{FFFFFF}The password enetered was {FF0000}incorrect\n{FFFFFF}Type your password again to login:" , "Login" , "Leave" ) ;
                }
                return 1;
            }
        }
    }
    return 1;
}
Reply
#5

Both of your codes (above) don't make any sense. If response is 0, then it is 0 and nothing else. The other code block is never called. There is nothing wrong with the original structure the OP posted.

The file is probably created when connecting.
Reply
#6

Quote:
Originally Posted by Vince
Посмотреть сообщение
Both of your codes (above) don't make any sense. If response is 0, then it is 0 and nothing else. The other code block is never called. There is nothing wrong with the original structure the OP posted.

The file is probably created when connecting.
OnPlayerConnect :

pawn Код:
public OnPlayerConnect(playerid)
{
    new Name [ 35 ] ;
    format ( Name , 35 , UserPath , GetName ( playerid ) ) ;
    if ( fexist ( Name ) )
    {
        INI_ParseFile ( Name , "LoadUser_Data", .bExtra = true, .extra = playerid);
        ShowPlayerDialog ( playerid , DIALOG_LOG , DIALOG_STYLE_INPUT , "{80FF00}Login" , "{FFFFFF}Your account was {80FF00}found {FFFFFF}in our database!\nType your password to login:" , "Login" , "Leave" ) ;
    }
    else
    {
        ShowPlayerDialog ( playerid , DIALOG_REG , DIALOG_STYLE_INPUT , "{0215FB}Register" , "{FFFFFF}Your account does {FF0000}not {FFFFFF}exist in our database!\nType your desired password to create an account:" , "Register" , "Leave" ) ;
    }
    return 1;
}

Mistakes ?
Reply
#7

Strange, are you sure the file isn't already created? Try to debug it, see if PlayerRegister is called after the player is kicked by using prints.
Reply
#8

Quote:
Originally Posted by playbox12
Посмотреть сообщение
Strange, are you sure the file isn't already created? Try to debug it, see if PlayerRegister is called after the player is kicked by using prints.
Ok, This is extremely strange. I tried to debug by using prints under the PlayerRegister stock and even under DialogResponse. But I don't get any print in the rcon window. This is really strange :/
Reply
#9

BUMP!

Anyone ? I am in real need of this.
Reply
#10

Can you show your code with the prints?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)