Function to return a string
#1

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:

PHP Code:
stock EstaTrancada(casaid)
{
    new 
status[300];
    
format(statussizeof(status), "%d", -1);
    if(
casaid >= Server[0][quantCasas]) return status;
    if(!
strcmp(Casa[casaid][pass], "bgfr") || !strcmp(Casa[casaid][pass], "")) format(statussizeof(status), ""#LIME"%s", "Aberta"); // Open
    
else format(statussizeof(status), ""#RED"%s", "Trancada"); // Closed
    
printf("Status retornado: %s"status);
    return 
status;

Command:

PHP Code:
CMD:menucasa(playeridparams[])
{
    new 
str[1000];
    
printf("tentou"); // It always prints.
    
if(Player[playerid][quantPropriedades] < 1) return Msg(playeridverde"Vocк nгo possui nenhuma casa!");
    
format(strsizeof(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(playeridCASA_DIALOGDIALOG_STYLE_LISTCASA_TITLEstr"Confirmar""Sair");

If there's a tip, I'll be thankful.
Reply


Messages In This Thread
Function to return a string - by Fel486 - 21.04.2015, 19:40
Re: Function to return a string - by [KHK]Khalid - 21.04.2015, 20:43
Re: Function to return a string - by Konstantinos - 21.04.2015, 20:57
Re: Function to return a string - by Fel486 - 21.04.2015, 21:12
Re: Function to return a string - by Konstantinos - 21.04.2015, 21:24
Re: Function to return a string - by Fel486 - 21.04.2015, 21:33
Re: Function to return a string - by Konstantinos - 21.04.2015, 21:39
Re: Function to return a string - by Fel486 - 21.04.2015, 21:50

Forum Jump:


Users browsing this thread: 2 Guest(s)