[Help] Dialogs doesn't respone for me.
#6

try this one
pawn Код:
public OnDialogResponse(playerid,dialogid,response,listitem,inputtext[])
{
   
    if(dialogid == DIALOG_REGISTER)
    {
        GetPlayerIp(playerid,pIP[playerid],16);
        if(!response) Kick(playerid);
        if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register","Please enter a password.","Register","Leave");
        new INI:iFile = INI_Open(PlayerPath(playerid)); //Making the INI file and writing settings
        INI_SetTag(iFile,"data");
        INI_WriteInt(iFile,"Pass",udb_hash(inputtext));
        #if defined AUTOLOGIN
            INI_WriteString(iFile,"IP",pIP[playerid]);
        #endif
        INI_WriteInt(iFile,"Cash",0);
        INI_WriteInt(iFile,"Score",0);
        INI_Close(iFile);
        pLogged[playerid] = 1;
        new iStr[128];
        format(iStr,sizeof(iStr),"You've successfully registered with the password \"%s\".",inputtext);
        SendClientMessage(playerid,yellow,iStr);
        return 1;
    }

    if(dialogid == DIALOG_LOGIN)
    {
        if(!response) Kick(playerid);
        new iStr[128],gTries;
        if(gTries == 0) gTries = 1;
        if(gTries == 3)
        { // 3 tries = kick
            new pName[30];
            GetPlayerName(playerid,pName,sizeof(pName));
            format(iStr,sizeof(iStr),"%s has been kicked for exceeding login tries.",pName);
            SendClientMessageToAll(red,iStr);
            return Kick(playerid);
        }
        if(!strlen(inputtext))
    {
            format(iStr,sizeof(iStr),"Please enter your password. Tries: %i/3",gTries);
            return ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login",iStr,"Login","Leave");
        }
        if(udb_hash(inputtext) == pInfo[playerid][Pass])
    {
            pLogged[playerid] = 1;
            SendClientMessage(playerid,lime,"You've successfully logged in.");
            SetPlayerScore(playerid,pInfo[playerid][Score]); //Loading player score
            GivePlayerMoney(playerid,pInfo[playerid][Cash]); //Loading player money
        }
    else
    {
            format(iStr,sizeof(iStr),"Incorrect password. Tries: %i/3",gTries);
            ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register",iStr,"Login","Leave");
            gTries++;
            return 1;
        }
    }
       
    if(dialogid == Msg_Dialog)
    {
        if(!response) return 0;
        new string[128];
        if(!strlen(inputtext)) return SendClientMessage(playerid,0xff0000ff,"You must to type a Message!");
        if(!dini_Exists(MsgFile()))
        {
            dini_Create(MsgFile());
        }
        dini_Set(MsgFile(),"MSG",inputtext);
        format(string,128,"Server message edited to : %s",inputtext);
        SendClientMessage(playerid,0xffffffff,string);
        return 1;
    }


    if(dialogid == DEIALOG_ID)
    {
        if(!response) return 1;
        if(listitem == sizeof(radiolist)) return OnPlayerCommandText(playerid,"/radio");
        if(listitem == sizeof(radiolist)+1) return StopAudioStreamForPlayer(playerid),Radio[playerid] = false;
        StopAudioStreamForPlayer(playerid);
        PlayAudioStreamForPlayer(playerid,radiolist[listitem][0]);
        new str[50]; format(str,50,"Now listening to \"%s\"...",radiolist[listitem][1]);
        SendClientMessage(playerid,0x33CCFFAA,str);
        SendClientMessage(playerid,0xFFFFFFAA,"Stop listening: /MOFF");
        Radio[playerid] = true;
        return 1;

    }
    return 0;
}
edit: ah, the indentation is fucked.
Reply


Messages In This Thread
[Help] Dialogs doesn't respone for me. - by Firo - 19.05.2012, 14:41
Re: [Help] Dialogs doesn't respone for me. - by MP2 - 19.05.2012, 14:55
Re: [Help] Dialogs doesn't respone for me. - by Firo - 19.05.2012, 15:03
Re: [Help] Dialogs doesn't respone for me. - by MP2 - 19.05.2012, 15:04
Re: [Help] Dialogs doesn't respone for me. - by Firo - 19.05.2012, 15:07
Re: [Help] Dialogs doesn't respone for me. - by emokidx - 19.05.2012, 15:29
Re: [Help] Dialogs doesn't respone for me. - by Firo - 19.05.2012, 16:32

Forum Jump:


Users browsing this thread: 3 Guest(s)