int Cmd_Report(obj_ServerPlayer* plr, const char* cmd);
everything else what you do in the r3d.h and r3d.cpp is good ;)
dont need modify anything else in the servergamelogic.cpp
Yeah but now other Players are able to see the "Command Executed" or im wrong?
Because if you return 0 from the Cmd_Report then it sets the msgChannel to 1 which is Global and then it calls p2pSendToPeer with the Global MsgChannel.
So if you enter /report Player Reason then Everyone sees that you the System
says something like Player Reported....
And for the New Message Channel yeah you need to change them in the Client
and not in the swf xD
Whisper someone works fine for me =D
[Proximity, Global, Clan, Whisper, Friends] =)
22-04-13
vinnieshuda
Re: Adding Ingame "Report" Function for Players
No, only the "command executed" visible, when visible.. (i dont test i because im alone on my server :) )
But im think this msg is for you only, not all peer. (maybe wrong)
When i dont have right, we need a new return rule, like yours (but yours make something wrong, i tried /sv and the core says: player reported or i implemented wrong)
I look this later, im trying to recode this commands and implementing new commands, teleport to player, give item to player etc.
22-04-13
iKasu
Re: Adding Ingame "Report" Function for Players
Quote:
Originally Posted by vinnieshuda
When i dont have right, we need a new return rule, like yours (but yours make something wrong, i tried /sv and the core says: player reported or i implemented wrong)
I look this later, im trying to recode this commands and implementing new commands, teleport to player, give item to player etc.
I think you did something wrong =D
Well, if you look into Cmd_SetVitals Function, it will return 0 if successfull else it will return 2.
We now know that when something is successfull you get a 0 and when something is wrong you get 2.
Okay next check the IMPL_PACKET_FUNC(ServerGameLogic, PKT_C2C_ChatMessage)
It checks if its a / in the chat at the first Character
if(n.msg[0] == '/')
Normaly the next what comes looks like this:
if(int res = ProcessChatCommand(fromPlr, n.msg); == 0)
it just says if the return of Cmd_SetVitalis as example is successfull then it returns a 0 and you get the Command Executed.
This is what i changed.
In my Report function i return a 5 instead of a 0 when success.
The If statement checks only 0 or else so i declared
int res = ProcessChatCommand(fromPlr, n.msg);
above the if statement to get the result into res
so i know res is 0 from the other commands or 2 and from my function it returns a 5.
Now i changed the if statement to if(res == 0) command success
elseif (res == 5) Player reported //because my function returns a 5 instead of a 2
then atlast the else -> Command not found.
If you read the Changes again (without the r3d changes) then you will see what i mean.
I also changed command from "/gi itemid" to "/gi itemid amount"
Or Added command like: /give itemid amount to give an item to a player.
/si sets my value and
/heal playername heals the player =)
Also the /tp command is changed to tp to a player but its a little bit tricky with the raycast to get the players pos because you need to
know where the player is =)
Currently i work on a /setspawn to set lootboxes and /addzombie to spawn more zombies.
22-04-13
vinnieshuda
Re: Adding Ingame "Report" Function for Players
I realy dont care about the checks ;P (and its good originaly)
The server wrote "command executed" only :)
Its good atm.. Later can be developed a better handling..
Yeah tp to is tricky :D
(i killed myself, when im porting to my username)
Why u need know where is the user?
You can get all connected player and usernames... And get their position to ;)
22-04-13
chreadie
Re: Adding Ingame "Report" Function for Players
Quote:
Originally Posted by iKasu
I also changed command from "/gi itemid" to "/gi itemid amount"
Or Added command like: /give itemid amount to give an item to a player.
Dont you have to check for stackable items to do such a thing?
25-04-13
animehdth
Re: Adding Ingame "Report" Function for Players
ohh nice
28-04-13
folkz
Re: [Collection]Adding Ingame Commands
iKaSu and about GodMod ( off course for DEV ) because if u put /sv 999999 ( life % ) 0 ( Food and drink ) 0 ( infection ) 0 ( i dont know :P ) they give 999999 of life but when you shoot on head u die....
You know if this can be fixed?
30-04-13
iKasu
Re: [Collection]Adding Ingame Commands
Quote:
Originally Posted by folkz
iKaSu and about GodMod ( off course for DEV ) because if u put /sv 999999 ( life % ) 0 ( Food and drink ) 0 ( infection ) 0 ( i dont know :P ) they give 999999 of life but when you shoot on head u die....
You know if this can be fixed?
You need to look where the Damage is applied to the Character and there you need to add a
little check where it says if your a dev then don't apply it ^^
30-04-13
vinnieshuda
Re: [Collection]Adding Ingame Commands
Its easy to skip damage if you are a dev :)
30-04-13
ccleanerz
Re: [Collection]Adding Ingame Commands
Or make a god armor if you don't know how to make the godmode.
30-04-13
aLca
Re: [Collection]Adding Ingame Commands
Quote:
Originally Posted by ccleanerz
Or make a god armor if you don't know how to make the godmode.
Good Point. This Ranger-Light-Armor could do this job.
12-05-13
PhB
Re: [Collection]Adding Ingame Commands
Added /spv command to give vitals to another player:
Spoiler:
Needed Files to be changed:
\WarZ Game Server\ServerGameLogic.cpp
\WarZ Game Server\ServerGameLogic.h
ServerGameLogic.h - Line 158:
Add
Code:
int GetPlayerStruct(peerInfo_s& pr, const char* user);
int Cmd_SetPlayerVitals(obj_ServerPlayer* plr, const char* cmd);
if (GetPlayerStruct(pr, user))
{
pr.player->loadout_->Health = (float)v1;
pr.player->loadout_->Hunger = (float)v2;
pr.player->loadout_->Thirst = (float)v3;
pr.player->loadout_->Toxic = (float)v4;
r3dOutToLog("Cmd_SetPlayervitals: %s was given %f, %f, %f and %f\n", user, v1, v2, v3, v4);
return 0;
}
r3dOutToLog("Cmd_SetPlayerVitals: Player %s not Found!", user);
return 2;
}
How-To-Use: /spv username health hunger thirst toxic
Hint: function ServerGameLogic::GetPlayerStruct() can be used for other teleport command to reduce code.
BTW small glitch in Teleport Admin to Player function, here's fix:
Spoiler:
Change
Code:
r3dOutToLog("Cannot fine: %s!\n", user);
}
r3dOutToLog("There was an Error while Searching for Players!\n");
return 2;
if (GetPlayerStruct(pr, user))
{
if(g_pWeaponArmory->getConfig(itemid) == NULL) {
r3dOutToLog("Cmd_GiveItem: no item %d\n", itemid);
return 3;
}
wiInventoryItem wi;
wi.itemID = itemid;
wi.quantity = amount;
pr.player->BackpackAddItem(wi);
return 0;
}
r3dOutToLog("Cmd_GivePlayerItem: Player %s not Found!", user);
return 2;
}
How-To-Use: /gpi username itemid amount
Hint: code is using previous added function GetPlayerStruct() (see post above)
13-05-13
momk100
Re: [Collection]Adding Ingame Commands
Good work PhB +1
15-05-13
PhB
Re: [Collection]Adding Ingame Commands
New GodMode command (not fully tested, pretty alone atm on my srv, should work for player<->player, tested with zombies):
Added /gm command to give player godmode status on or off (leading to ApplyDamageToPlayer() ineffective and/or Zombies attitude):
Spoiler:
Needed Files to be changed:
\WarZ Game Server\sobj_Zombie.cpp
\WarZ Game Server\obj_ServerPlayer.h
\WarZ Game Server\obj_ServerPlayer.cpp
\WarZ Game Server\ServerGameLogic.cpp
\WarZ Game Server\ServerGameLogic.h
bool obj_Zombie::SenseWeaponFire(const obj_ServerPlayer* plr, const ServerWeapon* wpn)
{
if(ZombieState == EZombieStates::ZState_Dead)
return false; // no attack while dead.
if(ZombieState == EZombieStates::ZState_Waking)
return false; // give him time to wake!
Add:
Code:
if (plr->GodMode == 2)
return false;
Look for:
Code:
case EZombieStates::ZState_Attack:
{
obj_ServerPlayer* trg = IsServerPlayer(GameWorld().GetObject(hardObjLock));
int ServerGameLogic::Cmd_GodMode(obj_ServerPlayer* plr, const char* cmd){
char buf[128];
int onoff;
sscanf(cmd, "%s %d", buf, &onoff);
plr->GodMode = onoff;
r3dOutToLog("Setting godmode for %s to %d!", plr->userName, onoff);
return 0;
}
How-To-Use: /gm [status]
where
[status] = 0 -> godmode OFF
[status] = 1 -> godmode ON but detectable by zombies
[status] = 2 -> godmode ON and not detectable by Zombies
Hint: even with GodMode=2, zombie if hit *will* begin to walk toward sound origin but won't attack
15-05-13
Liphe_xD
Re: [Collection]Adding Ingame Commands
Quote:
Originally Posted by PhB
New GodMode command (not fully tested, pretty alone atm on my srv, should work for player<->player, tested with zombies):
Added /gm command to give player godmode status on or off (leading to ApplyDamageToPlayer() ineffective and/or Zombies attitude):
Spoiler:
Needed Files to be changed:
\WarZ Game Server\sobj_Zombie.cpp
\WarZ Game Server\obj_ServerPlayer.h
\WarZ Game Server\obj_ServerPlayer.cpp
\WarZ Game Server\ServerGameLogic.cpp
\WarZ Game Server\ServerGameLogic.h
bool obj_Zombie::SenseWeaponFire(const obj_ServerPlayer* plr, const ServerWeapon* wpn)
{
if(ZombieState == EZombieStates::ZState_Dead)
return false; // no attack while dead.
if(ZombieState == EZombieStates::ZState_Waking)
return false; // give him time to wake!
Add:
Code:
if (plr->GodMode == 2)
return false;
obj_ServerPlayer.h
------------------
Look for:
Code:
float deathTime;
void DoDeath();
Add
Code:
int GodMode;
obj_ServerPlayer.cpp
--------------------
in function obj_ServerPlayer::OnCreate():
Look for:
Code:
FireHitCount = 0;
Add:
Code:
GodMode = 0;
ServerGameLogic.h
------------------
Look for:
Code:
int ProcessChatCommand(obj_ServerPlayer* plr, const char* cmd);
Add:
Code:
int Cmd_GodMode(obj_ServerPlayer* plr, const char* cmd);
int ServerGameLogic::Cmd_GodMode(obj_ServerPlayer* plr, const char* cmd){
char buf[128];
int onoff;
sscanf(cmd, "%s %d", buf, &onoff);
plr->GodMode = onoff;
r3dOutToLog("Setting godmode for %s to %d!", plr->userName, onoff);
return 0;
}
How-To-Use: /gm [status]
where
[status] = 0 -> godmode OFF
[status] = 1 -> godmode ON but detectable by zombies
[status] = 2 -> godmode ON and not detectable by Zombies
Hint: even with GodMode=2, zombie if hit *will* begin to walk toward sound origin but won't attack
here appears: command executed
but dont works..
zombies still killing me =/
EDIT: I forgot to change sobj_Zombie.cpp, now works fine ^^
15-05-13
Lewis Caddick
Re: [Collection]Adding Ingame Commands
can some help me with the part where it says Add Below the ProcessChatCommand for the commands. i cant find that part
16-05-13
PhB
Re: [Collection]Adding Ingame Commands
That means: after the ProcessChatCommand function in ServerGameLogic.cpp file, add this code, which is a new function.
16-05-13
Lewis Caddick
Re: [Collection]Adding Ingame Commands
Quote:
Originally Posted by PhB
That means: after the ProcessChatCommand function in ServerGameLogic.cpp file, add this code, which is a new function.
thanks but i got it eventually.
17-05-13
gmstylerm
Re: [Collection]Adding Ingame Commands
For me it allways Just say Player reported
17-05-13
Lewis Caddick
Re: [Collection]Adding Ingame Commands
Quote:
Originally Posted by gmstylerm
For me it allways Just say Player reported
/goto, /tome, /gpi, /spv are case sensitive with usernames
all other commands are not
17-05-13
gmstylerm
Re: [Collection]Adding Ingame Commands
Yeh i tipp in /spv Username Not working for me =/ maybe here something wrong.
yea you need to do /spv Username 0 0 0 0. the "0" is the percentage
17-05-13
gmstylerm
Re: [Collection]Adding Ingame Commands
So the same for GPI /gpi username itemid value ?
Edit: tryed it again seem like the same thing like befor execute /SPV Username 1 and the console shows up player reported
17-05-13
Lewis Caddick
Re: [Collection]Adding Ingame Commands
yes thats because you have to put for example /spv Username 100 0 0 0 (100 is health, and the zeros are hunger, thirst and toxicity. you cant just do one you have to set them all.
18-05-13
PhB
Re: [Collection]Adding Ingame Commands
At the end of my function there was a nice line to read:
How-To-Use: /spv username health hunger thirst toxic
I hope "username" is easy understandable :)
Last 4 values are in percentage, and better put 100 to 'health' :)
As you don't want to be either hunger nor thirsty nor toxic, put 3 times '0'
So:
/spv username 100 0 0 0
21-05-13
folkz
Re: [Collection]Adding Ingame Commands
commands like /tome and /goto when player have a name with space dosent work.....
Example: 'like boss -> /goto like boss -> Player reported"
21-05-13
punisherbr
Re: [Collection]Adding Ingame Commands
how can ban people?
22-05-13
doidloko
Re: [Collection]Adding Ingame Commands
SUGESTION
/ban (important)
try make this command . send a packet to db userstats 100 change to 0 *-*
/notice
show in center a notice to all server
/block 10 (10 = minutes)
block a player to use chat global for a select time
/shutdown 100 (seconds)
shutdown the server automatic in the time selected
/speed
change u speed (normal or fast)
/visible
turn invisible or visible
/check
can try make a command to check it have flying players or players with hack cheat engine, dup ,invisible etc
make a sql file or tutorial how to edit the table userchars to not allow space or CAPS xD
27-05-13
Filler
Re: [Collection]Adding Ingame Commands
Hey bro , i have a few thinks to ask u , if u can add me on skype !
Skype Name: Fillerzinho
27-05-13
crysis55
Re: [Collection]Adding Ingame Commands
GodMode error:
\Sources\ServerGameLogic.cpp(649) : error C2039: 'reputation' : is not a member of 'PKT_S2C_SetPlayerReputation_s'
1> c:\The War Z Server\src\EclipseStudio\Sources\multiplayer/P2PMessages.h(768) : see declaration of 'PKT_S2C_SetPlayerReputation_s'
30-05-13
Duong Phan
Re: [Collection]Adding Ingame Commands
Can we use this for anti hack? i saw the log says that cheat...like that, why don't we put command kick after those log to kick player out when og that he cheat ?