open.mp forum
[Pawn] [Help] warning 239: literal array/string passed to a non-const parameter - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
--- Thread: [Pawn] [Help] warning 239: literal array/string passed to a non-const parameter (/showthread.php?tid=1556)



[Help] warning 239: literal array/string passed to a non-const parameter - Behemoth - 2021-01-19

Trying to do this

Code:
return SetTimerEx("KickTimer", 100, false, "i", playerid);


but it's for some reason giving me the warning above (again, only an issue in the new compiler). What am I doing wrong and again can someone tell the best way to write this?


RE: [Help] warning 239: literal array/string passed to a non-const parameter - Behemoth - 2021-01-19

Well, I've fixed it... I don't know why this removes the warning, but it works so I guess that's all that matters. If someone could explain why this works instead of the original method, I'd appreciate that.



Code:
    new

        timer[12], int[12];

    format(timer, sizeof(timer), "KickTimer");

    format(int, sizeof(int), "i");

    SetTimerEx(timer, 100, false, int, playerid);

    return 1;



RE: [Help] warning 239: literal array/string passed to a non-const parameter - Radical - 2021-01-20

(2021-01-19, 09:12 PM)Behemoth Wrote: Well, I've fixed it... I don't know why this removes the warning, but it works so I guess that's all that matters. If someone could explain why this works instead of the original method, I'd appreciate that.



Code:
new

timer[12], int[12];

format(timer, sizeof(timer), "KickTimer");

format(int, sizeof(int), "i");

SetTimerEx(timer, 100, false, int, playerid);

return 1;



You're using the old includes.

Get the updated ones here:

https://github.com/pawn-lang/pawn-stdlib



Or disable them. (Not recommended)

#pragma warning disable 239, 214, 217


RE: [Help] warning 239: literal array/string passed to a non-const parameter - DarkChildren - 2022-07-31

Repair pawn


RE: [Help] warning 239: literal array/string passed to a non-const parameter - Radical - 2022-08-01

(2022-07-31, 10:24 PM)DarkChildren Wrote: Repair pawn



This post is for 2021 ??