• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] Compilation error
#1
I recieve this error message 
Quote:C:\Users\unity\Documents\Server\qawno\include\sscanf2.inc(33) : user error: Please include <a_npc> or <a_samp> first.

Compilation aborted.

Pawn compiler 3.10.11 Copyright © 1997-2006, ITB CompuPhase


but in my gamemode file it is already included 

Image

Please help me someone
  Reply
#2
Update! Ive fixed it ! But now i have some another issues and i need help to fix it!

There is a list of errors
  Reply
#3
Oh, you added open.mp include so you have a two solutions:

1. Add #define SAMP_COMPAT before your includes.
2. Find actual callbacks syntax (it's different) on open.mp wiki and just replace it + for weapons id you should use macro definitions (not ID's). Probably textdraws need it too.

First solution is's definitly a good option for you, beacause you don't need change anything in your code. Just add this define SAMP_COMPAT and gamemode should be build succesful.

In line 51910 you have a redefinition of GetWeaponSlot function. It's arleady defined by default.
  Reply
#4
(2025-09-06, 04:58 PM)MrKacu13 Wrote: Oh, you added open.mp include so you have a two solutions:

1. Add #define SAMP_COMPAT before your includes.
2. Find actual callbacks syntax (it's different) on open.mp wiki and just replace it + for weapons id you should use macro definitions (not ID's). Probably textdraws need it too.

First solution is's definitly a good option for you, beacause you don't need change anything in your code. Just add this define SAMP_COMPAT and gamemode should be build succesful.

In line 51910 you have a redefinition of GetWeaponSlot function. It's arleady defined by default.

There is one more error :

Error and code
  Reply
#5
This is a stock :

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 stringTos;// Convert(time[0]/1000, timew[0]);//51
}
  Reply
#6
Lightbulb 
I've already found an issue (chatGPT helped me) :)

This happened because my
Code:
Convert
 function was trying to
Code:
return stringTos;
, but in Pawn you cannot return arrays of unknown size.

The solution was to remove the
Code:
return
statement and simply let the function fill the string that is passed by reference. The function call stays the same:

Code:
new time[32];

Convert(GetPVarInt(playerid, "schet_time_to_finish"), time);

Thanks to ChatGPT for helping me figure this out!
  Reply
#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


Forum Jump: