Ayuda con un dialogo
#1

hola chicos espero que me peudan ayudar estoy haciendo unos comandos con dialogs pero algunos no me sirven :C
nose porque alguien me puede ayudar?
tengo problemas con las llaves y el orden de los dialogos :S
eso es molesto y cansado pero tengo que hacerlo
aqui los dialogos
pawn Код:
if(dialogid == 67)
{
    if(!response)
        return 1;
    switch(listitem)
    {
        case 0:
        {
            if(GetPlayerMoney(playerid) < 100)
                return SendClientMessage(playerid, 0, "you have not enought money to buy this weapon");
            GivePlayerMoney(playerid, -100);
            GivePlayerWeapon(playerid, 4, 1);
        }
        case 1:
        {
            if(GetPlayerMoney(playerid) < 120)
                return SendClientMessage(playerid, 0, "you have not enought money to buy this weapon");
            GivePlayerMoney(playerid, -120);
            GivePlayerWeapon(playerid, 22, 120);
        }
        case 4:
        {
            if(GetPlayerMoney(playerid) < 250)
                return SendClientMessage(playerid, 0, "you have not enought money to buy this weapon");
            GivePlayerMoney(playerid, -250);
            GivePlayerWeapon(playerid, 24, 150);
        }
        case 5:
        {
            if(GetPlayerMoney(playerid) < 200)
                return SendClientMessage(playerid, 0, "you have not enought money to buy this weapon");
            GivePlayerMoney(playerid, -200);
            GivePlayerWeapon(playerid, 23, 130);
        }
        case 6:
        {
            if(GetPlayerMoney(playerid) < 400)
                return SendClientMessage(playerid, 0, "you have not enought money to buy this weapon");
            GivePlayerMoney(playerid, -400);
            GivePlayerWeapon(playerid, 32, 200);
        }
        case 7:
        {
            if(GetPlayerMoney(playerid) < 450)
                return SendClientMessage(playerid, 0, "you have not enought money to buy this weapon");
            GivePlayerMoney(playerid, -450);
            GivePlayerWeapon(playerid, 28, 200);
        }
        case 8:
        {
            if(GetPlayerMoney(playerid) < 500)
                return SendClientMessage(playerid, 0, "you have not enought money to buy this weapon");
            GivePlayerMoney(playerid, -500);
            GivePlayerWeapon(playerid, 29, 300);
        }
        case 9:
        {
            if(GetPlayerMoney(playerid) < 650)
                return SendClientMessage(playerid, 0, "you have not enought money to buy this weapon");
            GivePlayerMoney(playerid, -650);
            GivePlayerWeapon(playerid, 30, 200);
        }
        case 10:
        {
            if(GetPlayerMoney(playerid) < 650)
                return SendClientMessage(playerid, 0, "you have not enought money to buy this weapon");
            GivePlayerMoney(playerid, -650);
            GivePlayerWeapon(playerid, 31, 200);
        }
        case 11:
        {
            if(GetPlayerMoney(playerid) < 200)
                return SendClientMessage(playerid, 0, "you have not enought money to buy this weapon");
            GivePlayerMoney(playerid, -200);
            GivePlayerWeapon(playerid, 26, 80);
        }
    }
}


if(dialogid == 8800)
{
    if(!response) return SendClientMessage(playerid, COLOR_red," you canceled this dialog");
    {
        if(response)
        {
            switch(listitem)
            {
                case 0:
                {
                    SetPlayerInterior(playerid, 0);
                    SetPlayerPos(playerid,1642.3022,-2333.6287,13.5469);
                    GivePlayerMoney(playerid, -5000);
                    SendClientMessage(playerid, COLOR_red2, "now attack him !!!!!! this is sparta !! :D! have fun");
                }
                case 1:
                {
                    SetPlayerInterior(playerid, 0);
                    SetPlayerPos(playerid,1642.3022,-2333.6287,13.5469);
                    GivePlayerMoney(playerid, -5000);
                    SendClientMessage(playerid, COLOR_red2, "now attack him !!!!!! this is sparta !! :D! have fun");
                }
                case 2:
                {
                    SetPlayerInterior(playerid, 0);
                    SetPlayerPos(playerid,1642.3022,-2333.6287,13.5469);
                    GivePlayerMoney(playerid, -5000);
                    SendClientMessage(playerid, COLOR_red2, "now attack him !!!!!! this is sparta !! :D! have fun");
                }
                case 3:
                {
                    SetPlayerInterior(playerid, 0);
                    SetPlayerPos(playerid,1642.3022,-2333.6287,13.5469);
                    GivePlayerMoney(playerid, -5000);
                    SendClientMessage(playerid, COLOR_red2, "now attack him !!!!!! this is sparta !! :D! have fun");
                }
                case 4:
                {
                    SetPlayerInterior(playerid, 0);
                    SetPlayerPos(playerid,1642.3022,-2333.6287,13.5469);
                    GivePlayerMoney(playerid, -5000);
                    SendClientMessage(playerid, COLOR_red2, "now attack him !!!!!! this is sparta !! :D! have fun");
                }
            }
        }
    }
}
aqui estan dos juntos
no retorna a un valor porque no es el ultimo verdad?
osea tengo mas debajos de ellos
estos no me funcionan y nose porque :C
aqui les dejo el cmd de cada uno
pawn Код:
CMD:wshop(playerid, params[])
{
    ShowPlayerDialog(playerid, 67, DIALOG_STYLE_LIST, "Weapon Shop", "Knife\nPistol Colt 45\nDesert Eagle\nSilenced pistol\nTec-9\nMicro SMG\nMP5\nAk-47\nm4\nsawn off", "accept", "cancel");
    return 1;
}
el otro
pawn Код:
CMD:baseattack(playerid, params[])
 {
  if(gPlayerClass[playerid] != Soldado) return SendClientMessage(playerid, COLOR_red, " you cant use this command, only soldados can use it");
  ShowPlayerDialog(playerid, 8800, DIALOG_STYLE_LIST, "Choose a TEAM", "\nECUADOR Team\nCOLOMBIA Team\nBRAZIL Team\nARGENTINA Team\nMEXICO Team\n","Choose","Cancel");
  return 1;
 }
estoy haciendo un servidor TDM avanzado con algunas cositas
espero recibir buena ayuda gracias de ante mano C:
-RafaelZam
Reply
#2

No entendн nada, lo sй, soy algo tonto

Lo ъnico que puedo decir es que en el switch del dialogid 87 pasaste de 1 a 4 en los cases.


pawn Код:
if(dialogid == 67)
{
    if(!response) return SendClientMessage(playerid, -1, "You've cancelled the weapon shop dialog.");
    switch(listitem)
    {
        case 0:
        {
            if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid, 0, "You don't have enough money to purchase this weapon.");
            GivePlayerMoney(playerid, -100);
            GivePlayerWeapon(playerid, 4, 1);
        }
        case 1:
        {
            if(GetPlayerMoney(playerid) < 120) return SendClientMessage(playerid, 0, "You don't have enough money to purchase this weapon.");
            GivePlayerMoney(playerid, -120);
            GivePlayerWeapon(playerid, 22, 120);
        }
        case 2:
        {
            if(GetPlayerMoney(playerid) < 250) return SendClientMessage(playerid, 0, "You don't have enough money to purchase this weapon.");
            GivePlayerMoney(playerid, -250);
            GivePlayerWeapon(playerid, 24, 150);
        }
        case 3:
        {
            if(GetPlayerMoney(playerid) < 200) return SendClientMessage(playerid, 0, "You don't have enough money to purchase this weapon.");
            GivePlayerMoney(playerid, -200);
            GivePlayerWeapon(playerid, 23, 130);
        }
        case 4:
        {
            if(GetPlayerMoney(playerid) < 400) return SendClientMessage(playerid, 0, "You don't have enough money to purchase this weapon.");
            GivePlayerMoney(playerid, -400);
            GivePlayerWeapon(playerid, 32, 200);
        }
        case 5:
        {
            if(GetPlayerMoney(playerid) < 450) return SendClientMessage(playerid, 0, "You don't have enough money to purchase this weapon.");
            GivePlayerMoney(playerid, -450);
            GivePlayerWeapon(playerid, 28, 200);
        }
        case 6:
        {
            if(GetPlayerMoney(playerid) < 500) return SendClientMessage(playerid, 0, "You don't have enough money to purchase this weapon.");
            GivePlayerMoney(playerid, -500);
            GivePlayerWeapon(playerid, 29, 300);
        }
        case 7:
        {
            if(GetPlayerMoney(playerid) < 650) return SendClientMessage(playerid, 0, "You don't have enough money to purchase this weapon.");
            GivePlayerMoney(playerid, -650);
            GivePlayerWeapon(playerid, 30, 200);
        }
        case 8:
        {
            if(GetPlayerMoney(playerid) < 650) return SendClientMessage(playerid, 0, "You don't have enough money to purchase this weapon.");
            GivePlayerMoney(playerid, -650);
            GivePlayerWeapon(playerid, 31, 200);
        }
        case 9:
        {
            if(GetPlayerMoney(playerid) < 200) return SendClientMessage(playerid, 0, "You don't have enough money to purchase this weapon.");
            GivePlayerMoney(playerid, -200);
            GivePlayerWeapon(playerid, 26, 80);
        }
    }
}
Reply
#3

Y tambien el segundo dialogo estaba mal acomodado..

pawn Код:
if(dialogid == 8800)
{
    if(!response) return SendClientMessage(playerid, COLOR_red," you canceled this dialog");
    switch(listitem)
    {
        case 0:
        {
            SetPlayerInterior(playerid, 0);
            SetPlayerPos(playerid,1642.3022,-2333.6287,13.5469);
            GivePlayerMoney(playerid, -5000);
            SendClientMessage(playerid, COLOR_red2, "now attack him !!!!!! this is sparta !! :D! have fun");
        }
        case 1:
        {
            SetPlayerInterior(playerid, 0);
            SetPlayerPos(playerid,1642.3022,-2333.6287,13.5469);
            GivePlayerMoney(playerid, -5000);
            SendClientMessage(playerid, COLOR_red2, "now attack him !!!!!! this is sparta !! :D! have fun");
        }
        case 2:
        {
            SetPlayerInterior(playerid, 0);
            SetPlayerPos(playerid,1642.3022,-2333.6287,13.5469);
            GivePlayerMoney(playerid, -5000);
            SendClientMessage(playerid, COLOR_red2, "now attack him !!!!!! this is sparta !! :D! have fun");
        }
        case 3:
        {
            SetPlayerInterior(playerid, 0);
            SetPlayerPos(playerid,1642.3022,-2333.6287,13.5469);
            GivePlayerMoney(playerid, -5000);
            SendClientMessage(playerid, COLOR_red2, "now attack him !!!!!! this is sparta !! :D! have fun");
        }
        case 4:
        {
            SetPlayerInterior(playerid, 0);
            SetPlayerPos(playerid,1642.3022,-2333.6287,13.5469);
            GivePlayerMoney(playerid, -5000);
            SendClientMessage(playerid, COLOR_red2, "now attack him !!!!!! this is sparta !! :D! have fun");
        }
    }
}
Reply
#4

no me habia dado cuenta que me habia saltado del 1 al 4 xD
gracias, per todavia no funcionan !
nose que pasa, no tira errores el pawn, lose, aveces se buggea, pero a de ser por las id's que les eh puesto? osea esta muy elevadas?
PD:todavia no funciona el cmd aparece el dialogo, pero no realiza ninguna accion
Reply
#5

Asegurate de que no se esten ligando con las id de dialogos de un FS o algo similar..
Reply
#6

no, ninguno es igual o algo parecido :C nose que pasa, el dialogo esta bien verdad? y lo demas esta bien deberia funcionar no?
Reply
#7

Sн, todo esta bien... trata de cambiar las ID's por ejemplo 66-67 no del 66-8800 aunque eso no tendrнa que haber problemas...

Te recomiendo que en vez de if(dialogid == ... usa switch porque es mбs rapido .. ej:

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
         case 0: // el id del dialog
         {
             switch(listitem) // si es de lista, es un ejemplo
             {
                 case 0:
                 {
                    // funciones
                 }
                 case 1:
                 {
                    // funciones
                 }
             }
         }
         case 1: // id del dialog
         {
            if(!response) return SendClientMessage(playerid, -1, "Has cancelado");
            // funciones....
         }
    }
    return 1;
}
Si puedes pasa todo el callback de OnDialogResponse y lo posteas aquн.. si todavнa surge el problema.
Reply
#8

pasare todo lo que tengo esta algo desordenado porque me tiraba errores por el orden y me daba pereza pero igual lo pasare aqui, y tratare de usar este nuevo metodo
aqui todo el OnDialogResponse
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 999)
{
if(!response) return Kick(playerid);
{
if(response)
                    {
                if(listitem == 0)
                    {
                        SendClientMessage(playerid, COLOR_blue2, "You chose the Soldado as your class.");
                        ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "Soldado Class:", "Abilities:\nnone for now\n", "Play","");
                        gPlayerClass[playerid] = Soldado;
                        PickedClass[playerid] = 1;
                        SetPlayerVirtualWorld(playerid, 0);
                        TogglePlayerControllable(playerid, 1);
                        ResetPlayerWeapons(playerid);
                        GivePlayerWeapon(playerid, 31, 200);
                        GivePlayerWeapon(playerid, 25, 100);
                        GivePlayerWeapon(playerid, 24, 70);
                        GivePlayerWeapon(playerid, 46, 1);
                        GivePlayerWeapon(playerid, 27, 54);
                    }

                if(listitem == 1)
                    {
                        SendClientMessage(playerid, COLOR_blue2, "You chose the Sniper as your class.");
                        ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "Sniper Class:", "Abilities:\n{no one for now\n", "Play","");
                        gPlayerClass[playerid] = Sniper;
                        PickedClass[playerid] = 1;
                        RemovePlayerMapIcon(playerid, 0);
                        SetPlayerVirtualWorld(playerid, 0);
                        TogglePlayerControllable(playerid, 1);
                        ResetPlayerWeapons(playerid);
                        GivePlayerWeapon(playerid, 34, 250);
                        GivePlayerWeapon(playerid, 29, 250);
                        GivePlayerWeapon(playerid, 4, 1);
                        GivePlayerWeapon(playerid, 46, 1);
                        GivePlayerWeapon(playerid, 23, 200);
                    }

                if(listitem == 2)
                    {
                        SendClientMessage(playerid, COLOR_blue2, "You chose the Ingeniero as your class.");
                        ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "Ingeniero Class:", "Abilities:\n{no one for now\n", "Play","");
                        gPlayerClass[playerid] = Ingeniero;
                        PickedClass[playerid] = 1;
                        SetPlayerVirtualWorld(playerid, 0);
                        TogglePlayerControllable(playerid, 1);
                        ResetPlayerWeapons(playerid);
                        GivePlayerWeapon(playerid, 27, 200);
                        GivePlayerWeapon(playerid, 23, 200);
                        GivePlayerWeapon(playerid, 35, 2);
                        GivePlayerWeapon(playerid, 16, 2);
                        GivePlayerWeapon(playerid, 46, 1);
                    }

                if(listitem == 3)
                    {
                        SendClientMessage(playerid, COLOR_blue2, "You chose the Pilot as your class.");
                        ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "Piloto Class:", "Abilities:\nPilotos can drive hydras/hunters\nAlso get more weapons for your class\n pilots can use /rbots\n", "Play","");
                        PickedClass[playerid] = 1;
                        SetPlayerVirtualWorld(playerid, 0);
                        TogglePlayerControllable(playerid, 1);
                        ResetPlayerWeapons(playerid);
                        GivePlayerWeapon(playerid, 24, 200);
                        GivePlayerWeapon(playerid, 17, 4);
                        GivePlayerWeapon(playerid, 25, 100);
                        GivePlayerWeapon(playerid, 46, 1);
                    }

                if(listitem == 4)
                    {
                        SendClientMessage(playerid, COLOR_blue2, "You chose the Spy as your class.");
                        ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "Espia Class:", "Abilities:\nYou can change your color\nEspias can use /dis cmd and /healesp \nAlso get more weapons\n", "Play","");
                        gPlayerClass[playerid] = Espia;
                        PickedClass[playerid] = 1;
                        SetPlayerVirtualWorld(playerid, 0);
                        TogglePlayerControllable(playerid, 1);
                        ResetPlayerWeapons(playerid);
                        GivePlayerWeapon(playerid, 29, 200);
                        GivePlayerWeapon(playerid, 23, 200);
                        GivePlayerWeapon(playerid, 4, 1);
                        GivePlayerWeapon(playerid, 18, 2);
                        GivePlayerWeapon(playerid, 46, 1);
                    }
}
}

}
if(dialogid == 1000)
{
if(!response) return SendClientMessage(playerid, COLOR_red, "You selected nothing...!canceled!");
{
if(response)
{
if(listitem == 0)
{
SetPlayerColor(playerid, COLOR_GREY);
SetPlayerSkin(playerid, 254);
TogglePlayerControllable(playerid, 1);
SendClientMessage(playerid, COLOR_GREY, "Now you're like ECUADOR");
}
if(listitem == 1)
{
SetPlayerColor(playerid, COLOR_yellow);
SetPlayerSkin(playerid, 208);
TogglePlayerControllable(playerid, 1);
SendClientMessage(playerid, COLOR_yellow,"Now You're like COLOMBIA");
}
if(listitem == 2)
{
SetPlayerColor(playerid, COLOR_orange);
SetPlayerSkin(playerid, 23);
TogglePlayerControllable(playerid, 1);
SendClientMessage(playerid, COLOR_orange,"Now You're like BRAZIL");
}
if(listitem == 3)
{
SetPlayerColor(playerid, COLOR_green2);
SetPlayerSkin(playerid, 206);
TogglePlayerControllable(playerid, 1);
SendClientMessage(playerid, COLOR_green2, "Now You're Like MEXICO");
}
if(listitem == 4)
{
SetPlayerColor(playerid, COLOR_blue2);
SetPlayerSkin(playerid, 122);
TogglePlayerControllable(playerid, 1);
SendClientMessage(playerid, COLOR_blue2, "Now you're like ARGETINA");
}
}
}
if(dialogid == 67)
{
    if(!response) return SendClientMessage(playerid, -1, "You've cancelled the weapon shop dialog.");
    switch(listitem)
    {
        case 0:
        {
            if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid, 0, "You don't have enough money to purchase this weapon.");
            GivePlayerMoney(playerid, -100);
            GivePlayerWeapon(playerid, 4, 1);
        }
        case 1:
        {
            if(GetPlayerMoney(playerid) < 120) return SendClientMessage(playerid, 0, "You don't have enough money to purchase this weapon.");
            GivePlayerMoney(playerid, -120);
            GivePlayerWeapon(playerid, 22, 120);
        }
        case 2:
        {
            if(GetPlayerMoney(playerid) < 250) return SendClientMessage(playerid, 0, "You don't have enough money to purchase this weapon.");
            GivePlayerMoney(playerid, -250);
            GivePlayerWeapon(playerid, 24, 150);
        }
        case 3:
        {
            if(GetPlayerMoney(playerid) < 200) return SendClientMessage(playerid, 0, "You don't have enough money to purchase this weapon.");
            GivePlayerMoney(playerid, -200);
            GivePlayerWeapon(playerid, 23, 130);
        }
        case 4:
        {
            if(GetPlayerMoney(playerid) < 400) return SendClientMessage(playerid, 0, "You don't have enough money to purchase this weapon.");
            GivePlayerMoney(playerid, -400);
            GivePlayerWeapon(playerid, 32, 200);
        }
        case 5:
        {
            if(GetPlayerMoney(playerid) < 450) return SendClientMessage(playerid, 0, "You don't have enough money to purchase this weapon.");
            GivePlayerMoney(playerid, -450);
            GivePlayerWeapon(playerid, 28, 200);
        }
        case 6:
        {
            if(GetPlayerMoney(playerid) < 500) return SendClientMessage(playerid, 0, "You don't have enough money to purchase this weapon.");
            GivePlayerMoney(playerid, -500);
            GivePlayerWeapon(playerid, 29, 300);
        }
        case 7:
        {
            if(GetPlayerMoney(playerid) < 650) return SendClientMessage(playerid, 0, "You don't have enough money to purchase this weapon.");
            GivePlayerMoney(playerid, -650);
            GivePlayerWeapon(playerid, 30, 200);
        }
        case 8:
        {
            if(GetPlayerMoney(playerid) < 650) return SendClientMessage(playerid, 0, "You don't have enough money to purchase this weapon.");
            GivePlayerMoney(playerid, -650);
            GivePlayerWeapon(playerid, 31, 200);
        }
        case 9:
        {
            if(GetPlayerMoney(playerid) < 200) return SendClientMessage(playerid, 0, "You don't have enough money to purchase this weapon.");
            GivePlayerMoney(playerid, -200);
            GivePlayerWeapon(playerid, 26, 80);
        }
    }
}


if(dialogid == 100)
    {
        if(!response) return SendClientMessage(playerid, COLOR_red," you canceled this dialog");
        switch(listitem)
        {
            case 0:
            {
                SetPlayerInterior(playerid, 0);
                SetPlayerPos(playerid,1642.3022,-2333.6287,13.5469);
                GivePlayerMoney(playerid, -5000);
                SendClientMessage(playerid, COLOR_red2, "now attack him !!!!!! this is sparta !! :D! have fun");
            }
            case 1:
            {
                SetPlayerInterior(playerid, 0);
                SetPlayerPos(playerid,1642.3022,-2333.6287,13.5469);
                GivePlayerMoney(playerid, -5000);
                SendClientMessage(playerid, COLOR_red2, "now attack him !!!!!! this is sparta !! :D! have fun");
            }
            case 2:
            {
                SetPlayerInterior(playerid, 0);
                SetPlayerPos(playerid,1642.3022,-2333.6287,13.5469);
                GivePlayerMoney(playerid, -5000);
                SendClientMessage(playerid, COLOR_red2, "now attack him !!!!!! this is sparta !! :D! have fun");
            }
            case 3:
            {
                SetPlayerInterior(playerid, 0);
                SetPlayerPos(playerid,1642.3022,-2333.6287,13.5469);
                GivePlayerMoney(playerid, -5000);
                SendClientMessage(playerid, COLOR_red2, "now attack him !!!!!! this is sparta !! :D! have fun");
            }
            case 4:
            {
                SetPlayerInterior(playerid, 0);
                SetPlayerPos(playerid,1642.3022,-2333.6287,13.5469);
                GivePlayerMoney(playerid, -5000);
                SendClientMessage(playerid, COLOR_red2, "now attack him !!!!!! this is sparta !! :D! have fun");
            }
        }
    }
if(dialogid == dregister)
{
if(!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext))
{
ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_PASSWORD,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Register","Quit");
return 1;
}

new hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),inputtext);
new INI:file = INI_Open(Path(playerid));
INI_SetTag(file,"Player's Data");
INI_WriteString(file,"Password",hashpass);
INI_WriteInt(file,"AdminLevel",0);
INI_WriteInt(file,"VIPLevel",0);
INI_WriteInt(file,"Money",0);
INI_WriteInt(file,"Scores",0);
INI_WriteInt(file,"Kills",0);
INI_WriteInt(file,"Deaths",0);
INI_WriteInt(file,"Ranks", 0);
INI_Close(file);
SendClientMessage(playerid,-1,"You have been successfully registered");
return 1;
}
}
if(dialogid == dlogin)
{
if(!response) return Kick(playerid);
if(response)
{
new hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),inputtext);
if(!strcmp(hashpass,pInfo[playerid][Pass]))
{
INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);
SetPlayerScore(playerid,pInfo[playerid][Scores]);
GivePlayerMoney(playerid,pInfo[playerid][Money]);
SetPlayerScore(playerid, GetPlayerScore(Rank[playerid]));
SendClientMessage(playerid,-1,"Welcome back! You have successfully logged in");
}
else
{
ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_PASSWORD,"Login","Welcome back. This account is registered. \nInsert your password to login to your account.\nIncorrect password!","Login","Quit");
return 1;
}
}
}
return 1;
}
return 1;
}
creo que mi erro fue, en poner las ids en desorden
Reply
#9

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 999)
    {
        if(!response) return Kick(playerid);
        if(listitem == 0)
        {
            SendClientMessage(playerid, COLOR_blue2, "You chose the Soldado as your class.");
            ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "Soldado Class:", "Abilities:\nnone for now\n", "Play","");
            gPlayerClass[playerid] = Soldado;
            PickedClass[playerid] = 1;
            SetPlayerVirtualWorld(playerid, 0);
            TogglePlayerControllable(playerid, 1);
            ResetPlayerWeapons(playerid);
            GivePlayerWeapon(playerid, 31, 200);
            GivePlayerWeapon(playerid, 25, 100);
            GivePlayerWeapon(playerid, 24, 70);
            GivePlayerWeapon(playerid, 46, 1);
            GivePlayerWeapon(playerid, 27, 54);
        }
        if(listitem == 1)
        {
            SendClientMessage(playerid, COLOR_blue2, "You chose the Sniper as your class.");
            ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "Sniper Class:", "Abilities:\n{no one for now\n", "Play","");
            gPlayerClass[playerid] = Sniper;
            PickedClass[playerid] = 1;
            RemovePlayerMapIcon(playerid, 0);
            SetPlayerVirtualWorld(playerid, 0);
            TogglePlayerControllable(playerid, 1);
            ResetPlayerWeapons(playerid);
            GivePlayerWeapon(playerid, 34, 250);
            GivePlayerWeapon(playerid, 29, 250);
            GivePlayerWeapon(playerid, 4, 1);
            GivePlayerWeapon(playerid, 46, 1);
            GivePlayerWeapon(playerid, 23, 200);
        }
        if(listitem == 2)
        {
            SendClientMessage(playerid, COLOR_blue2, "You chose the Ingeniero as your class.");
            ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "Ingeniero Class:", "Abilities:\n{no one for now\n", "Play","");
            gPlayerClass[playerid] = Ingeniero;
            PickedClass[playerid] = 1;
            SetPlayerVirtualWorld(playerid, 0);
            TogglePlayerControllable(playerid, 1);
            ResetPlayerWeapons(playerid);
            GivePlayerWeapon(playerid, 27, 200);
            GivePlayerWeapon(playerid, 23, 200);
            GivePlayerWeapon(playerid, 35, 2);
            GivePlayerWeapon(playerid, 16, 2);
            GivePlayerWeapon(playerid, 46, 1);
        }
        if(listitem == 3)
        {
            SendClientMessage(playerid, COLOR_blue2, "You chose the Pilot as your class.");
            ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "Piloto Class:", "Abilities:\nPilotos can drive hydras/hunters\nAlso get more weapons for your class\n pilots can use /rbots\n", "Play","");
            PickedClass[playerid] = 1;
            SetPlayerVirtualWorld(playerid, 0);
            TogglePlayerControllable(playerid, 1);
            ResetPlayerWeapons(playerid);
            GivePlayerWeapon(playerid, 24, 200);
            GivePlayerWeapon(playerid, 17, 4);
            GivePlayerWeapon(playerid, 25, 100);
            GivePlayerWeapon(playerid, 46, 1);
        }
        if(listitem == 4)
        {
            SendClientMessage(playerid, COLOR_blue2, "You chose the Spy as your class.");
            ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "Espia Class:", "Abilities:\nYou can change your color\nEspias can use /dis cmd and /healesp \nAlso get more weapons\n", "Play","");
            gPlayerClass[playerid] = Espia;
            PickedClass[playerid] = 1;
            SetPlayerVirtualWorld(playerid, 0);
            TogglePlayerControllable(playerid, 1);
            ResetPlayerWeapons(playerid);
            GivePlayerWeapon(playerid, 29, 200);
            GivePlayerWeapon(playerid, 23, 200);
            GivePlayerWeapon(playerid, 4, 1);
            GivePlayerWeapon(playerid, 18, 2);
            GivePlayerWeapon(playerid, 46, 1);
        }
    }
    if(dialogid == 1000)
    {
        if(!response) return SendClientMessage(playerid, COLOR_red, "You selected nothing...!canceled!");
        if(listitem == 0)
        {
            SetPlayerColor(playerid, COLOR_GREY);
            SetPlayerSkin(playerid, 254);
            TogglePlayerControllable(playerid, 1);
            SendClientMessage(playerid, COLOR_GREY, "Now you're like ECUADOR");
        }
        if(listitem == 1)
        {
            SetPlayerColor(playerid, COLOR_yellow);
            SetPlayerSkin(playerid, 208);
            TogglePlayerControllable(playerid, 1);
            SendClientMessage(playerid, COLOR_yellow,"Now You're like COLOMBIA");
        }
        if(listitem == 2)
        {
            SetPlayerColor(playerid, COLOR_orange);
            SetPlayerSkin(playerid, 23);
            TogglePlayerControllable(playerid, 1);
            SendClientMessage(playerid, COLOR_orange,"Now You're like BRAZIL");
        }
        if(listitem == 3)
        {
            SetPlayerColor(playerid, COLOR_green2);
            SetPlayerSkin(playerid, 206);
            TogglePlayerControllable(playerid, 1);
            SendClientMessage(playerid, COLOR_green2, "Now You're Like MEXICO");
        }
        if(listitem == 4)
        {
            SetPlayerColor(playerid, COLOR_blue2);
            SetPlayerSkin(playerid, 122);
            TogglePlayerControllable(playerid, 1);
            SendClientMessage(playerid, COLOR_blue2, "Now you're like ARGETINA");
        }
    }
    if(dialogid == 67)
    {
        if(!response) return SendClientMessage(playerid, -1, "You've cancelled the weapon shop dialog.");
        switch(listitem)
        {
            case 0:
            {
                if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid, 0, "You don't have enough money to purchase this weapon.");
                GivePlayerMoney(playerid, -100);
                GivePlayerWeapon(playerid, 4, 1);
            }
            case 1:
            {
                if(GetPlayerMoney(playerid) < 120) return SendClientMessage(playerid, 0, "You don't have enough money to purchase this weapon.");
                GivePlayerMoney(playerid, -120);
                GivePlayerWeapon(playerid, 22, 120);
            }
            case 2:
            {
                if(GetPlayerMoney(playerid) < 250) return SendClientMessage(playerid, 0, "You don't have enough money to purchase this weapon.");
                GivePlayerMoney(playerid, -250);
                GivePlayerWeapon(playerid, 24, 150);
            }
            case 3:
            {
                if(GetPlayerMoney(playerid) < 200) return SendClientMessage(playerid, 0, "You don't have enough money to purchase this weapon.");
                GivePlayerMoney(playerid, -200);
                GivePlayerWeapon(playerid, 23, 130);
            }
            case 4:
            {
                if(GetPlayerMoney(playerid) < 400) return SendClientMessage(playerid, 0, "You don't have enough money to purchase this weapon.");
                GivePlayerMoney(playerid, -400);
                GivePlayerWeapon(playerid, 32, 200);
            }
            case 5:
            {
                if(GetPlayerMoney(playerid) < 450) return SendClientMessage(playerid, 0, "You don't have enough money to purchase this weapon.");
                GivePlayerMoney(playerid, -450);
                GivePlayerWeapon(playerid, 28, 200);
            }
            case 6:
            {
                if(GetPlayerMoney(playerid) < 500) return SendClientMessage(playerid, 0, "You don't have enough money to purchase this weapon.");
                GivePlayerMoney(playerid, -500);
                GivePlayerWeapon(playerid, 29, 300);
            }
            case 7:
            {
                if(GetPlayerMoney(playerid) < 650) return SendClientMessage(playerid, 0, "You don't have enough money to purchase this weapon.");
                GivePlayerMoney(playerid, -650);
                GivePlayerWeapon(playerid, 30, 200);
            }
            case 8:
            {
                if(GetPlayerMoney(playerid) < 650) return SendClientMessage(playerid, 0, "You don't have enough money to purchase this weapon.");
                GivePlayerMoney(playerid, -650);
                GivePlayerWeapon(playerid, 31, 200);
            }
            case 9:
            {
                if(GetPlayerMoney(playerid) < 200) return SendClientMessage(playerid, 0, "You don't have enough money to purchase this weapon.");
                GivePlayerMoney(playerid, -200);
                GivePlayerWeapon(playerid, 26, 80);
            }
        }
    }
    if(dialogid == 100)
    {
        if(!response) return SendClientMessage(playerid, COLOR_red," you canceled this dialog");
        switch(listitem)
        {
            case 0:
            {
                SetPlayerInterior(playerid, 0);
                SetPlayerPos(playerid,1642.3022,-2333.6287,13.5469);
                GivePlayerMoney(playerid, -5000);
                SendClientMessage(playerid, COLOR_red2, "now attack him !!!!!! this is sparta !! :D! have fun");
            }
            case 1:
            {
                SetPlayerInterior(playerid, 0);
                SetPlayerPos(playerid,1642.3022,-2333.6287,13.5469);
                GivePlayerMoney(playerid, -5000);
                SendClientMessage(playerid, COLOR_red2, "now attack him !!!!!! this is sparta !! :D! have fun");
            }
            case 2:
            {
                SetPlayerInterior(playerid, 0);
                SetPlayerPos(playerid,1642.3022,-2333.6287,13.5469);
                GivePlayerMoney(playerid, -5000);
                SendClientMessage(playerid, COLOR_red2, "now attack him !!!!!! this is sparta !! :D! have fun");
            }
            case 3:
            {
                SetPlayerInterior(playerid, 0);
                SetPlayerPos(playerid,1642.3022,-2333.6287,13.5469);
                GivePlayerMoney(playerid, -5000);
                SendClientMessage(playerid, COLOR_red2, "now attack him !!!!!! this is sparta !! :D! have fun");
            }
            case 4:
            {
                SetPlayerInterior(playerid, 0);
                SetPlayerPos(playerid,1642.3022,-2333.6287,13.5469);
                GivePlayerMoney(playerid, -5000);
                SendClientMessage(playerid, COLOR_red2, "now attack him !!!!!! this is sparta !! :D! have fun");
            }
        }
    }
    if(dialogid == dregister)
    {
        if(!response) return Kick(playerid);
        if(!strlen(inputtext))
        {
            ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_PASSWORD,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Register","Quit");
        }
        new hashpass[129];
        WP_Hash(hashpass,sizeof(hashpass),inputtext);
        new INI:file = INI_Open(Path(playerid));
        INI_SetTag(file,"Player's Data");
        INI_WriteString(file,"Password",hashpass);
        INI_WriteInt(file,"AdminLevel",0);
        INI_WriteInt(file,"VIPLevel",0);
        INI_WriteInt(file,"Money",0);
        INI_WriteInt(file,"Scores",0);
        INI_WriteInt(file,"Kills",0);
        INI_WriteInt(file,"Deaths",0);
        INI_WriteInt(file,"Ranks", 0);
        INI_Close(file);
        SendClientMessage(playerid,-1,"You have been successfully registered");
    }
    if(dialogid == dlogin)
    {
        if(!response) return Kick(playerid);
        new hashpass[129];
        WP_Hash(hashpass,sizeof(hashpass),inputtext);
        if(!strcmp(hashpass,pInfo[playerid][Pass]))
        {
            INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);
            SetPlayerScore(playerid,pInfo[playerid][Scores]);
            GivePlayerMoney(playerid,pInfo[playerid][Money]);
            SetPlayerScore(playerid, GetPlayerScore(Rank[playerid]));
            SendClientMessage(playerid,-1,"Welcome back! You have successfully logged in");
        }
        else
        {
            ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_PASSWORD,"Login","Welcome back. This account is registered. \nInsert your password to login to your account.\nIncorrect password!","Login","Quit");
        }
    }
    return 1;
}
ahora si deberнa de funcionarte..

y no, no hay problema que pongas IDs altos siempre y cuando uses switch para que busque la ID del dialog mas rapido
Reply
#10

El mбximo ID que debe tener un diбlogo actualmente es 32767, ademбs de que no funciona con IDs negativos (estos cierra el diбlogo que ve el jugador, en el caso de que vea uno).

Que quieres hacer? no entiendo exactamente el fin del script. Es un diбlogo para venta de armas?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)