• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] Compilation error
#7
Okay, you have this error, because you can't return array in Pawn stock function.
I made some changes and it works fine. Here's code:
Code:
stock Convert(seconds, stringTos[], size = sizeof(stringTos))
{
    stringTos[0] = 0x0;
    new result[4];
    result[0] = floatround(seconds / (3600 * 24));
    result[1] = floatround(seconds / 3600);
    result[2] = floatround((seconds / 60) - (result[1] * 60));
    result[3] = floatround(seconds - ((result[1] * 3600) + (result[2] * 60)));
    switch(result[0])
    {
        case 0:
        {
            switch(result[1])
            {
                case 0: format(stringTos, size, "%d:%02d", result[2], result[3]);
                default: format(stringTos, size, "%d:%d:%02d", result[1], result[2], result[3]);
            }
        }
    }
    return 1;// Convert(time[0]/1000, timew[0]);//51
}

And this is example:
Code:
new buffer[128];
Convert(6000, buffer);
SendClientMessage(playerid, -1, "%s", buffer); //it returns string: 1:40:00
  Reply


Messages In This Thread
Compilation error - by primat - 2025-09-05, 07:00 AM
RE: Compilation error - by primat - 2025-09-05, 07:14 AM
RE: Compilation error - by MrKacu13 - 2025-09-06, 04:58 PM
RE: Compilation error - by primat - 2025-09-07, 06:19 AM
RE: Compilation error - by primat - 2025-09-07, 06:29 AM
RE: Compilation error - by primat - 2025-09-07, 07:03 AM
RE: Compilation error - by MrKacu13 - 2025-09-07, 07:18 AM

Forum Jump: