error 001: expected token: ";", but found "["
#1

So the script is:
PHP код:
public OnPlayerModelSelection(playeridresponselistidmodelid)
{
if(
listid == FrontBumpers)
    {
        if(
response)
        {
            new 
vIdi;
            
vId GetPlayerVehicleID(playerid);
                
PlayerData[playerid][FrontBumper] = CreateObject(modelid0.00.0, -14.00.00.00.0);
            
PlayerData[playerid][VehicleID] = vId;
            
PlayerData[playerid][ObjectModel][i] = modelid;
            
PlayerData[playerid][EditionID] = i;
            
PlayerData[playerid][OffSetX][PlayerData[playerid][EditionID]]  = 0.0;
            
PlayerData[playerid][OffSetY][PlayerData[playerid][EditionID]]  = 0.0;
            
PlayerData[playerid][OffSetZ][PlayerData[playerid][EditionID]]  = 0.0;
            
PlayerData[playerid][OffSetRX][PlayerData[playerid][EditionID]] = 0.0;
            
PlayerData[playerid][OffSetRY][PlayerData[playerid][EditionID]] = 0.0;
            
PlayerData[playerid][OffSetRZ][PlayerData[playerid][EditionID]] = 0.0;
            
PlayerData[playerid][ObjectID][i] = PlayerData[playerid][FrontBumper];
            
PlayerData[playerid][TimerID] = SetTimerEx("GetKeys"30true"i"playerid);
            
EditingPart[playerid] = 1;
            if(
GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pVeh]) PlayerInfo[playerid][vTSlot1] = modelid;
            if(
GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pVVeh]) PlayerInfo[playerid][vVTSlot1] = modelid;
            if(
GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pVVVeh]) PlayerInfo[playerid][vVVTSlot1] = modelid;
            if(
GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pVVVVeh]) PlayerInfo[playerid][vVVVTSlot1] = modelid;
        }
        else 
ShowPlayerDialog(playerid10000DIALOG_STYLE_LIST"What would you like to tune ?""Front Bumper\nRear Bumper\nRoof\nHood\nSpoilers\nSide Skirts\nWheels""Select""Exit");
        return 
1;
    }
return 
1;

Error line:
PHP код:
PlayerData[playerid][ObjectModel][i] = modelid
Error:
PHP код:
warning 215expression has no effect
error 001
expected token";"but found "["
error 029invalid expressionassumed zero
warning 215
expression has no effect
error 001
expected token";"but found "]"
 
fatal error 107too many error messages on one line 
I dont know what causes this error
Reply
#2

Where do you give a value to i?
Reply
#3

at the next line
Reply
#4

It says:

PlayerData[playerid][ObjectModel][i] = modelid;

But what is i?

Nowhere in your code does it set the value of i.
Reply
#5

PlayerData[playerid][EditionID] = i;
Reply
#6

As i can see, "i" is not assigned to any value
only
pawn Код:
new i;
Also, Can you show me how did you define the enum ? (PlayerData[playerid][ObjectModel][i] = modelid;
and , in the enum , "i" backs to what? i mean what's it exactly , player, object, other?...
Reply
#7

enum playerSets
{
Float:OffSetX[MAX_OBJECTS_PER_EDIT],
Float:OffSetY[MAX_OBJECTS_PER_EDIT],
Float:OffSetZ[MAX_OBJECTS_PER_EDIT],
Float:OffSetRX[MAX_OBJECTS_PER_EDIT],
Float:OffSetRY[MAX_OBJECTS_PER_EDIT],
Float:OffSetRZ[MAX_OBJECTS_PER_EDIT],
ObjectID[MAX_OBJECTS_PER_EDIT],
Arrow,
EditionID,
ViewingID,
EditStatus[MAX_OBJECTS_PER_EDIT],
LeftRight,
VehicleID,
ObjectModel[MAX_OBJECTS_PER_EDIT],
TimerID,
FrontBumper,
RearBumper,
Roof,
Hood,
Spoiler,
SideSkirt,
SideSkirt1,
SideSkirt2,
Wheel
}
new PlayerData[MAX_PLAYERS][playerSets];




EDIT:i tried new i=2; and its the same
Reply
#8

Quote:
Originally Posted by SandKing94
Посмотреть сообщение
PlayerData[playerid][EditionID] = i;
That doesn't assign a value to i, it assigns the value of i (which is null) to PlayerData[playerid][EditionID]

The variable that needs to get assigned is on the left hand side of the = sign.

So you'd need to have

i = something;

Somewhere in your code, before you can use i.
Reply
#9

Someone ?I tried with i=2; and its the same
Reply
#10

We use i (index) in loops but in this case that name is fairly non descriptive. What is 'i' and where does it get its value from?

What is the point of using i = 2? Then you could just put 2 instead of i in your code. It's hardcoded eitherway.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)