Advertisement
ErickStorm

Cmd_DestroyBarricade

Apr 12th, 2024
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | Source Code | 0 0
  1. if (strncmp(cmd, "/db", 3) == 0 && plr->profile_.ProfileData.isDevAccount)
  2. return Cmd_DestroyBarricade(plr, cmd);
  3.  
  4. int ServerGameLogic::Cmd_DestroyBarricade(obj_ServerPlayer* plr, const char* cmd)
  5. {
  6. char buf[128];
  7. int x;
  8.  
  9. if (2 != sscanf(cmd, "%s %d", buf, &x))
  10. return 5;
  11.  
  12.  
  13. ObjectManager& GW = GameWorld();
  14. for (GameObject* targetObj = GW.GetFirstObject(); targetObj; targetObj = GW.GetNextObject(targetObj))
  15. {
  16. if (targetObj->isObjType(OBJTYPE_Barricade))
  17. {
  18. obj_ServerBarricade* z = (obj_ServerBarricade*)targetObj;
  19. float dist = (plr->GetPosition() - targetObj->GetPosition()).Length();
  20.  
  21. if (dist < x)
  22. {
  23. z->DestroyBarricade(), (plr, 100, 1, storecat_UsableItem);
  24. }
  25. }
  26. }
  27.  
  28.  
  29. return 0;
  30. }
  31.  
  32. int Cmd_DestroyBarricade(obj_ServerPlayer* plr, const char* cmd);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement