COMMAND ERROR GARAGE SYSTEM
#1

Hello, I would like to adapt my gamemode garages system and let me know my mistake.

Please, help me.

ERROR:
Код:
format(GarageInfo[idx][gOwner], 32, "%s", RPNU(playerid));
COMMAND:
Код:
CMD:buygarage(playerid, params[])
{
        new string[128], done, RPNU;
        if(Info[playerid][pAdmin] != 6) return SendClientMessage(playerid, -1, "You are not Admin Man!");
        if(Info[playerid][pGarage]) return SendClientMessage(playerid, COLOR_GREY, "You already own a garage.");
        for(new idx=1; idx<MAX_GARAGES; idx++)
        {
            if(IsPlayerInRangeOfPoint(playerid, 3, GarageInfo[idx][gX], GarageInfo[idx][gY], GarageInfo[idx][gZ]))
            {
                        if(!strcmp("The State", GarageInfo[idx][gOwner], false))
                        {
                            if(Info[playerid][pCash] < GarageInfo[idx][gPrice]) return SendClientMessage(playerid, COLOR_WHITE, "You don't have enough money to buy this garage.");
                            GivePlayerCash(playerid, -GarageInfo[idx][gPrice]);
                            if(Info[playerid][pGarage]) Info[playerid][pGarage] = idx;
                            else Info[playerid][pGarage] = idx;
                            format(GarageInfo[idx][gOwner], 32, "%s", RPNU(playerid));
                            format(string, sizeof(string), COLOR_WHITE, "%d,\n Garage (Lvl: %d)\nOwner %s", idx, GarageInfo[idx][gLevel], GarageInfo[idx][gOwner]);
                            UpdateDynamic3DTextLabelText(GarageInfo[idx][gText], COLOR_WHITE, string);
                            SendClientMessage(playerid, COLOR_WHITE, " You have successfully bought a garage.");
                            format(string, sizeof(string), "%s has bought garage id %d.", RPN(playerid), idx);
                            Log("logs/garage.log", string);
							//Log("logs/garage.log", string);
                            idx = MAX_GARAGES;
                            done = 1;
                        }
                        if(idx == MAX_GARAGES-1 && !done)
                        {
                            SendClientMessage(playerid, COLOR_GREY, "This garage is owned by someone else.");
                        }
            }
            if(idx == MAX_GARAGES-1 && !done)
            {
                SendClientMessage(playerid, COLOR_GREY, "You are not near a buyable garage.");
            }
        }
        return 1;
}
Reply
#2

What is your problem?
Reply
#3

Hi Imperor, my problem is:

Код:
4 Errors.
error 012: invalid function call, not a valid address
warning 215: expression has no effect
error 001: expected token: ";", but found ")"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
LINE:
Код:
format(GarageInfo[idx][gOwner], 32, "%s", RPNU(playerid));
Reply
#4

Could you show the line you're getting errors?
Reply
#5

In the previous review it cleared

Line ERROR:
Код:
format(GarageInfo[idx][gOwner], 32, "%s", RPNU(playerid));
Reply
#6

Use this
pawn Код:
CMD:buygarage(playerid, params[])
{
        new string[128], done, RPNU;
        if(Info[playerid][pAdmin] != 6) return SendClientMessage(playerid, -1, "You are not Admin Man!");
        if(Info[playerid][pGarage]) return SendClientMessage(playerid, COLOR_GREY, "You already own a garage.");
        for(new idx=1; idx<MAX_GARAGES; idx++)
        {
            if(IsPlayerInRangeOfPoint(playerid, 3, GarageInfo[idx][gX], GarageInfo[idx][gY], GarageInfo[idx][gZ]))
            {
                        if(!strcmp("The State", GarageInfo[idx][gOwner], false))
                        {
                            if(Info[playerid][pCash] < GarageInfo[idx][gPrice]) return SendClientMessage(playerid, COLOR_WHITE, "You don't have enough money to buy this garage.");
                            GivePlayerCash(playerid, -GarageInfo[idx][gPrice]);
                            if(Info[playerid][pGarage]) Info[playerid][pGarage] = idx;
                            else Info[playerid][pGarage] = idx;
                            format(GarageInfo[idx][gOwner], 32, "%s", RPNU(playerid));
                            format(string, sizeof(string), "%d\n Garage (Lvl: %d)\nOwner %s", idx, GarageInfo[idx][gLevel], GarageInfo[idx][gOwner]);
                            UpdateDynamic3DTextLabelText(GarageInfo[idx][gText], COLOR_WHITE, string);
                            SendClientMessage(playerid, COLOR_WHITE, " You have successfully bought a garage.");
                            format(string, sizeof(string), "%s has bought garage id %d.", RPN(playerid), idx);
                            Log("logs/garage.log", string);
                            //Log("logs/garage.log", string);
                            idx = MAX_GARAGES;
                            done = 1;
                        }
                        if(idx == MAX_GARAGES-1 && !done)
                        {
                            SendClientMessage(playerid, COLOR_GREY, "This garage is owned by someone else.");
                        }
            }
            if(idx == MAX_GARAGES-1 && !done)
            {
                SendClientMessage(playerid, COLOR_GREY, "You are not near a buyable garage.");
            }
        }
        return 1;
}
Plus you had been showing a wrong line where u had errors.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)