Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //command.cpp
- void command_gassign(Client *c, const Seperator *sep) {
- if (sep->IsNumber(1) && c->GetTarget() && c->GetTarget()->IsNPC() && c->GetTarget()->CastToNPC()->GetSpawnPointID() > 0) {
- int spawn2id = c->GetTarget()->CastToNPC()->GetSpawnPointID();
- database.AssignGrid(c, atoi(sep->arg[1]), spawn2id);
- }
- else
- c->Message(0,"Usage: #gassign [num] - must have an npc target!");
- }
- //waypoints.cpp
- void ZoneDatabase::AssignGrid(Client *client, int grid, int spawn2id) {
- std::string query = StringFormat("UPDATE spawn2 SET pathgrid = %d WHERE id = %d", grid, spawn2id);
- auto results = QueryDatabase(query);
- if (!results.Success())
- {
- return;
- }
- if (results.RowsAffected() != 1) {
- client->Message(0, "ERROR: found spawn2 id %d but the update query failed", spawn2id);
- return;
- }
- client->Message(0, "Grid assign: spawn2 id = %d updated", spawn2id);
- }
- //zonedb.h
- void AssignGrid(Client *client, int grid, int spawn2id);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement