0 Vote(s) - 0 Average 1 2 3 4 5 [SOLVED]Whats wrong with this? :( iAegle ItsModder Joined: Jan 2011 Posts: 1,642 Reputation: 46 03-15-2011, 17:16 (This post was last modified: 03-15-2011, 21:24 by iAegle.) I get bad syntax every time Checked it 1000 times, it is supposed to give every Block a number.. I need this because I want to make blocks disappear in random order, every 3 seconds a block disappears. Code: ```CreateGrids(corner1, corner2, angle) {     W = Distance((corner1[0], 0, 0), (corner2[0], 0, 0));     L = Distance((0, corner1[1], 0), (0, corner2[1], 0));     H = Distance((0, 0, corner1[2]), (0, 0, corner2[2]));     CX = corner2[0] - corner1[0];     CY = corner2[1] - corner1[1];     CZ = corner2[2] - corner1[2];     ROWS = roundUp(W/55);     COLUMNS = roundUp(L/30);     HEIGHT = roundUp(H/20);     XA = CX/ROWS;     YA = CY/COLUMNS;     ZA = CZ/HEIGHT;     self.center = spawn("script_model", corner1);     for(r = 0; r <= ROWS; r++)     {         for(c = 0; c <= COLUMNS; c++)         {             for(h = 0; h <= HEIGHT; h++)             {                 if(!isDefined(level.blocks)                 {                     level.blocks.size = 0;                 }                 b = level.blocks.size;                 wait .01;                 level.blocks[b] = spawn("script_model", (corner1 + (XA * r, YA * c, ZA * h)), 1);                 level.blocks[b] setModel( level.crateModelFriendly );                 level.blocks[b].angles = (0, 0, 0);                 level.blocks[b] LinkTo(self.center);                 level.blocks[b].health = level.boxhealth;                 level.blocks[b] setCanDamage(true);                 level.blocks[b] thread destroyBlock();                 wait .01;                 level.blocks++;                 wait .03;             }         }     }     self.center.angles = angle; } destroyBlock() {     for(;;)     {         if(self.health < 0)         {             playfx(level.destroyblockfx, self.origin);             self delete();         }         wait 0.05;     } } roundUp( floatVal ) {         if ( int( floatVal ) != floatVal )         return int( floatVal+1 );         else         return int( floatVal ); }``` with this on init() Code: ```    level.blocks = [];     level.boxhealth = 200;     level.traphealth = 300;     level.crateModelFriendly = "mp_supplydrop_ally";     level.crateModelEnemy = "mp_supplydrop_axis";     level.crateModelBoobyTrapped = "mp_supplydrop_boobytrapped";     level.destroyblockfx = loadfx("explosions/fx_exp_equipment");``` (08-10-2011, 12:58)Pozzuh Wrote: Se7en Wrote:Stealed, from cod4 mod ... look who's talking [Release] Old School Mod v2.2 [Release] Scroll menu   • surtek Virtual Wizard Joined: Nov 2010 Posts: 2,003 Reputation: 38 03-15-2011, 17:41 (This post was last modified: 03-15-2011, 17:42 by surtek.) PHP Code `if(!isDefined(level.blocks)` you forgot a ")" fixed one: PHP Code `if(!isDefined(level.blocks))`   • iAegle ItsModder Joined: Jan 2011 Posts: 1,642 Reputation: 46 03-15-2011, 18:13 (03-15-2011, 17:41)surtek Wrote: PHP Code `if(!isDefined(level.blocks)` you forgot a ")" fixed one: PHP Code `if(!isDefined(level.blocks))` Thanx, but I still get bad syntax (08-10-2011, 12:58)Pozzuh Wrote: Se7en Wrote:Stealed, from cod4 mod ... look who's talking [Release] Old School Mod v2.2 [Release] Scroll menu   • Romuald27 ...- I LOVE ITSMODS-... Joined: Nov 2010 Posts: 234 Reputation: 14 03-15-2011, 19:29 Quote: level.crateModelFriendly = "mp_supplydrop_ally"; level.crateModelEnemy = "mp_supplydrop_axis"; level.crateModelBoobyTrapped = "mp_supplydrop_boobytrapped"; Already this is useless ^^   • iAegle ItsModder Joined: Jan 2011 Posts: 1,642 Reputation: 46 03-15-2011, 19:32 (03-15-2011, 19:29)Romuald27 Wrote: Quote: level.crateModelFriendly = "mp_supplydrop_ally"; level.crateModelEnemy = "mp_supplydrop_axis"; level.crateModelBoobyTrapped = "mp_supplydrop_boobytrapped"; Already this is useless ^^ If i dont use it, i dont see the models ... (08-10-2011, 12:58)Pozzuh Wrote: Se7en Wrote:Stealed, from cod4 mod ... look who's talking [Release] Old School Mod v2.2 [Release] Scroll menu   • iAegle ItsModder Joined: Jan 2011 Posts: 1,642 Reputation: 46 03-15-2011, 21:09 (This post was last modified: 03-15-2011, 23:51 by iAegle.) Remade and fixed, i just made the chance to get a trap 5% and if it reaches the trap limit it'll always create a normal crate Code: ```CreateGrids(corner1, corner2, angle) {     W = Distance((corner1[0], 0, 0), (corner2[0], 0, 0));     L = Distance((0, corner1[1], 0), (0, corner2[1], 0));     H = Distance((0, 0, corner1[2]), (0, 0, corner2[2]));     CX = corner2[0] - corner1[0];     CY = corner2[1] - corner1[1];     CZ = corner2[2] - corner1[2];     ROWS = roundUp(W/35);     COLUMNS = roundUp(L/70);     HEIGHT = roundUp(H/35);     XA = CX/ROWS;     YA = CY/COLUMNS;     ZA = CZ/HEIGHT;     center = spawn("script_model", corner1, 0);     for(r = 0; r <= ROWS; r++)     {         for(c = 0; c <= COLUMNS; c++)         {             for(h = 0; h <= HEIGHT; h++)             {                 self.trap = randomInt(100);                 if(self.trap <=5 && level.traps < level.maxtraps)                 {                     block = spawn("script_model", (corner1 + (XA * r, YA * c, ZA * h)), 1);                     block setModel(level.crateModelBoobyTrapped);                     block.angles = (0, 0, 0);                     block SetOwner( level );                     block LinkTo(center);                     block.health = level.traphealth;                     block thread destroyBoobytrap();                     level.traps++;                     wait 0.01;                 }                 else                 {                     block = spawn("script_model", (corner1 + (XA * r, YA * c, ZA * h)), 1);                     block setModel(level.crateModelFriendly);                     block.angles = (0, 0, 0);                     block SetOwner( level );                     block LinkTo(center);                     block.health = level.boxhealth;                     block thread destroyBlock();                     wait 0.01;                 }             }         }     }     center.angles = angle; }``` (08-10-2011, 12:58)Pozzuh Wrote: Se7en Wrote:Stealed, from cod4 mod ... look who's talking [Release] Old School Mod v2.2 [Release] Scroll menu   •

 Possibly Related Threads... Thread Author Replies Views Last Post Help [C#] WebClient how to know real url [solved] narkos 21 5,332 09-09-2013, 15:21 Last Post: surtek Help How to edit new derived entry? (Solved) SSonic70 1 985 08-20-2013, 15:29 Last Post: Nekochan Help What's Wrong 2 Dominator56 5 1,397 02-19-2013, 21:46 Last Post: Dominator56 Help What's wrong ? Dominator56 4 1,152 02-17-2013, 12:12 Last Post: Dominator56 I know I've posted this in a wrong place Ra3shed 2 898 02-16-2013, 21:15 Last Post: Arteq whats the command to get string length pedjas 4 1,142 01-20-2013, 18:30 Last Post: pedjas Help [solved]red hitmark mod? founderlj 7 1,954 12-30-2012, 23:06 Last Post: Pozzuh !weapon Plugin help pls [solved] Hallla 0 852 12-30-2012, 14:04 Last Post: Hallla Help !giveammo Plugin doesnt work [solved] Hallla 3 1,491 12-29-2012, 20:53 Last Post: Hallla Help OnPlayerConnect [Solved] 99IRock 4 1,798 11-18-2012, 10:07 Last Post: 99IRock

Forum Jump:

Users browsing this thread: 1 Guest(s)