View Single Post
szmol96

JCF Member

Joined: Jun 2013

Posts: 83

szmol96 is doing well so far

Jul 27, 2013, 05:11 AM
szmol96 is offline
Reply With Quote
Quote:
Gonna need to be way more specific.
For example, I have a custom gun script. If I start the server, the default gamemode is battle, and my gun won't fire any bullets. But if I change the gamemode to coop, it works.

EDIT: Here's the code.
Code:
void CreateBullet1(int objectID) {
  int playerID = jjObjects[objectID].creator - 32768;
  int bulletID = jjAddObject(OBJECT::BLASTERBULLET, jjPlayers[playerID].xPos, jjPlayers[playerID].yPos, jjPlayers[playerID].playerID, CREATOR::PLAYER);
  jjObjects[bulletID].direction = jjPlayers[playerID].direction;
  jjObjects[bulletID].ySpeed = 2;
  jjObjects[bulletID].xSpeed = (jjObjects[bulletID].direction*10)+p.xSpeed*3;
  jjObjects[bulletID].xAcc = jjObjects[bulletID].direction*5;
}
 
void CreateBullet2(int objectID) {
  int playerID = jjObjects[objectID].creator - 32768;
  int bulletID = jjAddObject(OBJECT::BLASTERBULLET, jjPlayers[playerID].xPos, jjPlayers[playerID].yPos, jjPlayers[playerID].playerID, CREATOR::PLAYER);
  jjObjects[bulletID].direction = jjPlayers[playerID].direction;
  jjObjects[bulletID].ySpeed = -2;
  jjObjects[bulletID].xSpeed = (jjObjects[bulletID].direction*10)+p.xSpeed*3;
  jjObjects[bulletID].xAcc = jjObjects[bulletID].direction*5;
}
 
void onMain() {
 
  p.ammo[9] = 3;
 
  for (int i = 0;  i < jjObjectCount; i++) {
    if (jjObjects[i].isActive && jjObjects[i].creatorType == CREATOR::PLAYER) {
    //Create bullet
      if (jjObjects[i].eventID == OBJECT::ELECTROBULLET && jjObjects[i].state != STATE::EXPLODE) {
        jjDeleteObject(i);
        CreateBullet1(i);
        CreateBullet2(i);
        continue;
      }
    }
  }
}
This isn't the only one, there are more, mostly custom guns.

Last edited by szmol96; Jul 27, 2013 at 05:57 AM.