Errors on my rental script.
#1

I have this errors:
pawn Код:
C:\Users\Jamie\Desktop\SAMP\gamemodes\SFRP.pwn(186) : error 012: invalid function call, not a valid address
C:\Users\Jamie\Desktop\SAMP\gamemodes\SFRP.pwn(186) : warning 215: expression has no effect
C:\Users\Jamie\Desktop\SAMP\gamemodes\SFRP.pwn(186) : error 001: expected token: ";", but found ")"
C:\Users\Jamie\Desktop\SAMP\gamemodes\SFRP.pwn(186) : error 029: invalid expression, assumed zero
C:\Users\Jamie\Desktop\SAMP\gamemodes\SFRP.pwn(186) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if (newstate == 2)
    {
        if (oldstate == 1)
        {
            new
                vID = GetPlayerVehicleID(playerid);
            if (!IsRentedCar(vID)) // Line 186
            {
                    new String[128];
                    format(String, 128, "~p~~n~rent cost: ~b~%d~n~~w~type ~b~/rentcar~n~~w~to exit it type~n~~p~/exitrental", RENT_COST);
                    GameTextForPlayer(playerid, String, 30000, 4);
                    SendClientMessage(playerid, -1, "Type {3399CC}/exitrental{FFFFFF} to exit this rental car.");
                    TogglePlayerControllable(playerid, 0);
            }
                else if (IsRentedCar(vID))
                {
                 if (GetPVarInt(playerid, "CarRentID") == vID)
                    {
                        return SendClientMessage(playerid, -1, "{3399CC}Welcome{FFFFFF} to your rented car.");
                    }
                    else if (GetPVarInt(playerid, "CarRentID") != vID)
                    {
                        new
                            String[128];
                        format(String, 128, "This vehicle is rented by: {3399CC}%s{FFFFFF}", RentedBy[vID]);
                        SendClientMessage(playerid, -1, String);
                        SendClientMessage(playerid, -1, "Use {3399CC}/exitrental{FFFFFF} to exit this vehicle.");
                        return 1;
                    }
                }
   }
        }
    }
    return 0;
}
Reply
#2

Can you show the IsRentedCar function?
Reply
#3

pawn Код:
new IsRentedCar[MAX_VEHICLES];
Reply
#4

I've tried updating it like this:
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if (newstate == 2)
    {
        if (oldstate == 1)
        {
            new
                vID = GetPlayerVehicleID(playerid);
            if (IsRentableCar(vID))
            {
                if (!IsRentedCar(vID))
                {
                    new
                        String[128];
                    format(String, 128, "~p~~n~rent cost: ~b~%d~n~~w~type ~b~/rentcar~n~~w~to exit it type~n~~p~/exitrental", RENT_COST);
                    GameTextForPlayer(playerid, String, 30000, 4);
                    SendClientMessage(playerid, -1, "Type {3399CC}/exitrental{FFFFFF} to exit this rental car.");
                    TogglePlayerControllable(playerid, 0);
                }
                else if (IsRentedCar(vID))
                {
                    if (GetPVarInt(playerid, "CarRentID") == vID)
                    {
                        return SendClientMessage(playerid, -1, "{3399CC}Welcome{FFFFFF} to your rented car.");
                    }
                    else if (GetPVarInt(playerid, "CarRentID") != vID)
                    {
                        new
                            String[128];
                        format(String, 128, "This vehicle is rented by: {3399CC}%s{FFFFFF}", RentedBy[vID]);
                        SendClientMessage(playerid, -1, String);
                        SendClientMessage(playerid, -1, "Use {3399CC}/exitrental{FFFFFF} to exit this vehicle.");
                        return 1;
                    }
                }
            }
        }
    }
    return 0;
}
But I still get errors.
Reply
#5

Oh, it's variable. You should replace with
pawn Код:
IsRentableCar[vID]
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)