SA-MP Forums Archive
Return d'une fonction stock. - 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: Français/French (https://sampforum.blast.hk/forumdisplay.php?fid=30)
+---- Thread: Return d'une fonction stock. (/showthread.php?tid=593527)



Return d'une fonction stock. - Herka - 06.11.2015

Bonsoir tout le monde, j'ai un petit problиme avec une fonction je ne trouve pas le return ... sыrement la fatigue :')
Vous pouvez m'aider s'il vous plaоt ?

Code:
stock MessageF(playerID, color, message[], { _, Float, Text3D, Menu, Text, DB, DBResult, bool, File, hex, bit, bit_byte, Bit }:...)
{
    if (playerID == INVALID_PLAYER_ID)
    {
        return;
    }
    new targetString[256];
    //new message[256];
    //strcat(message, message2);
    new length = strlen(message);
    new argumentIndex = 2;
    for (new character = 0; character < length; character++)
    {
        new isFormatChar;
        if (message[character] == '%')
        {
            if (character + 1 < length)
            {
                switch (message[character + 1])
                {
                    case '%':
                    {
                        strcat(targetString, "%");
                        isFormatChar = true;
                    }
                    case 'c':
                    {
                        argumentIndex++;
                        format(targetString, sizeof(targetString), "%s%c", targetString, getarg(argumentIndex));
                        isFormatChar = true;
                    }
                    case 'd':
                    {
                        argumentIndex++;
                        format(targetString, sizeof(targetString), "%s%d", targetString, getarg(argumentIndex));
                        isFormatChar = true;
                    }
                    case 'f':
                    {
                        argumentIndex++;
                        format(targetString, sizeof(targetString), "%s%f", targetString, getarg(argumentIndex));
                        isFormatChar = true;
                    }
                    case 's':
                    {
                        argumentIndex++;
                        new string[256];
                        GetStringArg(argumentIndex, string);
                        strcat(targetString, string);
                        isFormatChar = true;
                    }
                }
            }
        }
        if (isFormatChar)
        {
            character++;
        }
        else
        {
            format(targetString, sizeof(targetString), "%s%c", targetString, message[character]);
        }
    }
    SendClientMessage(playerID, color, targetString);
}