RichardoX
02-01-2010, 05:49 PM
This simply adds two commands which gives you the ability to modify the primary/secondary weapon held in the NPC's hands. The last time I tried to submit this, it was stickied. I am unsure why. :p
#npcedit wep1 graphic_id (primary hand)
#npcedit wep2 graphic_id (secondary hand)
Command.cpp
AFTER
c->Message(0, "#npcedit findable - Sets an NPC's findable flag");
ADD
c->Message(0, "#npcedit wep1 - Sets an NPC's primary weapon to a specified graphic id.");
c->Message(0, "#npcedit wep2 - Sets an NPC's secondary weapon to a specified graphic id.");
AFTER
else if ( strcasecmp( sep->arg[1], "findable" ) == 0 )
{
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
c->Message(15,"NPCID %u is now %s",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])==0?"not findable":"findable");
database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set findable=%i where id=%i",atoi(sep->argplus[2])==0?0:1,c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf);
c->LogSQL(query);
safe_delete_array(query);
}
ADD
else if ( strcasecmp( sep->arg[1], "wep1" ) == 0 )
{
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
c->Message(15,"NPCID %u will have item graphic %f set to his primary on repop.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atof(sep->arg[2]));
database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set d_meele_texture1=%f where id=%i",atof(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf);
c->LogSQL(query);
safe_delete_array(query);
}
else if ( strcasecmp( sep->arg[1], "wep2" ) == 0 )
{
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
c->Message(15,"NPCID %u will have item graphic %f set to his secondary on repop.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atof(sep->arg[2]));
database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set d_meele_texture2=%f where id=%i",atof(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf);
c->LogSQL(query);
safe_delete_array(query);
}
#npcedit wep1 graphic_id (primary hand)
#npcedit wep2 graphic_id (secondary hand)
Command.cpp
AFTER
c->Message(0, "#npcedit findable - Sets an NPC's findable flag");
ADD
c->Message(0, "#npcedit wep1 - Sets an NPC's primary weapon to a specified graphic id.");
c->Message(0, "#npcedit wep2 - Sets an NPC's secondary weapon to a specified graphic id.");
AFTER
else if ( strcasecmp( sep->arg[1], "findable" ) == 0 )
{
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
c->Message(15,"NPCID %u is now %s",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])==0?"not findable":"findable");
database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set findable=%i where id=%i",atoi(sep->argplus[2])==0?0:1,c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf);
c->LogSQL(query);
safe_delete_array(query);
}
ADD
else if ( strcasecmp( sep->arg[1], "wep1" ) == 0 )
{
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
c->Message(15,"NPCID %u will have item graphic %f set to his primary on repop.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atof(sep->arg[2]));
database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set d_meele_texture1=%f where id=%i",atof(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf);
c->LogSQL(query);
safe_delete_array(query);
}
else if ( strcasecmp( sep->arg[1], "wep2" ) == 0 )
{
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
c->Message(15,"NPCID %u will have item graphic %f set to his secondary on repop.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atof(sep->arg[2]));
database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set d_meele_texture2=%f where id=%i",atof(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf);
c->LogSQL(query);
safe_delete_array(query);
}