SA-MP Forums Archive
Please help. onplayerRequestClass clash 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)
+--- Thread: Please help. onplayerRequestClass clash problem.. (/showthread.php?tid=283351)



Please help. onplayerRequestClass clash problem.. - [EDT]AmanSingh123 - 14.09.2011

hey...

..so bassicly when the player is on spawn a box shows.. only for admins, which they have to enter the admin code.. btw im using anti clan fake by staticshock for the admin login box... and the problem i have is that the player can click spawn at the bottom and they just spawn without putting the admin password in....

here is the password box script which is for admin. *by staticshock*
pawn Код:
#include <a_samp>
#define DIALOGCLAN 1000
#define TAGCLAN "[ADM]" // example [ITS]
#define PASSWORDCLAN "xxxxxxxxxxxxxxxxx" //Enter the clan password
#define ROSA                 0xFF66FFAA
#define BLU_CHIARO           0x00BFFFAA

public OnFilterScriptInit()
{
    print("\n------------------------------------------");
    print(" Anti fakeclan system by [ITS]StatickShock");
    print("------------------------------------------\n");
    return 1;
}

public OnPlayerRequestClass(playerid)
{
    new stringa[500];
    new nome[24];
    GetPlayerName(playerid, nome, 24);
    if(strfind(nome, TAGCLAN, true) == 0)
    {
        format(stringa, sizeof(stringa), "{FFFFFF}Welcome {FF4444}%s{FFFFFF}!\nYou must confirm the admin password {FF4444}%s{FFFFFF}.\n{FFFFFF}Enter the admin password and confirm.", nome);
        ShowPlayerDialog(playerid, DIALOGCLAN, DIALOG_STYLE_INPUT, "{33AA33}Admin", stringa, "Confirm", "Exit");
    }
    else
    {
        SendClientMessage(playerid, BLU_CHIARO, "Welcome!");
    }
    return 1;
}


public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{

    {
        new stringa[500];
        if(dialogid == DIALOGCLAN)
        {
            if(response)
            {
                if(!strlen(inputtext))
                {
                    new nome[24];
                    GetPlayerName(playerid, nome, 24);
                    format(stringa, sizeof stringa, "{FF4444}Error:{FFFFFF} Insert a password.\n\n{FFFFFF}Welcome {FF4444}%s{FFFFFF}!\nYou must confirm the Admin password {FF4444}%s{FFFFFF}.\n{FFFFFF}Enter the admin password and confirm.", nome);
                    ShowPlayerDialog(playerid, DIALOGCLAN, DIALOG_STYLE_INPUT, "{33AA33}Account:", stringa, "Confirm", "Exit");
                    return 0;
                }
                if(!strcmp(inputtext, PASSWORDCLAN, false))
                {
                    new nome[24];
                    GetPlayerName(playerid, nome, 24);
                    format(stringa, sizeof(stringa), "** {FFFFFF}%s{00BFFF} has signed in as admin", nome);
                    SendClientMessageToAll(BLU_CHIARO, stringa);
                    SendClientMessage(playerid, BLU_CHIARO, "You have confirmed to be part of the clan!");
                    PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
                    return 1;
                }
                else
                {
                    new nome[24];
                    GetPlayerName(playerid, nome, 24);
                    format(stringa, sizeof(stringa), "** {FFFFFF}%s{00BFFF} has been kicked from the Server. [Reason: {FFFFFF}Failed admin account login{00BFFF}]", nome);
                    SendClientMessageToAll(BLU_CHIARO, stringa);
                    SendClientMessage(playerid, ROSA, "*** {FFFFFF}You have been kicked. Reason: {FF66FF}Failed admin account login{FFFFFF}.");
                    Kick(playerid);
                }
            }
            else if(!response)
            {
                new nome[24];
                GetPlayerName(playerid, nome, 24);
                SendClientMessage(playerid, ROSA, "*** {FFFFFF}You have been kicked. Reason: {FF66FF}Failed admin account login{FFFFFF}.");
                format(stringa, sizeof(stringa), "** {FFFFFF}%s{00BFFF} has been kicked from the Server. [Reason: {FFFFFF}Failed admin account login{00BFFF}]", nome);
                SendClientMessageToAll(BLU_CHIARO, stringa);
                Kick(playerid);
                PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
            }
        }
        return 1;
    }
}

here is onplayerrequestclass..in the gamemode.
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    printf("OnPlayerRequestClass(%d, %d)", playerid, classid);
        SetPlayerPos(playerid, 2096.6812,1884.6293,14);
    SetPlayerCameraPos(playerid, 2104.2590,1880.3660,16);
    SetPlayerCameraLookAt(playerid, 2096.0000,1884.6293,14);
    ApplyAnimation(playerid,"FIGHT_D","FightD_IDLE",4.0,1,1,1,1,0);
    new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    PlayerPlaySound(playerid, 1062, X, Y, Z);
   

    return 1;
}


P.S i cant change the password box thing to onplayerconnect because i have the luxadmin login/register box their and i also cant make it in onplayerspawn because i have a dialog that the player can choose a spawn spot..



and here is a screen of what i mean..



Re: Please help. onplayerRequestClass clash problem.. - =WoR=Varth - 14.09.2011

pawn Код:
if(!strlen(inputtext))
                {
                    new nome[24];
                    GetPlayerName(playerid, nome, 24);
                    format(stringa, sizeof stringa, "{FF4444}Error:{FFFFFF} Insert a password.\n\n{FFFFFF}Welcome {FF4444}%s{FFFFFF}!\nYou must confirm the Admin password {FF4444}%s{FFFFFF}.\n{FFFFFF}Enter the admin password and confirm.", nome);
                    ShowPlayerDialog(playerid, DIALOGCLAN, DIALOG_STYLE_INPUT, "{33AA33}Account:", stringa, "Confirm", "Exit");
                    return 1;
                }



Re: Please help. onplayerRequestClass clash problem.. - [EDT]AmanSingh123 - 14.09.2011

Quote:
Originally Posted by varthshenon
Посмотреть сообщение
pawn Код:
if(!strlen(inputtext))
                {
                    new nome[24];
                    GetPlayerName(playerid, nome, 24);
                    format(stringa, sizeof stringa, "{FF4444}Error:{FFFFFF} Insert a password.\n\n{FFFFFF}Welcome {FF4444}%s{FFFFFF}!\nYou must confirm the Admin password {FF4444}%s{FFFFFF}.\n{FFFFFF}Enter the admin password and confirm.", nome);
                    ShowPlayerDialog(playerid, DIALOGCLAN, DIALOG_STYLE_INPUT, "{33AA33}Account:", stringa, "Confirm", "Exit");
                    return 1;
                }
sorry but where do i put that ^^


Re: Please help. onplayerRequestClass clash problem.. - Jafet_Macario - 14.09.2011

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{

    {
        new stringa[500];
        if(dialogid == DIALOGCLAN)
        {
            if(response)
            {
                if(!strlen(inputtext))
                {
                    new nome[24];
                    GetPlayerName(playerid, nome, 24);
                    format(stringa, sizeof stringa, "{FF4444}Error:{FFFFFF} Insert a password.\n\n{FFFFFF}Welcome {FF4444}%s{FFFFFF}!\nYou must confirm the Admin password {FF4444}%s{FFFFFF}.\n{FFFFFF}Enter the admin password and confirm.", nome);
                    ShowPlayerDialog(playerid, DIALOGCLAN, DIALOG_STYLE_INPUT, "{33AA33}Account:", stringa, "Confirm", "Exit");
                    return 1; // Instead return 0;
                }
                if(!strcmp(inputtext, PASSWORDCLAN, false))
                {
                    new nome[24];
                    GetPlayerName(playerid, nome, 24);
                    format(stringa, sizeof(stringa), "** {FFFFFF}%s{00BFFF} has signed in as admin", nome);
                    SendClientMessageToAll(BLU_CHIARO, stringa);
                    SendClientMessage(playerid, BLU_CHIARO, "You have confirmed to be part of the clan!");
                    PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
                    return 1;
                }
                else
                {
                    new nome[24];
                    GetPlayerName(playerid, nome, 24);
                    format(stringa, sizeof(stringa), "** {FFFFFF}%s{00BFFF} has been kicked from the Server. [Reason: {FFFFFF}Failed admin account login{00BFFF}]", nome);
                    SendClientMessageToAll(BLU_CHIARO, stringa);
                    SendClientMessage(playerid, ROSA, "*** {FFFFFF}You have been kicked. Reason: {FF66FF}Failed admin account login{FFFFFF}.");
                    Kick(playerid);
                }
            }
            else if(!response)
            {
                new nome[24];
                GetPlayerName(playerid, nome, 24);
                SendClientMessage(playerid, ROSA, "*** {FFFFFF}You have been kicked. Reason: {FF66FF}Failed admin account login{FFFFFF}.");
                format(stringa, sizeof(stringa), "** {FFFFFF}%s{00BFFF} has been kicked from the Server. [Reason: {FFFFFF}Failed admin account login{00BFFF}]", nome);
                SendClientMessageToAll(BLU_CHIARO, stringa);
                Kick(playerid);
                PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
            }
        }
        return 1;
    }
}



Re: Please help. onplayerRequestClass clash problem.. - =WoR=Varth - 14.09.2011

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{

    {
        new stringa[500];
        if(dialogid == DIALOGCLAN)
        {
            if(response)
            {
                if(!strlen(inputtext))
                {
                    new nome[24];
                    GetPlayerName(playerid, nome, 24);
                    format(stringa, sizeof stringa, "{FF4444}Error:{FFFFFF} Insert a password.\n\n{FFFFFF}Welcome {FF4444}%s{FFFFFF}!\nYou must confirm the Admin password {FF4444}%s{FFFFFF}.\n{FFFFFF}Enter the admin password and confirm.", nome);
                    ShowPlayerDialog(playerid, DIALOGCLAN, DIALOG_STYLE_INPUT, "{33AA33}Account:", stringa, "Confirm", "Exit");
                    return 1;
                }
                if(!strcmp(inputtext, PASSWORDCLAN, false))
                {
                    new nome[24];
                    GetPlayerName(playerid, nome, 24);
                    format(stringa, sizeof(stringa), "** {FFFFFF}%s{00BFFF} has signed in as admin", nome);
                    SendClientMessageToAll(BLU_CHIARO, stringa);
                    SendClientMessage(playerid, BLU_CHIARO, "You have confirmed to be part of the clan!");
                    PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
                    return 1;
                }
                else
                {
                    new nome[24];
                    GetPlayerName(playerid, nome, 24);
                    format(stringa, sizeof(stringa), "** {FFFFFF}%s{00BFFF} has been kicked from the Server. [Reason: {FFFFFF}Failed admin account login{00BFFF}]", nome);
                    SendClientMessageToAll(BLU_CHIARO, stringa);
                    SendClientMessage(playerid, ROSA, "*** {FFFFFF}You have been kicked. Reason: {FF66FF}Failed admin account login{FFFFFF}.");
                    Kick(playerid);
                    return 1;
                }
            }
            else if(!response)
            {
                new nome[24];
                GetPlayerName(playerid, nome, 24);
                SendClientMessage(playerid, ROSA, "*** {FFFFFF}You have been kicked. Reason: {FF66FF}Failed admin account login{FFFFFF}.");
                format(stringa, sizeof(stringa), "** {FFFFFF}%s{00BFFF} has been kicked from the Server. [Reason: {FFFFFF}Failed admin account login{00BFFF}]", nome);
                SendClientMessageToAll(BLU_CHIARO, stringa);
                Kick(playerid);
                PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
                return 1;
            }
        }
    }
    return 0;
}



Re: Please help. onplayerRequestClass clash problem.. - [EDT]AmanSingh123 - 14.09.2011

hmm, same problem... the spawn and arrow buttons still apear :S is their something i need to change in my gamemode too??