[Tutorial] Add Premium Reward

Newbie Spellweaver
Joined
Apr 19, 2011
Messages
24
Reaction score
11
WarZ_Server.sln

Seach on UserReward.h
Code:
enum EPlayerRewardID
{
	RWD_ZombieKill		= 1,	//Standard
		
	RWD_MAX_REWARD_ID	= 512,
};
Replace to this
Code:
enum EPlayerRewardID
{
	RWD_ZombieKill		= 1,	//Standard
	RWD_ZombieKillP		= 2,
		
	RWD_MAX_REWARD_ID	= 512,
};

Search on UserReward.cpp:
Code:
void CGameRewards::InitDefaultRewards()
{
	// HERE is COPY-PASTED CODE FROM ExportDefaultRewards()
	// USED FOR SERVER
	SetReward(1, "ZombieKill", 5, 5, 10, 10);
}
Replace to this
Code:
void CGameRewards::InitDefaultRewards()
{
	// HERE is COPY-PASTED CODE FROM ExportDefaultRewards()
	// USED FOR SERVER

	SetReward(1, "ZombieKill", 10, 10, 10, 10);
	SetReward(2, "ZombieKillP", 15, 15, 15, 15);
}
Search on sobj_Zombie.cpp
Code:
        gServerLogic.AddPlayerReward(plr, RWD_ZombieKill);
Replace to this
Code:
if(plr->profile_.ProfileData.isPunisher)
{
	gServerLogic.AddPlayerReward(plr, RWD_ZombieKillP);
}
else
{
	gServerLogic.AddPlayerReward(plr, RWD_ZombieKill);
}
 
Thanks for sharing :p

2 error for me ^^


You use AllRight Source?
If you use, change the following lines


Change
Code:
gServerLogic.AddPlayerReward(plr, RWD_ZombieKillP);
to
Code:
gServerLogic.AddPlayerReward(plr, RWD_ZombieKillP, 0);
and
Code:
gServerLogic.AddPlayerReward(plr, RWD_ZombieKill);
to
Code:
gServerLogic.AddPlayerReward(plr, RWD_ZombieKill, 0);
 
For DNC Source its directly after this

Code:
		if(fromObj->Class->Name == "obj_ServerPlayer")
		{
			obj_ServerPlayer* plr = (obj_ServerPlayer*)fromObj;

And should look like this.


Code:
		if(fromObj->Class->Name == "obj_ServerPlayer")
		{
			obj_ServerPlayer* plr = (obj_ServerPlayer*)fromObj;
if(plr->profile_.ProfileData.isPunisher)
{
gServerLogic.AddPlayerReward(plr, RWD_ZombieKillP, 0);
}
else
{
gServerLogic.AddPlayerReward(plr, RWD_ZombieKill, 0);
}
 
Not work in New Community Edition (Last Version) by DNC. Verify please
maybe need to change isPunisher - isPremium?
Code:
if(fromObj->Class->Name == "obj_ServerPlayer")
		{
			obj_ServerPlayer* plr = (obj_ServerPlayer*)fromObj;
if(plr->profile_.ProfileData.[COLOR=#ff0000]isPremium[/COLOR])
{
gServerLogic.AddPlayerReward(plr, RWD_ZombieKillP, 0);
}
else
{
gServerLogic.AddPlayerReward(plr, RWD_ZombieKill, 0);
}
 
Last edited:
Not work in New Community Edition (Last Version) by DNC. Verify please
maybe need to change isPunisher - isPremium?
Code:
if(fromObj->Class->Name == "obj_ServerPlayer")
		{
			obj_ServerPlayer* plr = (obj_ServerPlayer*)fromObj;
if(plr->profile_.ProfileData.[COLOR=#ff0000]isPremium[/COLOR])
{
gServerLogic.AddPlayerReward(plr, RWD_ZombieKillP, 0);
}
else
{
gServerLogic.AddPlayerReward(plr, RWD_ZombieKill, 0);
}

Yeap, new DNC Source does not work with isPunisher, it works with isPremium
 
thank you


if(fromObj->Class->Name == "obj_ServerPlayer")
{
obj_ServerPlayer* plr = (obj_ServerPlayer*)fromObj;
if (plr->profile_.ProfileData.isPremium) // premium reward
{
gServerLogic.AddPlayerReward(plr, RWD_ZombieKillP, 0);
}
else
{
gServerLogic.AddPlayerReward(plr, RWD_ZombieKill, 0);
}


if (plr->loadout_->Mission1 == 2)
 
@javaz97 how to add "gServerLogic.AddPlayerReward(plr, RWD_SZombieKill);" in your code?




Code:
if(fromObj->Class->Name == "obj_ServerPlayer")
{
obj_ServerPlayer* plr = (obj_ServerPlayer*)fromObj;
if (plr->profile_.ProfileData.isPremium) // premium reward
{
gServerLogic.AddPlayerReward(plr, RWD_ZombieKillP, 0);
}
else
{
gServerLogic.AddPlayerReward(plr, RWD_ZombieKill, 0);
}
 
@javaz97

but I wanted to keep the other two rewards and add more this


if(fromObj->Class->Name == "obj_ServerPlayer")
{
obj_ServerPlayer* plr = (obj_ServerPlayer*)fromObj;
if (plr->profile_.ProfileData.isPremium) // premium reward
{
gServerLogic.AddPlayerReward(plr, RWD_ZombieKillP, 0);
}
else
{
gServerLogic.AddPlayerReward(plr, RWD_ZombieKill, 0);
}
else
{
gServerLogic.AddPlayerReward(plr, RWD_SZombieKill, 0);
}

this way?


sorry for google translator
 
Last edited:
I did the DNC and it worked but now in Warth which is the setting for this code?

Code:
if(plr->profile_.ProfileData.isPunisher)
{
    gServerLogic.AddPlayerReward(plr, RWD_ZombieKillP);
}
else
{
    gServerLogic.AddPlayerReward(plr, RWD_ZombieKill);
}
 
Last edited:
Back