Better dev command handling
Use at your own risk!
This will print a better error message to dev then "no such command" if the command exists but syntax is wrong. Also it enables the dev to give item to a player rather then himself.
ServerGameLogic.cpp line 1619:
Spoiler :
int res = ProcessChatCommand(fromPlr, n.msg);
PKT_C2C_ChatMessage_s n2;
n2.userFlag = 0;
n2.msgChannel = 1;
r3dscpy(n2.gamertag, "<system>");
if(res == 0)
{
r3dscpy(n2.msg, "command executed");
}
else if(res == 2) {
r3dscpy(n2.msg, "Syntax or parameter error.");
}
else if(res == 3) {
r3dscpy(n2.msg, "ItemID not found.");
}
else if(res == 4) {
r3dscpy(n2.msg, "Player not found.");
}
else
{
sprintf(n2.msg, "no such command, %d", res);
}
p2pSendToPeer(peerId, fromPlr, &n2, sizeof(n2));
return;
ServerGameLogic.cpp line 1483
Spoiler :
int ServerGameLogic::ProcessChatCommand(obj_ServerPlayer* plr, const char* cmd)
{
r3dOutToLog("cmd: %s admin:%d user: %s\n", cmd, plr->profile_.ProfileData.isDevAccount, plr->userName);
if(strncmp(cmd, "/tp", 3) == 0 && plr->profile_.ProfileData.isDevAccount) {
return Cmd_Teleport(plr, cmd);
}
else if(strncmp(cmd, "/gi", 3) == 0 && plr->profile_.ProfileData.isDevAccount) {
char un[128];
char buff[128];
int itemid = 0;
if(3 != sscanf(cmd, "%s %s %d", buff, un, &itemid)) {
return Cmd_GiveItem(plr, cmd);
}
else {
for(int i=0; i<MAX_PEERS_COUNT; i++) {
peerInfo_s& pr = GetPeer(i);
if(pr.status_ == PEER_PLAYING && pr.player && pr.player->userName == un)
{
obj_ServerPlayer* toPlr = pr.player;
return Cmd_GiveItem(toPlr, cmd);
}
}
return 4;
}
}
else if(strncmp(cmd, "/sv", 3) == 0 && plr->profile_.ProfileData.isDevAccount)
return Cmd_SetVitals(plr, cmd);
return 1;
}
Re: Better dev command handling
what is the code to give items to other players?
Re: Better dev command handling
Quote:
Originally Posted by
Luis Fernando
what is the code to give items to other players?
"/giveitem [player] [itemID]"
Need be coded, search the old topic of Commands
Re: Better dev command handling
Good work! Thanks..
This is very messy. For those of you that decide to copy paste this.. watch your brackets.
Re: Better dev command handling
Quote:
Originally Posted by
SpartanBlood
"/giveitem [player] [itemID]"
Need be coded, search the old topic of Commands
Or gpi
Sent from my LT28at using Tapatalk 4 Beta