Stupid Error :/
#1

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if (GetPlayerVehicleID(playerid) == RentCars)
    {
        GameTextForPlayer(playerid, "This Vehicle is For Rent, Type /rentcar to rent it", 3000, 4);
    }
    return 1;
}
That code gives me this error

Код:
C:\Users\BooNii3\Foxx RP\Foxx RP\Core\gamemodes\Core1.pwn(275) : error 033: array must be indexed (variable "RentCars")
Reply
#2

How much RentCar value ?

OnPlayerEnterVehicle called, if you pressed Enter/F.
Reply
#3

Can you post the part of the code where you define 'RentCars', please?
Reply
#4

pawn Код:
new Float:RentCars[][] =
{
    {-103.8677,1222.1835,19.7359,180.4294}
};
Here you go
Reply
#5

You need to save your vehicleid's to variables.
Reply
#6

As I thought, RentCars is an array, you can't just compare it like that, plus I see nothing in your code where the actual vehicle ID is defined. Your code makes no absolutely sense. And I just want to add, this isn't a "stupid error", it's called proper scripting.

Quote:
Originally Posted by MadeMan
Посмотреть сообщение
pawn Код:
IsRentCar(vehicleid)
{
    for(new i=0; i < sizeof(RentCars); i++)
    {
        if(RentCars[i] == vehicleid)
        {
            return 1;
        }
    }
    return 0;
}
Use this function and it should work.

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if (IsRentCar(vehicleid))
    {
        GameTextForPlayer(playerid, "This Vehicle is For Rent, Type /rentcar to rent it", 3000, 4);
    }
    return 1;
}
Did you bother looking at his 2d array?
Reply
#7

I gave that a go but I got the same error
Код:
error 033: array must be indexed (variable "RentCars")

Sorry Calgon I am just learning, I am trying my best to make this..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)