-
PlayerNPCs fix in ThePack ll
PHP Code:
/*Player NPCs*/
DROP TABLE IF EXISTS `odinms`.`playernpcs`;
CREATE TABLE `odinms`.`playernpcs` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(13) NOT NULL,
`hair` int(11) NOT NULL,
`face` int(11) NOT NULL,
`skin` int(11) NOT NULL,
`x` int(11) NOT NULL,
`cy` int(11) NOT NULL default '0',
`map` int(11) NOT NULL,
`ScriptId` int(10) unsigned NOT NULL default '0',
`Foothold` int(11) NOT NULL default '0',
`rx0` int(11) NOT NULL default '0',
`rx1` int(11) NOT NULL default '0',
`gender` int(11) NOT NULL default '0',
`dir` int(11) NOT NULL default'0',
PRIMARY KEY USING BTREE (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `odinms`.`playernpcs_equip`;
CREATE TABLE `odinms`.`playernpcs_equip` (
`id` int(11) NOT NULL auto_increment,
`NpcId` int(11) NOT NULL default '0',
`equipid` int(11) NOT NULL,
`equippos` int(11) NOT NULL default '0',
`type` int(11) NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
I take full credits, tested and works.
Flame shield: off.
-
Re: PlayerNPCs fix in ThePack ll
what exactly is a player npc? 0_0
-
Re: PlayerNPCs fix in ThePack ll
-
Re: PlayerNPCs fix in ThePack ll
-
Re: PlayerNPCs fix in ThePack ll
Lies? It works 100%.. I just tested.
-
Re: PlayerNPCs fix in ThePack ll
How can you take full credits when you don't know what a player NPC is?
-
Re: PlayerNPCs fix in ThePack ll
Did you seriously belive that I don't know what playernpcs are o_o?
-
Re: PlayerNPCs fix in ThePack ll
This is just for the sql...Here's the command (taken from xotic and modified rx1 because it was wrong):
PHP Code:
} else if (splitted[0].equalsIgnoreCase("!playernpc")) {
int scriptId = Integer.parseInt(splitted[2]);
MapleCharacter victim = cserv.getPlayerStorage().getCharacterByName(splitted[1]);
int npcId;
if (splitted.length != 3) {
mc.dropMessage("Pleaase use the correct syntax. !playernpc <char name> <script name>");
} else if (scriptId < 9901000 || scriptId > 9901319) {
mc.dropMessage("Please enter a script name between 9901000 and 9901319");
} else if (victim == null) {
mc.dropMessage("The character is not in this channel");
} else {
try {
Connection con = DatabaseConnection.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM playernpcs WHERE ScriptId = ?");
ps.setInt(1, scriptId);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
mc.dropMessage("The script id is already in use !");
rs.close();
} else {
rs.close();
ps = con.prepareStatement("INSERT INTO playernpcs (name, hair, face, skin, x, cy, map, ScriptId, Foothold, rx0, rx1, gender, dir) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
ps.setString(1, victim.getName());
ps.setInt(2, victim.getHair());
ps.setInt(3, victim.getFace());
ps.setInt(4, victim.getSkinColor().getId());
ps.setInt(5, player.getPosition().x);
ps.setInt(6, player.getPosition().y);
ps.setInt(7, player.getMapId());
ps.setInt(8, scriptId);
ps.setInt(9, player.getMap().getFootholds().findBelow(player.getPosition()).getId());
ps.setInt(10, player.getPosition().x + 50); // I should really remove rx1 rx0. Useless piece of douche
ps.setInt(11, player.getPosition().y - 50);
ps.setInt(12, victim.getGender());
ps.setInt(13, player.isFacingLeft() ? 0 : 1);
ps.executeUpdate();
rs = ps.getGeneratedKeys();
rs.next();
npcId = rs.getInt(1);
ps.close();
ps = con.prepareStatement("INSERT INTO playernpcs_equip (NpcId, equipid, equippos) VALUES (?, ?, ?)");
ps.setInt(1, npcId);
for (IItem equip : victim.getInventory(MapleInventoryType.EQUIPPED)) {
ps.setInt(2, equip.getItemId());
ps.setInt(3, equip.getPosition());
ps.executeUpdate();
}
ps.close();
rs.close();
ps = con.prepareStatement("SELECT * FROM playernpcs WHERE ScriptId = ?");
ps.setInt(1, scriptId);
rs = ps.executeQuery();
rs.next();
PlayerNPCs pn = new PlayerNPCs(rs);
for (ChannelServer channel : ChannelServer.getAllInstances()) {
MapleMap map = channel.getMapFactory().getMap(player.getMapId());
map.broadcastMessage(MaplePacketCreator.SpawnPlayerNPC(pn));
map.broadcastMessage(MaplePacketCreator.getPlayerNPC(pn));
map.addMapObject(pn);
}
}
ps.close();
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
Equips still do not work. Thanks for the fix =) Had it already,my playernpcs started working by using this command I just posted.
-
Re: PlayerNPCs fix in ThePack ll
Oops I'm sorry... I can't detect sarcasm on the internet...
-
Re: PlayerNPCs fix in ThePack ll
Quote:
Originally Posted by
Lejgolacsz
This is just for the sql...Here's the command (taken from xotic and modified rx1 because it was wrong):
PHP Code:
} else if (splitted[0].equalsIgnoreCase("!playernpc")) {
int scriptId = Integer.parseInt(splitted[2]);
MapleCharacter victim = cserv.getPlayerStorage().getCharacterByName(splitted[1]);
int npcId;
if (splitted.length != 3) {
mc.dropMessage("Pleaase use the correct syntax. !playernpc <char name> <script name>");
} else if (scriptId < 9901000 || scriptId > 9901319) {
mc.dropMessage("Please enter a script name between 9901000 and 9901319");
} else if (victim == null) {
mc.dropMessage("The character is not in this channel");
} else {
try {
Connection con = DatabaseConnection.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM playernpcs WHERE ScriptId = ?");
ps.setInt(1, scriptId);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
mc.dropMessage("The script id is already in use !");
rs.close();
} else {
rs.close();
ps = con.prepareStatement("INSERT INTO playernpcs (name, hair, face, skin, x, cy, map, ScriptId, Foothold, rx0, rx1, gender, dir) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
ps.setString(1, victim.getName());
ps.setInt(2, victim.getHair());
ps.setInt(3, victim.getFace());
ps.setInt(4, victim.getSkinColor().getId());
ps.setInt(5, player.getPosition().x);
ps.setInt(6, player.getPosition().y);
ps.setInt(7, player.getMapId());
ps.setInt(8, scriptId);
ps.setInt(9, player.getMap().getFootholds().findBelow(player.getPosition()).getId());
ps.setInt(10, player.getPosition().x + 50); // I should really remove rx1 rx0. Useless piece of douche
ps.setInt(11, player.getPosition().y - 50);
ps.setInt(12, victim.getGender());
ps.setInt(13, player.isFacingLeft() ? 0 : 1);
ps.executeUpdate();
rs = ps.getGeneratedKeys();
rs.next();
npcId = rs.getInt(1);
ps.close();
ps = con.prepareStatement("INSERT INTO playernpcs_equip (NpcId, equipid, equippos) VALUES (?, ?, ?)");
ps.setInt(1, npcId);
for (IItem equip : victim.getInventory(MapleInventoryType.EQUIPPED)) {
ps.setInt(2, equip.getItemId());
ps.setInt(3, equip.getPosition());
ps.executeUpdate();
}
ps.close();
rs.close();
ps = con.prepareStatement("SELECT * FROM playernpcs WHERE ScriptId = ?");
ps.setInt(1, scriptId);
rs = ps.executeQuery();
rs.next();
PlayerNPCs pn = new PlayerNPCs(rs);
for (ChannelServer channel : ChannelServer.getAllInstances()) {
MapleMap map = channel.getMapFactory().getMap(player.getMapId());
map.broadcastMessage(MaplePacketCreator.SpawnPlayerNPC(pn));
map.broadcastMessage(MaplePacketCreator.getPlayerNPC(pn));
map.addMapObject(pn);
}
}
ps.close();
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
Equips still do
not work. Thanks for the fix =) Had it already,my playernpcs started working by using this command I just posted.
ThePack II already has the !playernpc, and this won't work for it..
-
Re: PlayerNPCs fix in ThePack ll
Try it. With the old playernpc command it didn't,because it set rx1 wrong I believe or whatever. It worked for me with this command from xotic.
-
Re: PlayerNPCs fix in ThePack ll
It works with the one that it comes with as well, that's the one I used to make this playernpc.
-
Re: PlayerNPCs fix in ThePack ll
well for me it didn't. But equips do not work for you also? I wonder if the command would affect that much.
-
Re: PlayerNPCs fix in ThePack ll
Quote:
Originally Posted by
mspirate217
what exactly is a player npc? 0_0
that's if you create an NPC that exactly looks like a player you want :tongue:
-
Re: PlayerNPCs fix in ThePack ll
Quote:
Originally Posted by
Lejgolacsz
well for me it didn't. But equips do not work for you also? I wonder if the command would affect that much.
It worked perfectly for me with ThePack II's command and this SQL.
-
Re: PlayerNPCs fix in ThePack ll
._. As I said before, why do you think that the so called "player npc" will work even without the y cord? Seriously now, a player npc is still an npc as that, it needs a frickin x/y cord.
Heres the real fix..
PHP Code:
--
-- Definition of table `playernpcs`
--
DROP TABLE IF EXISTS `playernpcs`;
CREATE TABLE `playernpcs` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(13) NOT NULL,
`hair` int(11) NOT NULL,
`face` int(11) NOT NULL,
`skin` int(11) NOT NULL,
`dir` int(11) NOT NULL,
`x` int(11) NOT NULL DEFAULT '0',
`y` int(11) NOT NULL DEFAULT '0',
`cy` int(11) NOT NULL DEFAULT '0',
`map` int(11) NOT NULL,
`gender` int(11) NOT NULL,
`ScriptId` int(10) unsigned NOT NULL DEFAULT '0',
`Foothold` int(11) NOT NULL DEFAULT '0',
`rx0` int(11) NOT NULL DEFAULT '0',
`rx1` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
--
-- Definition of table `playernpcs_equip`
--
DROP TABLE IF EXISTS `playernpcs_equip`;
CREATE TABLE `playernpcs_equip` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`npcid` int(11) NOT NULL,
`equipid` int(11) NOT NULL,
`equippos` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `FK_playernpcs_equip_1` (`npcid`),
CONSTRAINT `FK_playernpcs_equip_1` FOREIGN KEY (`npcid`) REFERENCES `playernpcs` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=80 DEFAULT CHARSET=latin1;
-
Re: PlayerNPCs fix in ThePack ll
-
Re: PlayerNPCs fix in ThePack ll
Quote:
Originally Posted by
Lejgolacsz
lol troll,cy = y....
._. The sql I posted works 100%.
-
Re: PlayerNPCs fix in ThePack ll
Quote:
Originally Posted by
Bye
._. The sql I posted works 100%.
So did mine, troll.
-
Re: PlayerNPCs fix in ThePack ll
quality does this sql also work for xotic source ?
-
Re: PlayerNPCs fix in ThePack ll
Quote:
Originally Posted by
Lejgolacsz
lol troll,cy = y....
Gtfo.
Quote:
Originally Posted by
kokrong
quality does this sql also work for xotic source ?
i w0nder, d03s it?
-
Re: PlayerNPCs fix in ThePack ll
I don't think so, check MSDartz' one for the xotic.
-
Re: PlayerNPCs fix in ThePack ll
Quote:
Originally Posted by
Qualitys
I don't think so, check MSDartz' one for the xotic.
Don't even bring his name up..,
-
Re: PlayerNPCs fix in ThePack ll
So have you check or fix the problem that the npc won't load once you restart the server?
-
Re: PlayerNPCs fix in ThePack ll
-
Re: PlayerNPCs fix in ThePack ll
-
Re: PlayerNPCs fix in ThePack ll
-
Re: PlayerNPCs fix in ThePack ll
Quote:
Originally Posted by
mspirate217
what exactly is a player npc? 0_0
^he shouldnt be here, even had in most repacks from v.55 and above -.-
Quote:
Originally Posted by
Qualitys
I don't know.
^lol, obvious sarcasm
Quote:
Originally Posted by
xqrzd
How can you take full credits when you don't know what a player NPC is?
I LMFAOED ON THIS LOLO LOL OLOLO LOLOLOLOL
Quote:
Originally Posted by
Qualitys
Did you seriously belive that I don't know what playernpcs are o_o?
hahahahahahaahaAHAHAAHAA
good shit, nice release
-
Re: PlayerNPCs fix in ThePack ll
-
Re: PlayerNPCs fix in ThePack ll
This works perfectly for me, nice release.
-
Re: PlayerNPCs fix in ThePack ll
Quote:
Originally Posted by
Bye
Don't even bring his name up..,
It's OK, I love you too hun.
-
Re: PlayerNPCs fix in ThePack ll
-
Re: PlayerNPCs fix in ThePack ll
your so pro! you made a SQL!
1/10 Fail :*:
-
Re: PlayerNPCs fix in ThePack ll
i still cant seem to get it working... every one is post different kinds of sql and stuff xD dont know what works... anyways can some one post a working sql and the gm command..... that would be great if you can help me out here...
PS dont say page 3 or page 2 etc... just post your working sql and commands in your post >.< thanks