PDA

View Full Version : Can someone explain


Mimic
21/06/2012, 07:34 PM
Evening guys,

I'm adding and playing around with 3D Text Labels for my current project, I'm planning on releasing this game mode once it's ready but that's besides the point. I've added this into my game mode under this callback.

new Text3D:vehicle3Dtext2[MAX_VEHICLES], dodo1;
dodo1 = CreateVehicle(593, 1977.50000000,-2337.30004883,14.10000038,90.2, 0, 0, 120);
vehicle3Dtext2[dodo1] = Create3DTextLabel("Default Level", COLOR_BLACK, 0.0, 0.0, 0.0, 50.0, 0, 1);
Attach3DTextLabelToVehicle(vehicle3Dtext2[dodo1], dodo1, 0.0, 0.0, 2.0);

After adding this in, my compiler gives me this message.

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

Header size: 6504 bytes
Code size: 145940 bytes
Data size: 179024 bytes
Stack/heap size: 16384 bytes; estimated max. usage=4653 cells (18612 bytes)
Total requirements: 347852 bytes

When I /* */ the code I added in, the compiler gives me the normal message.

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

This isn't a problem as I understand most people post problems on this section of the forums but I'd love for someone to explain why this is happening as I've not seen this before? and my game mode shouldn't be exceeding the maximum memory as my game mode has around 2000 lines of code?

EDIT: Something else that I just found that has extremely confused me is, when that code is added in, I'll attempt to execute an Administrator command and it will return a SendClientMessage stating "You are not an Administrator!" that's only suppose to pop up if you 'ARE NOT' an Administrator. I removed the bit of code using /* */ like I done before and it started working? + the compiler popped up with the original message too. This has REALLY confused me.

Thanks in advance,
Mimic

Vince
21/06/2012, 08:07 PM
It's because you are creating a size 2000 local variable. I don't think this happens if that variable is global, because global variables are stored in another location. Still, there's probably a better way of doing this, unless you plan to attach a 3D label to all your vehicles. Something like;

enum vLabels{
vehicleid,
Text3D:labelid
};

new labelVehicles[100][vLabels];

labelVehicle[0][vehicleid] = CreateVehicle();
labelVehicle[0][labelid] = Create3DTextLabel();

Attach3DTextLabelToVehicle(labelVehicle[0][labelid], labelVehicle[0][vehicleid], 0.0, 0.0, 2.0);

Mimic
21/06/2012, 08:18 PM
It's because you are creating a size 2000 local variable. I don't think this happens if that variable is global, because global variables are stored in another location. Still, there's probably a better way of doing this, unless you plan to attach a 3D label to all your vehicles. Something like;

enum vLabels{
vehicleid,
Text3D:labelid
};

new labelVehicles[100][vLabels];

labelVehicle[0][vehicleid] = CreateVehicle();
labelVehicle[0][labelid] = Create3DTextLabel();

Attach3DTextLabelToVehicle(labelVehicle[0][labelid], labelVehicle[0][vehicleid], 0.0, 0.0, 2.0);


Ahhh, I see. Thanks, I understand what to do now.