21.04.2015, 19:40
Hello again, guys. I need a bit help on something I can't figure out. On public functions, it's not possible to return Strings, so I'm trying with Stock's, and doing it directly on the format string to be shown in my dialog!
If I remove the function that returns the string, it works; otherwise, if it's, the command returns 0 (Unknown Command).
So, here we are:
Command:
If there's a tip, I'll be thankful.
If I remove the function that returns the string, it works; otherwise, if it's, the command returns 0 (Unknown Command).
So, here we are:
PHP Code:
stock EstaTrancada(casaid)
{
new status[300];
format(status, sizeof(status), "%d", -1);
if(casaid >= Server[0][quantCasas]) return status;
if(!strcmp(Casa[casaid][pass], "bgfr") || !strcmp(Casa[casaid][pass], "")) format(status, sizeof(status), ""#LIME"%s", "Aberta"); // Open
else format(status, sizeof(status), ""#RED"%s", "Trancada"); // Closed
printf("Status retornado: %s", status);
return status;
}
PHP Code:
CMD:menucasa(playerid, params[])
{
new str[1000];
printf("tentou"); // It always prints.
if(Player[playerid][quantPropriedades] < 1) return Msg(playerid, verde, "Vocк nгo possui nenhuma casa!");
format(str, sizeof(str),""#DARK_YELLOW"1) Informaзхes da casa\n"#BLUE"2) Localizar veнculo da casa\n"#ORANGE"3) Alterar password\n4) %s", EstaTrancada(GetCasa(playerid)));
return ShowPlayerDialog(playerid, CASA_DIALOG, DIALOG_STYLE_LIST, CASA_TITLE, str, "Confirmar", "Sair");
}