Jump to content

[fixed] Gobject add command


Guest xarly

Recommended Posts

Could anyone confirm if command "gobject add" works in lastest rev?

I'm using lastest rev with some patches so I don't know if is core problem or mine.

Thank you

For example you can test this to spawn a wooden chair

.gobject add 101774

When I write this I get the syntax, nothing else

Link to comment
Share on other sites

bool ChatHandler::HandleGameObjectAddCommand(char* args)
{
   // number or [name] Shift-click form |color|Hgameobject_entry:go_id|h[name]|h|r
   uint32 id;
   if (!ExtractUint32KeyFromLink(&args, "Hgameobject_entry", id))
       return false;

   if (!id)
       return false;

   int32 spawntimeSecs;
   if (!ExtractInt32(&args, spawntimeSecs))
       return false;
   ...

I think the problem is from here : return false if no spawntime is specified...

Maybe try to implement a default respawn time?

   int32 spawntimeSecs;
   if (!ExtractInt32(&args, spawntimeSecs))
-        return false;
+        spawntimeSecs = /*anything you want*/;

Link to comment
Share on other sites

I have done this

bool ChatHandler::HandleGameObjectAddCommand(char* args)
{
   // number or [name] Shift-click form |color|Hgameobject_entry:go_id|h[name]|h|r
   uint32 id;
   if (!ExtractUint32KeyFromLink(&args, "Hgameobject_entry", id))
       return false;

   if (!id)
       return false;

   int32 spawntimeSecs;
   -if (!ExtractInt32(&args, spawntimeSecs))
   -    return false;
   ...

-if (spawntimeSecs)
+if (ExtractInt32(&args, spawntimeSecs))
       pGameObj->SetRespawnTime(spawntimeSecs);

and works well

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use