SA-MP Forums Archive
error 035 - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: error 035 (/showthread.php?tid=397763)



error 035 - Stefand - 06.12.2012

pawn Код:
command(checkinactivehouses, playerid, params[])
{
    new string[128], Day, Month, Year;
    if(sscanf(params, "ddd", Day, Month, Year))
    {
        if(Player[playerid][AdminLevel] >= 6)
        {
            SendClientMessage(playerid, WHITE, "SYNTAX: /checkinactivehouses [day] [month] [year]");
        }
    }
    else
    {
        if(Player[playerid][AdminLevel] >= 6)
        {
            SCM(playerid, COLOR_ORANGE, ".: Inactive Houses :.");
            new CheckDate;
            format(CheckDate, sizeof(CheckDate), "%02d/%02d/%d", Day, Month, Year);
            new FileName[128];
            for(new i = 0; i < MAX_HOUSES; i++)
            {
                format(FileName, sizeof(FileName), "Houses/House_%d.ini", i);
                if(fexist(FileName))
                {
                    Houses[i][OwnerLastLogin] = dini_Int(FileName, "OwnerLastLogin");
                    if(CheckDate < Houses[i][OwnerLastLogin])
                    {
                        format(string, sizeof(string), "House id: %d", i);
                        SCM(playerid, SERVERCOLOR, string);
                    }
               }
            }
            SCM(playerid, ADMINBLUE, "Use /asellproperty [id], to asell them, use /autoasell to sell them all.");
        }
    }
    return 1;
}

command(asellinactivehouses, playerid, params[])
{
    new string[128], string1[128], Day, Month, Year, CountHouses, OwnerName[255];
    if(sscanf(params, "ddd", Day, Month, Year))
    {
        if(Player[playerid][AdminLevel] >= 6)
        {
            SendClientMessage(playerid, WHITE, "SYNTAX: /asellinactivehouses [day] [month] [year]");
        }
    }
    else
    {
        if(Player[playerid][AdminLevel] >= 6)
        {
            SCM(playerid, COLOR_ORANGE, ".: Inactive Houses :.");
            new CheckDate;
            format(CheckDate, sizeof(CheckDate), "%02d/%02d/%d", Day, Month, Year);
            new FileName[128];
            for(new i = 0; i < MAX_HOUSES; i++)
            {
                format(FileName, sizeof(FileName), "Houses/House_%d.ini", i);
                if(fexist(FileName))
                {
                    Houses[i][OwnerLastLogin] = dini_Int(FileName, "OwnerLastLogin");
                    if(CheckDate < Houses[i][OwnerLastLogin])
                    {
                        CountHouses++;
                       
                        format(OwnerName, sizeof(OwnerName), Houses[i][Owner]);
                       
                        format(string1, sizeof(string1), "Accounts/%s.ini", OwnerName);
                        if(fexist(string1))
                        {
                                dini_IntSet(string1, "House", -1);
                        }
                    }
                }
            }
            format(string, sizeof(string), "All inactive houses from %d have been cleared. (Total: %d)", CheckDate, CountHouses);
            SCM(playerid, YELLOW, string);
            CountHouses = 0;
        }
    }
    return 1;
}
gives these errors:

Код:
C:\Users\User\Desktop\GTA SA\Scratch RolePlay\gamemodes\RP.pwn(2775) : error 035: argument type mismatch (argument 1)
C:\Users\User\Desktop\GTA SA\Scratch RolePlay\gamemodes\RP.pwn(2775) : error 035: argument type mismatch (argument 1)
C:\Users\User\Desktop\GTA SA\Scratch RolePlay\gamemodes\RP.pwn(2812) : error 035: argument type mismatch (argument 1)
C:\Users\User\Desktop\GTA SA\Scratch RolePlay\gamemodes\RP.pwn(2812) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
The error lines:
pawn Код:
Line 2775:
            format(CheckDate, sizeof(CheckDate), "%02d/%02d/%d", Day, Month, Year);

Line 2812:
            format(CheckDate, sizeof(CheckDate), "%02d/%02d/%d", Day, Month, Year);



Re: error 035 - LarzI - 06.12.2012

You're trying to format CheckDate, which you have defined as an integer.

To fix this, you easily have to make CheckDate into an array for it to be used as a string:
pawn Код:
new CheckDate[14]; //12 will probably be enough, but I put 14 just to be sure.