• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

[SOLVED] Extending kicked player information

Status
Not open for further replies.

Reloac

BETA Tester
Hey

I've been trying for the last hour or so, to make the kick command show who was kicked, by who and the reason to world, i can make 2 of the 3 show, im just having problems when it comes to showing the persons name who kicked the player, I'm pretty new to CTM Cores, recently moved from TC 3.3.5 to Skyfire 4.0, had to re-edit the kick command, however decided to edit it...

What i currently have :

Code:
//kick player
bool ChatHandler::HandleKickPlayerCommand(const char *args)
{
    Player* target = NULL;
    std::string playerName;
	std::string playerName;
    if (!extractPlayerTarget((char*)args, &target, NULL, &playerName))
        return false;

    // check online security
    if (HasLowerSecurity(target, 0))
        return false;

	char const* kickReason = strtok(NULL, "\r");
	    std::string kickReasonStr = "No reason";
	    if (kickReason != NULL)
		    kickReasonStr = kickReason;

    if (sWorld->getBoolConfig(CONFIG_SHOW_KICK_IN_WORLD))
        /*sWorld->SendWorldText(LANGUAGE_COMMAND_KICKMESSAGE, playerName.c_str());*/
		sWorld->SendWorldText(LANGUAGE_COMMAND_KICKMESSAGE, playerName.c_str(), kickReasonStr.c_str());
    else
        PSendSysMessage(LANGUAGE_COMMAND_KICKMESSAGE, playerName.c_str());
    target->GetSession()->KickPlayer();
    return true;
}

What Im trying to make it do :

Code:
sWorld->SendWorldText(LANGUAGE_COMMAND_KICKMESSAGE, playerName.c_str(), Personwhokickedplayer, kickReasonStr.c_str());

so that it would output :

 "%s has been kicked from the server by %s. Reason : %s"

Been trying all ways, but their just showing errors on me... :(

Any help would be appreciated.
 

Parranoia

Insane Member
You have to change it's signature in the trinity_string table in the world database to accept more than 1 argument
 

Reloac

BETA Tester
You have to change it's signature in the trinity_string table in the world database to accept more than 1 argument

Yeah, that part is done, except im having problems adding the string to the actual announce inbetween the player and kick reason.
 

Reloac

BETA Tester
Hey

I tried :

Code:
sWorld->SendWorldText(LANGUAGE_COMMAND_KICKMESSAGE, playerName.c_str(), GetSession->GetPlayerName(), kickReasonStr.c_str());

and got the following errors :

Code:
	2	IntelliSense: expression must have pointer type	c:\users\administrator\desktop\zcore 4\skyfireemu\src\server\game\chat\commands\level2.cpp	244
 

Tommy

Founder
I'm sure it is referring to:

Code:
GetSession->GetPlayerName()


There's no variable for the expression. For example, it should be like (depending on the variable name):

Code:
player->GetSession()->WHATEVERHERE

However, to get a player's name you don't need to call "GetSession()" because you only need to call "player->GetName().c_str();"
 

Reloac

BETA Tester
Hey

Well i guess that would work, however i guess player isn't defined, since it states that in the error when i use ...

Code:
sWorld->SendWorldText(LANGUAGE_COMMAND_KICKMESSAGE, playerName.c_str(), player->GetName().c_str(), kickReasonStr.c_str());

how would i go about defining it?
 

Tommy

Founder
Hey

Well i guess that would work, however i guess player isn't defined, since it states that in the error when i use ...

Code:
sWorld->SendWorldText(LANGUAGE_COMMAND_KICKMESSAGE, playerName.c_str(), player->GetName().c_str(), kickReasonStr.c_str());

how would i go about defining it?

Kinda figured you would use my example variable name. Mine was an example, but seeing from your first post, 'target' would be the variable you would use, unless you changed it all. Otherwise, target is already declared so use it.
 
Status
Not open for further replies.
Top