Add text with Kick User.

12/08/2014 17:59 raventh1984#1
Hi elitepvpers,

I am working with the SendAPIcmd command from Sedrika's webshop.

What i am now doing is adding an Kick command for an player.

Now what i am not getting accomplished is that an player that has been kicked sees an message.

I have atm this

Code:
else if( bi2.dwCommand == 103 ) //KickPlayer
		{
			pUser->AddText("You have been kicked from the game.");
			g_dpDBClient.SavePlayer( pUser, pWorld->GetID(), pUser->GetPos(), pUser->GetLayer() );
			g_DPCoreClient.SendKillPlayer( pUser->m_idPlayer, pUser->m_idPlayer );
		}
As you can see i put the AddText in front of the KillPlayer command.
But when the player is getting kicked it doesnt show the message at all.

Any tips for this?

With kind regards.
12/10/2014 14:19 Sedrika#2
The user is being kicked to fast. Try adding a little delay.

Code:
else if( bi2.dwCommand == 103 ) //KickPlayer
		{
			pUser->AddText("You have been kicked from the game.");
			Sleep(100);
			g_dpDBClient.SavePlayer( pUser, pWorld->GetID(), pUser->GetPos(), pUser->GetLayer() );
			g_DPCoreClient.SendKillPlayer( pUser->m_idPlayer, pUser->m_idPlayer );
		}
12/10/2014 18:06 julioclitwin#3
Or you can change your text to a Message Box (ingame).
12/10/2014 18:39 Schulzie#4
interessant wäre noch, wenn man noch dazu schreibt, wer den spieler gekickt hat ;)
12/10/2014 19:04 Marc~#5
Lässt sich das nicht anhand des alten Guides von Pumbaaa ableiten?

[Only registered and activated users can see links. Click Here To Register...]
12/10/2014 19:18 Avalion#6
Doing Sleep() on a server isn't a great idea:

Quote:
Suspends the execution of the current thread until the time-out interval elapses.
12/10/2014 21:17 /Aiden\#7
Quote:
Originally Posted by Avalion View Post
Doing Sleep() on a server isn't a great idea:
As far as i know every User has it´s own Serversided thread. Should not be a problem that this thread stops for 100 ms. Other players shouldn´t notice this at all.
12/10/2014 23:13 raventh1984#8
Quote:
Originally Posted by Schulzie View Post
interessant wäre noch, wenn man noch dazu schreibt, wer den spieler gekickt hat ;)
That can easily be done. I just need to add an new line inside the php file.

And then i can do something like this

pUser->AddText(pUser->m_idPlayer has kicked you from the game) and for the kick off course using

g_DPCoreClient.SendKillPlayer( bi2.dwTargetId, bi2.dwTargetId );

or

g_DPCoreClient.SendKillPlayer(pUser->m_idPlayer, bi2.dwTargetId );