SA-MP Forums Archive
team password problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: team password problem (/showthread.php?tid=191079)



team password problem - marinov - 17.11.2010

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 ?


Re: team password problem - marinov - 17.11.2010

Can I bump this yet ?


Re: team password problem - The_Moddler - 17.11.2010

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.


Re: team password problem - marinov - 17.11.2010

will it work if he types a wrong password too ?


Re: team password problem - The_Moddler - 17.11.2010

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.


Re: team password problem - marinov - 17.11.2010

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