SA-MP Forums Archive
Problem with strcat - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem with strcat (/showthread.php?tid=444697)



Problem with strcat - falcko - 17.06.2013

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.


Re: Problem with strcat - faff - 17.06.2013

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


Re : Problem with strcat - falcko - 17.06.2013

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;
    }



Re : Problem with strcat - falcko - 18.06.2013

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.


Re : Problem with strcat - falcko - 18.06.2013

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.


Re : Problem with strcat - falcko - 18.06.2013

No i use "string"


Re : Problem with strcat - falcko - 18.06.2013

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 :