Problem with strcat
#1

Hi,
I use strcat to make dynamic dialog but it not works.

This is my code :
Код:
stock GetZones(playerid)
{
	new zonesa[1200], string[128];
	for(new g; g<=NB_GANGZONES; g++)
	{
	    string = "";
        if(Zones[g][Team] == 1)
        {
			format(string, sizeof(string), "{00FF00}%s\n", Zones[g][Nom]);
			strcat(zonesa, string, sizeof(string));
		}
        else if(Zones[g][Team] == 2)
        {
			format(string, sizeof(string), "{800080}%s\n", Zones[g][Nom]);
			strcat(zonesa, string, sizeof(string));
		}
        else if(Zones[g][Team] == 3)
        {
			format(string, sizeof(string), "{F4F400}%s\n", Zones[g][Nom]);
			strcat(zonesa, string, sizeof(string));
		}
        else if(Zones[g][Team] == 4)
        {
			format(string, sizeof(string), "{00FFFF}%s\n", Zones[g][Nom]);
			strcat(zonesa, string, sizeof(string));
		}
	}
	ShowPlayerDialog(playerid, DIALOG_ZONES, DIALOG_STYLE_LIST, "Choix du spawn", zonesa, "Valider", "Annuler");
	return 1;
}
Ingame, when i type the command, the server said "SERVER: Unknown command."
I didn't found the solution, please help me.
Thanks.
Reply
#2

That's an stock, not an command.
Post your command code.
Reply
#3

Yes but i use a command to show the dialog :

Код:
    if(strcmp(cmd, "/getzones", true) == 0)
    {
        if(UserStats[playerid][Admin] <= 1)
        {
            SendClientMessage(playerid, COLOR_RED, "Vous n'avez pas l'autorisation d'utiliser cette commande.");
            return 1;
        }
        GetZones(playerid);
        return 1;
    }
Reply
#4

Like this?
Код:
stock GetZones(playerid)
{
	new string[1200];
	for(new g; g<=NB_GANGZONES; g++)
	{
        if(Zones[g][Team] == 1)
        {
			format(string, sizeof(string), "{00FF00}%s\n", Zones[g][Nom]);
		}
        else if(Zones[g][Team] == 2)
        {
			format(string, sizeof(string), "{800080}%s\n", Zones[g][Nom]);
		}
        else if(Zones[g][Team] == 3)
        {
			format(string, sizeof(string), "{F4F400}%s\n", Zones[g][Nom]);
		}
        else if(Zones[g][Team] == 4)
        {
			format(string, sizeof(string), "{00FFFF}%s\n", Zones[g][Nom]);
		}
	}
	ShowPlayerDialog(playerid, DIALOG_ZONES, DIALOG_STYLE_LIST, "Choix du spawn", string, "Valider", "Annuler");
	return 1;
}
I have try but i have the same problem.
Reply
#5

Still the same problem
I have put a SendClientMessage in the loop, it works :

But after I have move the SendClientMessage after the loop and it not works.
Reply
#6

No i use "string"
Reply
#7

No i have changed too


I have put printf before the format in the loop for testing if the problem isn't in my gangzone loading:
Код:
printf("G%d T%d", g, Zones[g][Team]);
and it works :
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)