Multiple errors
#1

Код:
enum TeamCars
{
t11,
t12,
t13,
t14,
t15,
t16,
t17,
t18,
}
new Cars[TeamCars];
Код:
     Cars[t11] = AddStaticVehicle(599, 2256.3552, 2442.9207, 10.8203, 0.3703, 0, 1);
     Cars[t12] = AddStaticVehicle(599, 2273.5859, 2442.5735, 10.8203, 0.6836, 0, 1);
     Cars[t13] = AddStaticVehicle(598, 2282.4177, 2442.0291, 10.8203, 0.0569, 0, 1);
     Cars[t14] = AddStaticVehicle(598, 282.3342, 2460.3645, 10.8203, 0.3703, 0, 1);
     Cars[t15] = AddStaticVehicle(598, 2282.4211, 2477.4626, 10.8203, 180.3703, 0, 1);
     Cars[t16] = AddStaticVehicle(598, 2273.5168, 2477.7397, 10.8203, 178.9719, 0, 1);
     Cars[t17] = AddStaticVehicle(523, 2256.3137, 2477.9875, 10.8203, 178.6586, 0, 1);
     Cars[t18] = AddStaticVehicle(523, 2251.5366, 2478.1582, 10.8203, 180.2253, 0, 1);
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == 2)
    {
      new VehCheck = GetPlayerVehicleID(playerid);
    if(VehCheck == Cars[t11] || VehCheck == Cars[t12] || VehCheck == Cars[t13] || VehCheck == Cars[t14] || VehCheck == Cars[t15] || VehCheck == Cars[t16] || VehCheck == Cars[16] || VehCheck == Cars[17] || VehCheck == Cars[18])
        {
            if(!PlayerInfo[playerid][Team] = Cops))
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_RED, "You Don't have the keys for this car.");
            return 1;
            }
            else
            {
                return 1;
            }
        }

      return 1;
    }
    return 1;
}
Код:
C:\Users\Elmo\Desktop\SAMP Project\gamemodes\Freeroam.pwn(369) : warning 213: tag mismatch
C:\Users\Elmo\Desktop\SAMP Project\gamemodes\Freeroam.pwn(369) : error 032: array index out of bounds (variable "Cars")
C:\Users\Elmo\Desktop\SAMP Project\gamemodes\Freeroam.pwn(371) : warning 211: possibly unintended assignment
C:\Users\Elmo\Desktop\SAMP Project\gamemodes\Freeroam.pwn(371) : error 022: must be lvalue (non-constant)
C:\Users\Elmo\Desktop\SAMP Project\gamemodes\Freeroam.pwn(371) : warning 215: expression has no effect
C:\Users\Elmo\Desktop\SAMP Project\gamemodes\Freeroam.pwn(371) : error 001: expected token: ";", but found ")"
C:\Users\Elmo\Desktop\SAMP Project\gamemodes\Freeroam.pwn(371) : error 029: invalid expression, assumed zero
C:\Users\Elmo\Desktop\SAMP Project\gamemodes\Freeroam.pwn(371) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
Reply
#2

Why not use arrays,

pawn Код:
new Cars[19];
//instead of enum, so it goes like

Cars[1] = CreateVehicle(..............................);
Cars[2] = CreateVehicle(..............................);
Reply
#3

Because it's how I like to do it.
I just need these error's fixed?:P
Reply
#4

pawn Код:
enum TeamCars[9][] =
{
    t11,
    t12,
    t13,
    t14,
    t15,
    t16,
    t17,
    t18,
};
new Cars[TeamCars];
But i strongly don't recommend enum for this kind of situation.
Reply
#5

Ok so I used the array but now I get these
Код:
C:\Users\Elmo\Desktop\SAMP Project\gamemodes\Freeroam.pwn(360) : warning 211: possibly unintended assignment
C:\Users\Elmo\Desktop\SAMP Project\gamemodes\Freeroam.pwn(360) : error 022: must be lvalue (non-constant)
C:\Users\Elmo\Desktop\SAMP Project\gamemodes\Freeroam.pwn(360) : warning 215: expression has no effect
C:\Users\Elmo\Desktop\SAMP Project\gamemodes\Freeroam.pwn(360) : error 001: expected token: ";", but found ")"
C:\Users\Elmo\Desktop\SAMP Project\gamemodes\Freeroam.pwn(360) : error 029: invalid expression, assumed zero
C:\Users\Elmo\Desktop\SAMP Project\gamemodes\Freeroam.pwn(360) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Yes I edited everything else?:P
Reply
#6

Also show me line 360
Try this,
pawn Код:
new Cars[9];

stock YourCallback()
{
    Cars[1] = AddStaticVehicle(599, 2256.3552, 2442.9207, 10.8203, 0.3703, 0, 1);
    Cars[2] = AddStaticVehicle(599, 2273.5859, 2442.5735, 10.8203, 0.6836, 0, 1);
    Cars[3] = AddStaticVehicle(598, 2282.4177, 2442.0291, 10.8203, 0.0569, 0, 1);
    Cars[4] = AddStaticVehicle(598, 282.3342, 2460.3645, 10.8203, 0.3703, 0, 1);
    Cars[5] = AddStaticVehicle(598, 2282.4211, 2477.4626, 10.8203, 180.3703, 0, 1);
    Cars[6] = AddStaticVehicle(598, 2273.5168, 2477.7397, 10.8203, 178.9719, 0, 1);
    Cars[7] = AddStaticVehicle(523, 2256.3137, 2477.9875, 10.8203, 178.6586, 0, 1);
    Cars[8] = AddStaticVehicle(523, 2251.5366, 2478.1582, 10.8203, 180.2253, 0, 1);
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == 2)
    {
        new VehCheck = GetPlayerVehicleID(playerid);
        if(VehCheck == Cars[1] || VehCheck == Cars[2] || VehCheck == Cars[3] || VehCheck == Cars[4] || VehCheck == Cars[5] || VehCheck == Cars[6] || VehCheck == Cars[7] || VehCheck == Cars[8])
        {
            if(!PlayerInfo[playerid][Team] = Cops))
            {
                    RemovePlayerFromVehicle(playerid);
                    SendClientMessage(playerid, -1, "You Don't have the keys for this car.");
                    return 1;
            }
            else
            {
                // ?
                return 1;
            }
        }
        return 1;
    }
    return 1;
}
Reply
#7

I fixed some of the errors but what does this mean
Код:
C:\Users\Elmo\Desktop\SAMP Project\gamemodes\Freeroam.pwn(359) : warning 211: possibly unintended assignment
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Reply
#8

Quote:
Originally Posted by [MP]Ditch
Посмотреть сообщение
I fixed some of the errors but what does this mean
Код:
C:\Users\Elmo\Desktop\SAMP Project\gamemodes\Freeroam.pwn(359) : warning 211: possibly unintended assignment
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Show the line please.
Reply
#9

What horrible indentation. I'm not even going to attempt to read it.
Reply
#10

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == 2) {
        new VehCheck = GetPlayerVehicleID(playerid);
        if(VehCheck == Cars[1] || VehCheck == Cars[2] || VehCheck == Cars[3] || VehCheck == Cars[4] || VehCheck == Cars[5] || VehCheck == Cars[6] || VehCheck == Cars[7] || VehCheck == Cars[8] || VehCheck == Cars[9])
        {
            if(PlayerInfo[playerid][Team] = Civilian)
            {
                    RemovePlayerFromVehicle(playerid);
                    SendClientMessage(playerid, -1, "You Don't have the keys for this car.");
                    return 1;
            }
            else {
                return 1;
            }
        }

        return 1;
    }
    return 1;
}
Quote:
Originally Posted by MP2
Посмотреть сообщение
What horrible indentation. I'm not even going to attempt to read it.
The point in posting then?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)