[Tutorial] How to fix "warning 202: number of arguments does not match definition" on SA:MP 0.3.7
#1

How to fix "warning 202: number of arguments does not match definition" on SA:MP 0.3.7


Hi all, this is my first tutorial and I'm sure that this will help you.

After updated our SA:MP server to 0.3.7, he compiled our gamemode.
A lot of people say that pawno say: warning 202: number of arguments does not match definition.

In this tutorial I will help you to find a solution.

First solution
Go to your include's folder.
Open "a_vehicles.inc".
Press "CTRL + F"
Write in the line: "CreateVehicle"
Now check the parameters of "CreateVehicle". If addsiren = 0 it's write, ok.

If addsiren is written, that isn't your solution. Else if isn't written, download SA-MP Server on the SA:MP's site and replace all include with your.

Second solution
Go to your'include's folder.
Check an Vehicle include. Example: I have GetVehicleColor by Ryder.
Open your include.
Check "CreateVehicle" line and check the parameters.
if the siren parameter isn't written, just do it.

Question: How can I write the parameter?

Here's an example that I did. (by GetVehicleColor by Ryder):

PHP код:
stock n_CreateVehicle(modelIDFloatspawn_XFloatspawn_YFloatspawn_ZFloatz_Anglecolor1color2respawn_Delayyourvariable 0)
{
        if(
color1 || color2 0)
        {
                
color1 random(127);
                
color2 random(127);
        }
        
modelID CreateVehicle(modelIDspawn_Xspawn_Yspawn_Zz_Anglecolor1color2respawn_Delayyourvariable);
       
        new
                
colorStr[24]
        ;      
        
format(colorStrsizeof(colorStr), "%d-%d"color1color2);
        
setproperty(_""PROPERTY_OFFSET(modelID), colorStr);
       
        return 
modelID;

If you want full GetVehicleColor include updated: here


Now save it and re-compile your gamemode.

if everything it's ok, good job! Else probably in your include's folder there's an another include that handles the vehicles.

This tutorial is finish, I hope you fix your problem...

Good bye and thank you for the reading.

I'm sorry if there're some grammatical errors but I'm italian.

P.S: If there're errors, please tell me and I'll edit the thread. Thank you.

Reply
#2

Didn't get any errors but some warnings

Код:
C:\Users\Win7\Desktop\sa-mp 0.3.7\pawno\include\GetVehicleColor.inc(125) : warning 201: redefinition of constant/macro (symbol "AddStaticVehicle")
C:\Users\Win7\Desktop\sa-mp 0.3.7\pawno\include\GetVehicleColor.inc(126) : warning 201: redefinition of constant/macro (symbol "AddStaticVehicleEx")
C:\Users\Win7\Desktop\sa-mp 0.3.7\pawno\include\GetVehicleColor.inc(127) : warning 201: redefinition of constant/macro (symbol "CreateVehicle")
C:\Users\Win7\Desktop\sa-mp 0.3.7\pawno\include\GetVehicleColor.inc(128) : warning 201: redefinition of constant/macro (symbol "DestroyVehicle")
Reply
#3

-deleted-
Reply
#4

- Added full GetVehicleColor include.
Reply
#5

Quote:
Originally Posted by ihatetn931
Посмотреть сообщение
Didn't get any errors but some warnings

Код:
C:\Users\Win7\Desktop\sa-mp 0.3.7\pawno\include\GetVehicleColor.inc(125) : warning 201: redefinition of constant/macro (symbol "AddStaticVehicle")
C:\Users\Win7\Desktop\sa-mp 0.3.7\pawno\include\GetVehicleColor.inc(126) : warning 201: redefinition of constant/macro (symbol "AddStaticVehicleEx")
C:\Users\Win7\Desktop\sa-mp 0.3.7\pawno\include\GetVehicleColor.inc(127) : warning 201: redefinition of constant/macro (symbol "CreateVehicle")
C:\Users\Win7\Desktop\sa-mp 0.3.7\pawno\include\GetVehicleColor.inc(128) : warning 201: redefinition of constant/macro (symbol "DestroyVehicle")
They functions are not hooked: https://sampforum.blast.hk/showthread.php?tid=571153
Reply
#6

Quote:
Originally Posted by ihatetn931
Посмотреть сообщение
Didn't get any errors but some warnings

Код:
C:\Users\Win7\Desktop\sa-mp 0.3.7\pawno\include\GetVehicleColor.inc(125) : warning 201: redefinition of constant/macro (symbol "AddStaticVehicle")
C:\Users\Win7\Desktop\sa-mp 0.3.7\pawno\include\GetVehicleColor.inc(126) : warning 201: redefinition of constant/macro (symbol "AddStaticVehicleEx")
C:\Users\Win7\Desktop\sa-mp 0.3.7\pawno\include\GetVehicleColor.inc(127) : warning 201: redefinition of constant/macro (symbol "CreateVehicle")
C:\Users\Win7\Desktop\sa-mp 0.3.7\pawno\include\GetVehicleColor.inc(128) : warning 201: redefinition of constant/macro (symbol "DestroyVehicle")
Check if there're

#define AddStaticVehicle n_AddStaticVehicle
#define AddStaticVehicleEx n_AddStaticVehicleEx
#define CreateVehicle n_CreateVehicle
#define DestroyVehicle n_DestroyVehicle
#define ChangeVehicleColor n_ChangeVehicleColor


If there aren't write it else copy all include updated and paste.
Reply
#7

They are there, here is the include i got, nothing has been changed in the include but the addsiren.

PHP код:
/*
    SA-MP "GetVehicleColor v2.1" Include
    Copyright © 2011 RyDeR`
*/
#if defined _Included_GetVehicleColor
    #endinput
#endif
#define _Included_GetVehicleColor
#define PROPERTY_OFFSET(%0) \
    
((((%0) * ((%0) << 1)) << 2) + 65536)
stock n_AddStaticVehicle(modelIDFloat:spawn_XFloat:spawn_YFloat:spawn_ZFloat:z_Anglecolor1color2)
{
    if(
color1 || color2 0)
    {
        
color1 random(255);
        
color2 random(255);
    }
    
modelID AddStaticVehicle(modelIDspawn_Xspawn_Yspawn_Zz_Anglecolor1color2);
    new
        
colorStr[24]
    ;
    
format(colorStrsizeof(colorStr), "%d-%d"color1color2);
    
setproperty(_""PROPERTY_OFFSET(modelID), colorStr);
    return 
modelID;
}
stock n_AddStaticVehicleEx(modelIDFloat:spawn_XFloat:spawn_YFloat:spawn_ZFloat:z_Anglecolor1color2respawn_Delayaddsiren 0)
{
    if(
color1 || color2 0)
    {
        
color1 random(255);
        
color2 random(255);
    }
    
modelID AddStaticVehicleEx(modelIDspawn_Xspawn_Yspawn_Zz_Anglecolor1color2respawn_Delayaddsiren);
    new
        
colorStr[24]
    ;
    
format(colorStrsizeof(colorStr), "%d-%d"color1color2);
    
setproperty(_""PROPERTY_OFFSET(modelID), colorStr);
    return 
modelID;
}
stock n_CreateVehicle(modelIDFloat:spawn_XFloat:spawn_YFloat:spawn_ZFloat:z_Anglecolor1color2respawn_Delayaddsiren 0)
{
    if(
color1 || color2 0)
    {
        
color1 random(255);
        
color2 random(255);
    }
    
modelID CreateVehicle(modelIDspawn_Xspawn_Yspawn_Zz_Anglecolor1color2respawn_Delayaddsiren);
    new
        
colorStr[24]
    ;
    
format(colorStrsizeof(colorStr), "%d-%d"color1color2);
    
setproperty(_""PROPERTY_OFFSET(modelID), colorStr);
    return 
modelID;
}
stock n_DestroyVehicle(vehicleID)
{
    
deleteproperty(_""PROPERTY_OFFSET(vehicleID));
    return 
DestroyVehicle(vehicleID);
}
stock n_ChangeVehicleColor(vehicleIDcolor1color2)
{
    new
        
colorStr[24]
    ;
    
format(colorStrsizeof(colorStr), "%d-%d"color1color2);
    
setproperty(_""PROPERTY_OFFSET(vehicleID), colorStr);
    return 
ChangeVehicleColor(vehicleIDcolor1color2);
}
public 
OnVehicleRespray(playeridvehicleidcolor1color2)
{
    new
        
colorStr[24]
    ;
    
format(colorStrsizeof(colorStr), "%d-%d"color1color2);
    
setproperty(_""PROPERTY_OFFSET(vehicleid), colorStr);
    if(
funcidx("n_OnVehicleRespray") != -1)
    {
        return 
CallLocalFunction("n_OnVehicleRespray""iiii"playeridvehicleidcolor1color2);
    }
    return 
1;
}
stock GetVehicleColor(vehicleID, &color1, &color2)
{
    
vehicleID PROPERTY_OFFSET(vehicleID);
    if(
existproperty(_""vehicleID))
    {
        new
            
colorStr[24],
            
strPos
        
;
        
getproperty(_""vehicleIDcolorStr);
        
strunpack(colorStrcolorStr);
        if((
strPos strfind(colorStr"-")) != -1)
        {
            
color1 strval(colorStr);
            
color2 strval(colorStr[strPos 1]);
            return 
1;
        }
    }
    return 
0;
}
#define AddStaticVehicle n_AddStaticVehicle
#define AddStaticVehicleEx n_AddStaticVehicleEx
#define CreateVehicle n_CreateVehicle
#define DestroyVehicle n_DestroyVehicle
#define ChangeVehicleColor n_ChangeVehicleColor
#if defined _ALS_OnVehicleRespray
    #undef OnVehicleRespray
#else
    #define _ALS_OnVehicleRespray
#endif
#define OnVehicleRespray n_OnVehicleRespray
forward n_OnVehicleRespray(playeridvehicleidcolor1color2); 
Reply
#8

Quote:
Originally Posted by ihatetn931
Посмотреть сообщение
They are there, here is the include i got

PHP код:
/*
    SA-MP "GetVehicleColor v2.1" Include
    Copyright © 2011 RyDeR`
*/
#if defined _Included_GetVehicleColor
    #endinput
#endif
#define _Included_GetVehicleColor
#define PROPERTY_OFFSET(%0) \
    
((((%0) * ((%0) << 1)) << 2) + 65536)
stock n_AddStaticVehicle(modelIDFloat:spawn_XFloat:spawn_YFloat:spawn_ZFloat:z_Anglecolor1color2)
{
    if(
color1 || color2 0)
    {
        
color1 random(255);
        
color2 random(255);
    }
    
modelID AddStaticVehicle(modelIDspawn_Xspawn_Yspawn_Zz_Anglecolor1color2);
    new
        
colorStr[24]
    ;
    
format(colorStrsizeof(colorStr), "%d-%d"color1color2);
    
setproperty(_""PROPERTY_OFFSET(modelID), colorStr);
    return 
modelID;
}
stock n_AddStaticVehicleEx(modelIDFloat:spawn_XFloat:spawn_YFloat:spawn_ZFloat:z_Anglecolor1color2respawn_Delayaddsiren 0)
{
    if(
color1 || color2 0)
    {
        
color1 random(255);
        
color2 random(255);
    }
    
modelID AddStaticVehicleEx(modelIDspawn_Xspawn_Yspawn_Zz_Anglecolor1color2respawn_Delayaddsiren);
    new
        
colorStr[24]
    ;
    
format(colorStrsizeof(colorStr), "%d-%d"color1color2);
    
setproperty(_""PROPERTY_OFFSET(modelID), colorStr);
    return 
modelID;
}
stock n_CreateVehicle(modelIDFloat:spawn_XFloat:spawn_YFloat:spawn_ZFloat:z_Anglecolor1color2respawn_Delayaddsiren 0)
{
    if(
color1 || color2 0)
    {
        
color1 random(255);
        
color2 random(255);
    }
    
modelID CreateVehicle(modelIDspawn_Xspawn_Yspawn_Zz_Anglecolor1color2respawn_Delayaddsiren);
    new
        
colorStr[24]
    ;
    
format(colorStrsizeof(colorStr), "%d-%d"color1color2);
    
setproperty(_""PROPERTY_OFFSET(modelID), colorStr);
    return 
modelID;
}
stock n_DestroyVehicle(vehicleID)
{
    
deleteproperty(_""PROPERTY_OFFSET(vehicleID));
    return 
DestroyVehicle(vehicleID);
}
stock n_ChangeVehicleColor(vehicleIDcolor1color2)
{
    new
        
colorStr[24]
    ;
    
format(colorStrsizeof(colorStr), "%d-%d"color1color2);
    
setproperty(_""PROPERTY_OFFSET(vehicleID), colorStr);
    return 
ChangeVehicleColor(vehicleIDcolor1color2);
}
public 
OnVehicleRespray(playeridvehicleidcolor1color2)
{
    new
        
colorStr[24]
    ;
    
format(colorStrsizeof(colorStr), "%d-%d"color1color2);
    
setproperty(_""PROPERTY_OFFSET(vehicleid), colorStr);
    if(
funcidx("n_OnVehicleRespray") != -1)
    {
        return 
CallLocalFunction("n_OnVehicleRespray""iiii"playeridvehicleidcolor1color2);
    }
    return 
1;
}
stock GetVehicleColor(vehicleID, &color1, &color2)
{
    
vehicleID PROPERTY_OFFSET(vehicleID);
    if(
existproperty(_""vehicleID))
    {
        new
            
colorStr[24],
            
strPos
        
;
        
getproperty(_""vehicleIDcolorStr);
        
strunpack(colorStrcolorStr);
        if((
strPos strfind(colorStr"-")) != -1)
        {
            
color1 strval(colorStr);
            
color2 strval(colorStr[strPos 1]);
            return 
1;
        }
    }
    return 
0;
}
#define AddStaticVehicle n_AddStaticVehicle
#define AddStaticVehicleEx n_AddStaticVehicleEx
#define CreateVehicle n_CreateVehicle
#define DestroyVehicle n_DestroyVehicle
#define ChangeVehicleColor n_ChangeVehicleColor
#if defined _ALS_OnVehicleRespray
    #undef OnVehicleRespray
#else
    #define _ALS_OnVehicleRespray
#endif
#define OnVehicleRespray n_OnVehicleRespray
forward n_OnVehicleRespray(playeridvehicleidcolor1color2); 
Mmh, try to change addsiren with another name. Or try to include: #include "a_samp"
Reply
#9

I actually did try that, but that shouldn't be the issue tho since it's show for all of them
Код:
C:\Users\Win7\Desktop\sa-mp 0.3.7\pawno\include\GetVehicleColor.inc(124) : warning 201: redefinition of constant/macro (symbol "AddStaticVehicle")
C:\Users\Win7\Desktop\sa-mp 0.3.7\pawno\include\GetVehicleColor.inc(125) : warning 201: redefinition of constant/macro (symbol "AddStaticVehicleEx")
C:\Users\Win7\Desktop\sa-mp 0.3.7\pawno\include\GetVehicleColor.inc(126) : warning 201: redefinition of constant/macro (symbol "CreateVehicle")
C:\Users\Win7\Desktop\sa-mp 0.3.7\pawno\include\GetVehicleColor.inc(127) : warning 201: redefinition of constant/macro (symbol "DestroyVehicle")
These were not updated

DestroyVehicle
AddStaticVehicle


now if i do this

PHP код:
#define n_CreateVehicle CreateVehicle 
The warnings go away, but since i'm waiting for an issue i'm having with ysi i can't test if that's a legit fix or not, i don't think it is tho.

Adding
PHP код:
#include <a_samp> 
Dosen't work either

Doing this
PHP код:
#if defined _ALS_CreateVehicle
    #undef CreateVehicle
#else
    #define _ALS_CreateVehicle
#endif 
Gets rid of the warnings as well
Reply
#10

In the gamemode do you use CreateVehicle or n_CreateVehicle?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)