- Joined
- Apr 2, 2013
- Messages
- 1,098
- Reaction score
- 4,614
if(strncmp(cmd, "/sv", 3) == 0 && plr->profile_.ProfileData.isDevAccount)
return Cmd_SetVitals(plr, cmd);
if(strncmp(cmd, "/zkill", 3) == 0 && plr->profile_.ProfileData.isDevAccount) return Cmd_KillZombie(plr, cmd);
int ServerGameLogic::Cmd_SetVitals(obj_ServerPlayer* plr, const char* cmd)
{
char buf[128];
int v1, v2, v3, v4;
if(5 != sscanf(cmd, "%s %d %d %d %d", buf, &v1, &v2, &v3, &v4))
return 2;
plr->loadout_->Health = (float)v1;
plr->loadout_->Hunger = (float)v2;
plr->loadout_->Thirst = (float)v3;
plr->loadout_->Toxic = (float)v4;
return 0;
}
int ServerGameLogic::Cmd_KillZombie(obj_ServerPlayer* plr, const char* cmd)
{
char buf[128];
int x;
if(2 != sscanf(cmd, "%s %d", buf, &x))
return 2;
ObjectManager& GW = GameWorld();
for (GameObject *targetObj = GW.GetFirstObject(); targetObj; targetObj = GW.GetNextObject(targetObj))
{
if(targetObj->isObjType(OBJTYPE_Zombie))
{
obj_Zombie* z = (obj_Zombie*)targetObj;
float dist = (plr->GetPosition() - targetObj->GetPosition()).Length();
if(dist < x)
{
z->ApplyDamage(plr, 100, 1, storecat_MELEE);
}
}
}
return 0;
}
int Cmd_SetVitals(obj_ServerPlayer* plr, const char* cmd);
int Cmd_KillZombie(obj_ServerPlayer* plr, const char* cmd);
Thanks Yuri, many guys will like that, can you do fly tutorial?
WarZTHSrc2 V2
int ServerGameLogic::Cmd_KillZombie(obj_ServerPlayer* plr, const char* cmd)
{
char buf[128];
int x;
if(2 != sscanf(cmd, "%s %d", buf, &x))
return 2;
ObjectManager& GW = GameWorld();
for (GameObject *targetObj = GW.GetFirstObject(); targetObj; targetObj = GW.GetNextObject(targetObj))
{
if(targetObj->isObjType(OBJTYPE_Zombie))
{
obj_Zombie* z = (obj_Zombie*)targetObj;
float dist = (plr->GetPosition() - targetObj->GetPosition()).Length();
if(dist < x)
{
z->ApplyDamage(plr, 100, 1, storecat_MELEE, 0);
}
}
}
return 0;
}
I have not tried it in warzth source, but try this code
Code:int ServerGameLogic::Cmd_KillZombie(obj_ServerPlayer* plr, const char* cmd) { char buf[128]; int x; if(2 != sscanf(cmd, "%s %d", buf, &x)) return 2; ObjectManager& GW = GameWorld(); for (GameObject *targetObj = GW.GetFirstObject(); targetObj; targetObj = GW.GetNextObject(targetObj)) { if(targetObj->isObjType(OBJTYPE_Zombie)) { obj_Zombie* z = (obj_Zombie*)targetObj; float dist = (plr->GetPosition() - targetObj->GetPosition()).Length(); if(dist < x) { z->ApplyDamage(plr, 100, 1, storecat_MELEE, 1); } } } return 0; }
[COLOR=#0000BB]int ServerGameLogic[/COLOR][COLOR=#007700]::[/COLOR][COLOR=#0000BB]Cmd_[/COLOR][COLOR=#ff0000]SpawnZombie[/COLOR][COLOR=#0000BB][/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]obj_ServerPlayer[/COLOR][COLOR=#007700]* [/COLOR][COLOR=#0000BB]plr[/COLOR][COLOR=#007700], const [/COLOR][COLOR=#0000BB]char[/COLOR][COLOR=#007700]* [/COLOR][COLOR=#0000BB]cmd[/COLOR][COLOR=#007700])[/COLOR]
Yuri been releasing tutorials like crazy.
I might join that wagon.
AIMBOT !!! WTF :junglejane:
Yes, it is still in development for zombies
yuri still nothing, maybe that source code for WarZTH V2 does not work
compile without error, but the command /zkill no effect