Problem
#1

At first, Hello all! Here is my problem:

I have this code:

pawn Код:
else if(strcmp(x_job,"ownablecar1",true) == 0)
            {
                if(OwnableCarOffer[playerid] < 999)
                {
                    if(OwnableCarID[playerid] == 0) { return 1; }
                    if(OwnableCarPrice[playerid] == 0 || OwnableCarPrice[playerid] > 99999999) { return 1; }

                    if(OwnableCarID[playerid] == PlayerInfo[OwnableCarOffer[playerid]]) { }
                    else { SCM(playerid, COLOR_GREY, "  Offer is no longer available"); return 1; }

                    if(GetPlayerMoney(playerid) >= OwnableCarPrice[playerid])
                    {
                        if(IsPlayerConnected(OwnableCarOffer[playerid]))
                        {
                            GetPlayerName(OwnableCarOffer[playerid], giveplayer, sizeof(giveplayer));
                            if(PlayerInfo[playerid][pVehKey1] == 0)
                            {
                                if(GetPlayerVehicleID(OwnableCarOffer[playerid]) == PlayerInfo[OwnableCarOffer[playerid]][pVehKey1])
                                {
                                    PlayerInfo[playerid][pVehKey1] = PlayerInfo[OwnableCarOffer[playerid]][pVehKey1];
                                    PlayerInfo[OwnableCarOffer[playerid]][pVehKey1] = 0;
                                }
                                else
                                {
                                    SCM(playerid, COLOR_GREY, "  Vehicle seller needs to be at his car !");
                                    return 1;
                                }
                                format(string, sizeof(string), "* You bought a car for $%d from %s.",OwnableCarPrice[playerid],giveplayer);
                                SCM(playerid, COLOR_WHITE, string);
                                format(string, sizeof(string), "* %s has bought your car for $%d.",sendername,OwnableCarPrice[playerid]);
                                SCM(OwnableCarOffer[playerid], COLOR_WHITE, string);
                                RemovePlayerFromVehicle(OwnableCarOffer[playerid]);
                                GivePlayerMoney(playerid, - OwnableCarPrice[playerid]);
                                GivePlayerMoney(OwnableCarOffer[playerid], OwnableCarPrice[playerid]);
                                strmid(CarInfo[OwnableCarID[playerid]][cOwner], sendername, 0, strlen(sendername), 999);
                            }
                            else
                            {
                                SCM(playerid, COLOR_GREY, "  You already have 1 car on slot 1 ! ");
                                return 1;
                            }
                            OnCarUpdate();
                            OnPlayerDateUpdate(playerid);
                            OnPlayerDateUpdate(OwnableCarOffer[playerid]);
                            OwnableCarOffer[playerid] = 999;
                            OwnableCarID[playerid] = 0;
                            OwnableCarPrice[playerid] = 0;
                            GameTextForPlayer(playerid, "~w~Congratulations~n~Don't forget to /v park it!", 5000, 3);
                            SCM(playerid, COLOR_GRAD2, "Congratulations on your new purchase!");
                            SCM(playerid, COLOR_GRAD2, "Type /vehiclehelp to view the vehicle manual!");
                            return 1;
                        }
                        else
                        {
                            SCM(playerid, COLOR_GREY, "   Car seller is Offline !");
                            return 1;
                        }
                    }
                }
                else
                {
                    SCM(playerid, COLOR_GREY, "   No-one offerd you any Ownable Car !");
                    return 1;
                }
            }
But when i try to Complie , it gives this error: array must be indexed (variable PlayerInfo ) this error is on line 51765 and here is line 51765:

pawn Код:
if(OwnableCarID[playerid] == PlayerInfo[OwnableCarOffer[playerid]]) { }
Any help will be appreciated.

Thanks in advance!
Reply
#2

BUMP!
Reply
#3

Show us the enum/array PlayerInfo gets it's data from.

But could it be that
pawn Код:
if(OwnableCarID[playerid] == PlayerInfo[OwnableCarOffer[playerid]]) { }
Should be
pawn Код:
if(OwnableCarID[playerid] == PlayerInfo[playerid][OwnableCarOffer[playerid]]) { }
?
Reply
#4

EDIT:Late
Try this:
pawn Код:
if(OwnableCarID[playerid] == PlayerInfo[playerid][OwnableCarOffer[playerid]]) { }
Reply
#5

Quote:
Originally Posted by Drebin
Посмотреть сообщение
Show us the enum/array PlayerInfo gets it's data from.

But could it be that
pawn Код:
if(OwnableCarID[playerid] == PlayerInfo[OwnableCarOffer[playerid]]) { }
Should be
pawn Код:
if(OwnableCarID[playerid] == PlayerInfo[playerid][OwnableCarOffer[playerid]]) { }
?
No.. actually OwnableCarOffer is the one who offers the car , so it's a player...

Anyways tried that and now this error appears , replacing the older one:

pawn Код:
error 033: array must be indexed (variable "OwnableCarOffer")
Also tried your method , Faisal_khan , but I get tag mismatch warning...
Reply
#6

BUMP!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)