Burgershot
  • Home
  • Members
  • Team
  • Help
  • Search
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search
Burgershot SA-MP Pawn Scripting [Pawn] [Help] warning 239: literal array/string passed to a non-const parameter

 
  • 0 Vote(s) - 0 Average
Pawn [Help] warning 239: literal array/string passed to a non-const parameter
Behemoth
Offline

Burgershot Member
Posts: 25
Threads: 4
Joined: Jan 2021
Reputation: 1
Location: Northern Ireland, UK
#1
2021-01-19, 08:58 PM (This post was last modified: 2021-01-19, 08:58 PM by Behemoth.)
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?
Behemoth
Offline

Burgershot Member
Posts: 25
Threads: 4
Joined: Jan 2021
Reputation: 1
Location: Northern Ireland, UK
#2
2021-01-19, 09:12 PM
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;
Radical
Offline

Burgershot Member
Posts: 148
Threads: 21
Joined: Dec 2020
Reputation: 16
#3
2021-01-20, 11:19 PM (This post was last modified: 2021-01-20, 11:38 PM by Radical.)
(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;


it's wrong.
If you use Zeex's compiler, put this in the top of script:
#pragma warning disable 239, 214, 217

239: literal array/string passed to a non-const parameter
214: possibly a "const" array argument was intended: "array"
217:  loose indentation

These warnings do not matter. You can disable them by entering that pragma code.
But if you do not want to disable it, open a_samp Include and replace 
Code:
SetTimerEx(funcname[], interval, repeating, const format[], {Float,_}:...);
with 
Code:
SetTimerEx(const funcname[], interval, repeating, const format[], {Float,_}:...);
« Next Oldest | Next Newest »



  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Burgershot - Powered by our Community and MyBB Original Theme by Emerald

Linear Mode
Threaded Mode