team password problem
#1

pawn Code:
if(!strcmp(cmdtext, "/stars", true))
    {
    ShowPlayerDialog(playerid, JOINSTARS, DIALOG_STYLE_INPUT, "Please enter the password to join S.T.A.R.S.", "Password:", "Submit", "Cancel");
    HideMenuForPlayer(mainmenu,playerid);
    }
    if(!strcmp(cmdtext, "/uc", true))
    {
    ShowPlayerDialog(playerid, JOINUC, DIALOG_STYLE_INPUT, "Please enter the password to join UC.", "Password:", "Submit", "Cancel");
    HideMenuForPlayer(mainmenu,playerid);
    }
    return 1;
}



pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
    {
    if(dialogid == JOINSTARS)
        {
        if(response)
        {
            if(!strcmp(inputtext, "starspass", true))
            {
                team[playerid] = 6;
                ShowPlayerDialog(playerid, JOINSTARS, DIALOG_STYLE_INPUT, "Please enter the password to join S.T.A.R.S.", "Password:", "Submit", "Cancel");
                SendClientMessage(playerid,GREEN,"You may now spawn.");
                SetPlayerColor(playerid,GREEN);
                SetPlayerTeam(playerid, 1);
                SetPlayerPos(playerid,1624.2527,1821.0498,10.8203) ;
                SetPlayerFacingAngle(playerid,5.6779);
                GivePlayerWeapon(playerid,31,300);
                GivePlayerWeapon(playerid,24,300);
                GivePlayerMoney(playerid, 20000);
                SetPlayerInterior(playerid,0);
                SetPlayerArmour(playerid, 100);
            }
        }
        else SendClientMessage(playerid, 0xff0000FF,"Cancelled");
    }
    if(dialogid == JOINUC)
        {
        if(response)
        {
            if(!strcmp(inputtext, "ucpass", true))
            {
                team[playerid] = 7;
                ShowPlayerDialog(playerid, JOINUC, DIALOG_STYLE_INPUT, "Please enter the password to join UC.", "Password:", "Submit", "Cancel");
                SendClientMessage(playerid,GREEN,"You may now spawn.");
                SetPlayerColor(playerid,TAN);
                SetPlayerTeam(playerid, 1);
                SetPlayerFacingAngle(playerid,5.6779);
                GivePlayerWeapon(playerid,31,300);
                GivePlayerWeapon(playerid,24,300);
                GivePlayerMoney(playerid, 20000);
                SetPlayerInterior(playerid,0);
                SetPlayerArmour(playerid, 100);
            }
        }
        else SendClientMessage(playerid, 0xff0000FF,"Cancelled");
    }
    return 1;
}


but when the players use /stars or /uc and click submit (without entering the password) it put him on the team. What's wrong ?
Reply
#2

Can I bump this yet ?
Reply
#3

pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == JOINSTARS)
        {
        if(response)
        {
            if(!strlen(inputtext)) return ShowPlayerDialog(playerid, JOINSTARS, DIALOG_STYLE_INPUT, "Please enter the password to join S.T.A.R.S.", "Password:", "Submit", "Cancel");
            if(!strcmp(inputtext, "starspass", true))
            {
                team[playerid] = 6;
                ShowPlayerDialog(playerid, JOINSTARS, DIALOG_STYLE_INPUT, "Please enter the password to join S.T.A.R.S.", "Password:", "Submit", "Cancel");
                SendClientMessage(playerid,GREEN,"You may now spawn.");
                SetPlayerColor(playerid,GREEN);
                SetPlayerTeam(playerid, 1);
                SetPlayerPos(playerid,1624.2527,1821.0498,10.8203) ;
                SetPlayerFacingAngle(playerid,5.6779);
                GivePlayerWeapon(playerid,31,300);
                GivePlayerWeapon(playerid,24,300);
                GivePlayerMoney(playerid, 20000);
                SetPlayerInterior(playerid,0);
                SetPlayerArmour(playerid, 100);
            }
        }
        else SendClientMessage(playerid, 0xff0000FF,"Cancelled");
    }
    if(dialogid == JOINUC)
        {
        if(response)
        {
            if(!strlen(inputtext)) return ShowPlayerDialog(playerid, JOINUC, DIALOG_STYLE_INPUT, "Please enter the password to join UC.", "Password:", "Submit", "Cancel");
            if(!strcmp(inputtext, "ucpass", true))
            {
                team[playerid] = 7;
                ShowPlayerDialog(playerid, JOINUC, DIALOG_STYLE_INPUT, "Please enter the password to join UC.", "Password:", "Submit", "Cancel");
                SendClientMessage(playerid,GREEN,"You may now spawn.");
                SetPlayerColor(playerid,TAN);
                SetPlayerTeam(playerid, 1);
                SetPlayerFacingAngle(playerid,5.6779);
                GivePlayerWeapon(playerid,31,300);
                GivePlayerWeapon(playerid,24,300);
                GivePlayerMoney(playerid, 20000);
                SetPlayerInterior(playerid,0);
                SetPlayerArmour(playerid, 100);
            }
        }
        else SendClientMessage(playerid, 0xff0000FF,"Cancelled");
    }
    return 1;
}
You have to use strlen to check the string lenght, and if it's 0, you re-send the dialog.
Reply
#4

will it work if he types a wrong password too ?
Reply
#5

I don't know, I only helped you on the problem that you posted, just try it out and stop asking before trying.

This forum requires that you wait 120 seconds between posts. Please try again in 35 seconds.

Lame.
Reply
#6

I just tried and it works bro, thx

Code:
This forum requires that you wait 120 seconds between posts. Please try again in 54 seconds.
this is getting annoying
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)