SA-MP Forums Archive
need two helps - 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)
+--- Thread: need two helps (/showthread.php?tid=361763)



need two helps - Pro_Scriptor - 22.07.2012

i need dialog login system but right now my server has /login command and i dont know how to change it to dialog
pawn Код:
dcmd_login(playerid, cmdtext[]) {
    #pragma unused cmdtext
    new idx, tmp[256];
    if(IsPlayerConnected(playerid))
    {
       new tmppass[64];
       if(PlayerInfo[ playerid ][ pLogged ] == 1) return SendClientMessage(playerid, COLOR_FINALSCORE, "-NRS- You are already logged in.");

       tmp = strtok(cmdtext, idx);
       if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "-NRS- USAGE: /login (password)");

       strmid(tmppass, tmp, 0, strlen(cmdtext), 255);
       Encrypt(tmppass);
       OnPlayerLogin(playerid,tmppass);
    }
    return 1;
}
and one more thing is i need /admins command
these are the players info
PHP код:
PlayerInfo[playerid][ pAdmin ] >=lvl#) { 
pawn Код:
PlayerInfo[playerid][ pCheckpoint ]=0;
    PlayerInfo[playerid][ pLogged ]=0;
    PlayerInfo[playerid][ plTMoney ]=0;
    PlayerInfo[playerid][ plSMoney ]=0;
    PlayerInfo[playerid][ pPlayingAGame ]=0;
    PlayerInfo[playerid][ pPlayerVehicles ]=0;
    PlayerInfo[playerid][ pClassID ]=0;
    PlayerInfo[playerid][ pShowPM ]=0;
    PlayerInfo[playerid][ pShowTPM ]=0;
    PlayerInfo[playerid][ pCanUseCommands ]=1;
    PlayerInfo[playerid][ pOnDuty ]=0;
    PlayerInfo[playerid][ pSpawned ]=0;
    PlayerInfo[playerid][ pAdmin ]=0;
    PlayerInfo[playerid][ pChallengingMessage ]=0;
    PlayerInfo[playerid][ pBike ]=0;
    PlayerInfo[playerid][ pTheKiller ]=0;
    PlayerInfo[playerid][ pMuted ]=0;
    PlayerInfo[playerid][ pKills ]=0;
    PlayerInfo[playerid][ pDeaths ]=0;



Re: need two helps - Kindred - 22.07.2012

pawn Код:
CMD:admins(playerid, params[])
{
    if(!IsPlayerConnected(playerid)) return 1;
    new string[128], name[24];
    SendClientMessage(playerid, -1, "-------------[Admins]-------------");
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(PlayerInfo[i][pAdmin] >= 1)
        {
            format(string, sizeof(string), "%s (ID: %i) - Admin Level %i", GetPlayerName(i, name, sizeof(name)), i, PlayerInfo[i][Admin]);
            SendClientMessage(playerid, -1, string); //Change -1 to the color code or color define you have, unless you want it to be a random color.
        }
    }
    SendClientMessage(playerid, -1, "----------------------------------");
    return 1;
}
Admin command ^, will display something like this:

-------------[Admins]-------------
Name (ID: 0) - Admin Level 1
----------------------------------

Will edit with the other thing you needed.

EDIT: Here for the login dialog:

pawn Код:
ShowPlayerDialog(playerid, 666, DIALOG_STYLE_INPUT, "Login", "Please type in your desired password below!", "Continue", "Cancel");

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case 666:
        {
            if(!response) return Kick(playerid);
            new inputpass[64];
            inputpass = inputtext;
            Encrypt(inputpass);
            OnPlayerLogin(playerid,inputpass);
        }
    }
    return 0;
}
Change 666 to an available dialog id you want to use. You can also define a dialog id like so:

pawn Код:
#define DIALOG_LOGIN 666
This will make it so instead of 666, you can type in DIALOG_LOGIN, so it's easier to remember.

PS: I lol'ed at your name, apparent "Pro_Scriptar" of which cannot create a simple login dialog.


Re: need two helps - Pro_Scriptor - 22.07.2012

thnx but admin cmd did not work
D:\Drivers\unused\XTREME~1\GAMEMO~1\LSTWSE.pwn(475 4) : warning 203: symbol is never used: "dcmd_admins"


Re: need two helps - [MM]RoXoR[FS] - 22.07.2012

Quote:
Originally Posted by Pro_Scriptor
Посмотреть сообщение
thnx but admin cmd did not work
D:\Drivers\unused\XTREME~1\GAMEMO~1\LSTWSE.pwn(475 4) : warning 203: symbol is never used: "dcmd_admins"
/admins is made on ZCMD, so add
#include <ZCMD> , it is faster than dcmd.


Re: need two helps - Pro_Scriptor - 23.07.2012

admin cmd + login system did not work but i made this admin cmd
pawn Код:
dcmd_admins(playerid, cmdtext[]) {
        new strtext[1000];
        if(IsPlayerConnected(playerid))
        {
            SendClientMessage(playerid, COLOR_GREEN, ".::Admins OnLine::.");
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(PlayerInfo[playerid][ pAdmin ] >= 1)
                    {
                        GetPlayerName(i, playern, sizeof(playern));
                        format(string, 128, "*[Junior Admin] %s [ID: %d]", playern, i);//, i, PlayerInfo[i][pAdmin]
                        //SendClientMessage(playerid, 0x99CCCCAA, string)
                    }
                    if(PlayerInfo[playerid][ pAdmin ] >= 2)
                    {
                        GetPlayerName(i, playern, sizeof(playern));
                        format(string, 128, "*[General Admin] %s [ID: %d]", playern, i);//, i, PlayerInfo[i][pAdmin]
                        //SendClientMessage(playerid, 0x99FFCCAA, string);
                    }
                    if(PlayerInfo[playerid][ pAdmin ] >= 3)
                    {
                        GetPlayerName(i, playern, sizeof(playern));
                        format(string, 128, "*[Senior Admin] %s [ID: %d]", playern, i);//, i, PlayerInfo[i][pAdmin]
                        //SendClientMessage(playerid, 0x99FFCCAA, string);
                    }
                    if(PlayerInfo[playerid][ pAdmin ] >= 4)
                    {
                        GetPlayerName(i, playern, sizeof(playern));
                        format(string, 128, "*[Head Admin] %s [ID: %d]", playern, i);//, i, PlayerInfo[i][pAdmin]
                        //SendClientMessage(playerid, 0x008D04FF, string);
                    }
                    if(PlayerInfo[playerid][ pAdmin ] >= 5)
                    {
                        GetPlayerName(i, playern, sizeof(playern));
                        format(string, 128, "*[[Server Manager] %s [ID: %d]", playern, i);//, i, PlayerInfo[i][pAdmin]
                        //SendClientMessage(playerid, 0x006CA2FF, string);
                    }
                    if(PlayerInfo[i][pAdmin] == 6)
                    {
                        GetPlayerName(i, playern, sizeof(playern));
                        format(string, 128, "*[Co-Executive Admin] %s [ID: %d]", playern, i);//, i, PlayerInfo[i][pAdmin]
                        //SendClientMessage(playerid, 0x006CA2FF, string);
                    }
                    if(PlayerInfo[playerid][ pAdmin ] >= 7)
                    {
                        GetPlayerName(i, playern, sizeof(playern));
                        format(string, 128, "*[Executive Admin] %s [ID: %d]", playern, i);//, i, PlayerInfo[i][pAdmin]
                        //SendClientMessage(playerid, 0x794040FF, string);
                    }
                    strcat(string, "\n");
                    strcat(strtext, string);
                }
            }
            ShowPlayerDialog(playerid, 0xF, DIALOG_STYLE_MSGBOX,"~ Admins ~", strtext, "Ok",#);
        }
        return 1;
    }
Код:
D:\Drivers\unused\XTREME~1\GAMEMO~1\LSTWSE.pwn(1754) : error 017: undefined symbol "playern"
D:\Drivers\unused\XTREME~1\GAMEMO~1\LSTWSE.pwn(1754) : error 017: undefined symbol "playern"
D:\Drivers\unused\XTREME~1\GAMEMO~1\LSTWSE.pwn(1754) : error 029: invalid expression, assumed zero
D:\Drivers\unused\XTREME~1\GAMEMO~1\LSTWSE.pwn(1754) : fatal error 107: too many error messages on one line
line 1754= GetPlayerName(i, playern, sizeof(playern));