SA-MP Forums Archive
COMMAND ERROR GARAGE SYSTEM - 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: COMMAND ERROR GARAGE SYSTEM (/showthread.php?tid=518994)



COMMAND ERROR GARAGE SYSTEM - Shura - 12.06.2014

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;
}



Re: COMMAND ERROR GARAGE SYSTEM - Laure - 12.06.2014

What is your problem?


Respuesta: COMMAND ERROR GARAGE SYSTEM - Shura - 12.06.2014

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));



Re: COMMAND ERROR GARAGE SYSTEM - Laure - 12.06.2014

Could you show the line you're getting errors?


Respuesta: COMMAND ERROR GARAGE SYSTEM - Shura - 12.06.2014

In the previous review it cleared

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



Re: COMMAND ERROR GARAGE SYSTEM - Laure - 12.06.2014

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.