SA-MP Forums Archive
Dudas. (: - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Español/Spanish (https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: Dudas. (: (/showthread.php?tid=229023)



Dudas. (: - arturo clark - 20.02.2011

1.- Aquн el primer problema
pawn Код:
forward AfterPlayerConnect(playerid, classid);
public AfterPlayerConnect(playerid, classid)
{
    PlayerInfo[playerid][PlayerClass] = classid;
    switch (classid)
    {
        case 0, 1:
        {
            PlayerInfo[playerid][PlayerTeam] = CITIZENID;
            TextDrawHideForPlayer(playerid, Police);
            TextDrawShowForPlayer(playerid, Citizen);
        }
        case 2, 3:
        {
            PlayerInfo[playerid][PlayerTeam] = POLICEID;
            TextDrawHideForPlayer(playerid, Citizen);
            TextDrawShowForPlayer(playerid, Police);
        }
    }
    return 1;
}
Tengo 2 tipos de skins: el de Citizen y el de Police. Cada uno usa un Text Draw como puede ver, pero cuando paso a los skins de Police el Text Draw de Citizen no se esconde.

2.- Aquн el segundo problema:
pawn Код:
ShowPlayerDialog(playerid, MARKETDIALOG1, DIALOG_STYLE_INPUT,"Available objects", "\r\nMedikits - Price: 10 Cash\r\nCyanide - Price: 18 Cash", "Buy", "Exit");

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == MARKETDIALOG1)
    {
        if(response == 1)
        {
            if(!strcmp(inputtext, "medikits"))
            {
                Object[playerid][Medikit] += 1;
                PlayerInfo[playerid][Cash] -= 10;
            }
            if(!strcmp(inputtext, "cyanide"))
            {
                Object[playerid][Cyanide] += 1;
                PlayerInfo[playerid][Cash] -= 20;
            }
        }
        if(response == 0)
        {
            TogglePlayerControllable(playerid, 0);
        }
    }
    return 1;
}
Cuando escribe alguno de los 2 objectos y despuйs elijo "Buy" o "Exit", el server crashea.


Respuesta: Dudas. (: - Lunnatiicz - 20.02.2011

En el primero no creo poder apoyarte mucho ya que nunca eh usado textdraws.

En el segundo no entendн, si esta en Dialog, cуmo que cuando escribes crashea?

pawn Код:
forward AfterPlayerConnect(playerid, classid);
public AfterPlayerConnect(playerid, classid)
{
    PlayerInfo[playerid][PlayerClass] = classid;
    switch (classid)
    {
        case 0:
        {
            PlayerInfo[playerid][PlayerTeam] = CITIZENID;
            TextDrawHideForPlayer(playerid, Police);
            TextDrawShowForPlayer(playerid, Citizen);
        }
        case 1:
        {
            PlayerInfo[playerid][PlayerTeam] = POLICEID;
            TextDrawHideForPlayer(playerid, Citizen);
            TextDrawShowForPlayer(playerid, Police);
        }
    }
    return 1;
}



Re: Dudas. (: - arturo clark - 20.02.2011

Mira, como puedes ver estoy usando strcpm para detectar lo que el jugador escribiу en el inputtext, asн que cuando escribo "medikits" o "cyanide" (son los objectos que utilizo) y despuйs elijo "Buy" o "Exit" crashea.


Respuesta: Dudas. (: - Lunnatiicz - 20.02.2011

Mira no se exactamente cуmo resolver tu error, estoy testeando haber si puedo, pero por mientras intenta con este codigo extraнdo de la wiki de la secciуn italiana

pawn Код:
public OnDialogResponse ( playerid, dialogid, response, listitem, inputtext [ ] )
{
    if ( dialogid == 0 )  //If dialogid will be equal to 0
    {
        if ( response )  //If you click "I Agree"
        {
            new string [ 128 ] ; //Creating a string
            format ( string, 128 , "You are entering:% s" , inputtext ) , //Format string
            SendClientMessage ( playerid, green, string ) ; //upload a string in the form of the message
        }
        return  1 ;
    }
    return  0 ;
}
Nota: Strcmp es un procesador de comandos, y comparador de string, algo parecido a todo pero no lector de dialogos, eso creo xD


Re: Dudas. (: - MrDeath537 - 20.02.2011

1. їCuбntos AddPlayerClass tienes?

2. Intenta con:

pawn Код:
ShowPlayerDialog(playerid, MARKETDIALOG1, DIALOG_STYLE_INPUT, "Available objects", "\nMedikits - Price: 10 Cash\nCyanide - Price: 18 Cash", "Buy", "Exit");



Respuesta: Dudas. (: - Lunnatiicz - 20.02.2011

pawn Код:
ShowPlayerDialog(playerid, MARKETDIALOG1, DIALOG_STYLE_INPUT,"Available objects", "\r\nMedikits - Price: 10 Cash\r\nCyanide - Price: 18 Cash", "Buy", "Exit");

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == MARKETDIALOG1)
    {
        if(response == 1)
        {
            if(!strlen(inputtext, "medikits"))//si no funciona quita "medikits" y deja (inputtext)) Igual en la siguiente
            {
                Object[playerid][Medikit] += 1;
                PlayerInfo[playerid][Cash] -= 10;
            }
            if(!strlen(inputtext, "cyanide"))
            {
                Object[playerid][Cyanide] += 1;
                PlayerInfo[playerid][Cash] -= 20;
            }
        }
        if(response == 0)
        {
            TogglePlayerControllable(playerid, 0);
        }
    }
    return 1;
}



Re: Dudas. (: - arturo clark - 21.02.2011

1.- Tengo 2 de cada 1.

2.- Tratare con lo que me dijiste MrDeath.
Lunna, si uso "strlen" me saldar un warning y no funcionara.

Edit: No funciono lo que me dijiste MrDeath.


Respuesta: Dudas. (: - Lunnatiicz - 21.02.2011

pawn Код:
if(!strcmp(cmdtext, "/items", true))
    {
    ShowPlayerDialog(playerid,1, DIALOG_STYLE_INPUT, "Available objects", "\nMedikits - Price: 10 Cash\nCyanide - Price: 18 Cash", "Buy", "Exit");
    return 1;
    }//comando xd

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 1)
    {
        if(response == 1)
        {
            if(!strlen(inputtext))//si no funciona quita "medikits" y deja (inputtext)) Igual en la siguiente
            {
                Object[playerid][Medikit] += 1;
                PlayerInfo[playerid][Cash] -= 10;
            }
            if(!strlen(inputtext))
            {
                Object[playerid][Cyanide] += 1;
                PlayerInfo[playerid][Cash] -= 20;
            }
        }
        if(response == 0)
        {
            TogglePlayerControllable(playerid, 0);
        }
    }
    return 1;
}
Lo testie y me funciono bien, serнa mejor que me dijeras cual warning te da, saludos!


Re: Dudas. (: - arturo clark - 21.02.2011

Sigue sin funcionar.


Respuesta: Dudas. (: - Lunnatiicz - 21.02.2011

Quй error te da?

Oh cuбl es el problema?