Teleport Fixed

This commit is contained in:
SchnitzelPommes 2018-11-29 23:03:48 +01:00
parent 7a4ffd3712
commit 5f095cae80
6 changed files with 103 additions and 40 deletions

View File

@ -267,20 +267,19 @@ class CommunityOfflineServer : MissionServer
bool IsAdmin( string name, string ID )
{
array<Man> players = new array<Man>;
GetGame().GetPlayers( players );
for (int i = 0; i < players.Count(); ++i)
{
if (players.Get(i).GetIdentity().GetName() == name && m_AdminList.Contains(ID))
{
return true;
}
return false;
}
return false;
}
// bool IsAdmin( string name, string ID )
// {
// array<Man> players = new array<Man>;
// GetGame().GetPlayers( players );
// for (int i = 0; i < players.Count(); ++i)
// {
// if (players.Get(i).GetIdentity().GetName() == name && m_AdminList.Contains(ID))
// {
// return true;
// }
// }
// return false;
// }
@ -289,7 +288,6 @@ class CommunityOfflineServer : MissionServer
GetGame().GetWorld().GetPlayerList(m_Players);
array<Man> players = new array<Man>;
GetGame().GetPlayers( players );
CLogDebug("Player Count : " + players.Count().ToString() );
//PlayerBase currentPlayer;
int Count = 0;
for (int i = 0; i < players.Count(); ++i)
@ -316,6 +314,30 @@ class CommunityOfflineServer : MissionServer
}
return Admin;
}
bool IsAdmin(string name, string ID )
{
GetGame().GetWorld().GetPlayerList(m_Players);
array<Man> players = new array<Man>;
GetGame().GetPlayers( players );
//PlayerBase currentPlayer;
int Count = 0;
for (int i = 0; i < players.Count(); ++i)
{
if(Count >= m_Players.Count() )
{
Count = 0;
}
PlayerBase currentPlayer = PlayerBase.Cast(m_Players.Get(Count));
if (currentPlayer.GetIdentity().GetName() == name && m_AdminList.Contains(ID))
{
Admin = currentPlayer;
return true;
}else
Count ++;
}
return false;
}
ref Man GetPlayerFromIdentity( PlayerIdentity identity )
{

View File

@ -26,6 +26,7 @@ class AdminMenu //extends UIScriptedMenu
PlayerBase Admin;
PlayerIdentity AdminIdentity;
string AdminUID;
ref array<Man> m_Players;
void AdminMenu()
{
@ -53,6 +54,7 @@ class AdminMenu //extends UIScriptedMenu
ItemBase oItem = NULL;
PlayerIdentity AdminIdent;
bool ai = false;
int Count = 0;
int quantity = 0;
string text = "";
@ -406,23 +408,58 @@ class AdminMenu //extends UIScriptedMenu
Admin = GetServerMission().IsAdminID(sender.GetName(), sender.GetPlainId());
if ( Admin != NULL)
{
for ( int z = 0; z < players.Count(); ++z )
array<Man> playerstptp = new array<Man>;
GetGame().GetPlayers( playerstptp );
vector AdminPos;
AdminPos = Admin.GetPosition();
GetServerMission().CLogDebug("TPTO Target : " + selectedIdentity.GetName() + " PlayerName : " + PlayerName);
for ( int it = 0; it < playerstptp.Count(); ++it )
{
selectedPlayer = players.Get(z);
selectedIdentity = selectedPlayer.GetIdentity();
GetServerMission().CLogDebug("Current Player : " + selectedIdentity.GetName() + "TP Player name : " + PlayerName);
PlayerBase Targettpto = playerstptp.Get(it);
selectedIdentity =playerstptp.Get(it).GetIdentity();
GetServerMission().CLogDebug("TPTO Target : " + selectedIdentity.GetName() + " PlayerName : " + PlayerName + " Number :" + it.ToString());
if ( selectedIdentity.GetName() == PlayerName )
{
selectedPlayer.SetPosition(Admin.GetPosition());
Msgparam = new Param1<string>( "You were teleported by the admin!" );
GetGame().RPCSingleParam(Admin, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, selectedIdentity);
strMessage = "Player " + PlayerName + " was teleported to your location!";
Msgparam = new Param1<string>( strMessage );
GetGame().RPCSingleParam(Admin, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, AdminIdentity);
//PlayerBase Target = players.Get(i);
Targettpto.SetPosition( AdminPos );
}
}
// for ( int z = 0; z < players.Count(); ++z )
// {
// if(Count >= m_Players.Count() )
// {
// Count = 0;
// }
// selectedPlayer = PlayerBase.Cast(m_Players.Get(Count));
// selectedIdentity = selectedPlayer.GetIdentity();
// GetServerMission().CLogDebug("Current Player : " + selectedIdentity.GetName() + "TP Player name : " + PlayerName);
// if ( selectedIdentity.GetName() == PlayerName )
// {
// selectedPlayer.SetPosition(Admin.GetPosition());
// Msgparam = new Param1<string>( "You were teleported by the admin!" );
// GetGame().RPCSingleParam(Admin, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, selectedIdentity);
// strMessage = "Player " + PlayerName + " was teleported to your location!";
// Msgparam = new Param1<string>( strMessage );
// GetGame().RPCSingleParam(Admin, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, AdminIdentity);
// }
// Count ++;
//}
}
}

View File

@ -58,13 +58,13 @@ class AdminMenuGuiPlayer extends ScriptedWidgetEventHandler
m_btn_Player_Strip = ButtonWidget.Cast( m_Root.FindAnyWidget( "btn_Player_Strip" ) );
m_btn_Player_Kill = ButtonWidget.Cast( m_Root.FindAnyWidget( "btn_Player_Kill" ) );
m_btn_Player_Heal = ButtonWidget.Cast( m_Root.FindAnyWidget( "btn_Player_Heal" ) );
m_btn_Player_TpMe = ButtonWidget.Cast( m_Root.FindAnyWidget( "btn_Player_TpMe" ) );
m_btn_Player_TpTo = ButtonWidget.Cast( m_Root.FindAnyWidget( "btn_Player_TpTo" ) );
m_btn_Player_TpMe = ButtonWidget.Cast( m_Root.FindAnyWidget( "btn_Player_tpMe" ) );
m_btn_Player_TpTo = ButtonWidget.Cast( m_Root.FindAnyWidget( "btn_Player_tpto" ) );
m_btn_Player_Stamina = ButtonWidget.Cast( m_Root.FindAnyWidget( "btn_Player_Stamina" ) );
m_btn_Player_KillAll = ButtonWidget.Cast( m_Root.FindAnyWidget( "btn_Player_KillAll" ) );
m_btn_Player_HealAll = ButtonWidget.Cast( m_Root.FindAnyWidget( "btn_Player_HealAll" ) );
m_btn_Player_StripAll = ButtonWidget.Cast( m_Root.FindAnyWidget( "btn_Player_StripAll" ) );
m_btn_Player_TpMeAll = ButtonWidget.Cast( m_Root.FindAnyWidget( "btn_Player_TpMeAll" ) );
m_btn_Player_TpMeAll = ButtonWidget.Cast( m_Root.FindAnyWidget( "btn_Player_tpMeAll" ) );
m_btn_Player_Send = ButtonWidget.Cast( m_Root.FindAnyWidget( "btn_Player_Send" ) );
m_Text_Player_Blood = TextWidget.Cast( m_Root.FindAnyWidget( "Text_Player_Blood" ) );
m_Text_Player_Health = TextWidget.Cast( m_Root.FindAnyWidget( "Text_Player_Energy" ) );
@ -73,7 +73,10 @@ class AdminMenuGuiPlayer extends ScriptedWidgetEventHandler
//PlayerList();
GetGame().RPCSingleParam( NULL, M_RPCs.M_Admin_Menu_Player_List_Request, new Param1<string>(""), false, NULL );
}
void LogD(string s)
{
GetGame().RPCSingleParam( NULL, M_RPCs.M_Admin_Menu_Log_Debug, new Param1<string>( s ), false, NULL );
}
bool Click(Widget w, int x, int y, int button)
{
PlayerBase player = PlayerBase.Cast( GetGame().GetPlayer() );
@ -109,6 +112,7 @@ class AdminMenuGuiPlayer extends ScriptedWidgetEventHandler
if( ( w == m_btn_Player_TpMe ) )
{
GetGame().RPCSingleParam( NULL, M_RPCs.M_Admin_Menu_TpMe, new Param1<string>(PlayerName), false, NULL );
LogD("AdminMenuPlayer - Click - m_btn_Player_TpMe Playername : " + PlayerName)
return true;
}

View File

@ -85,6 +85,15 @@ FrameWidgetClass rootFrame {
text "Strip Player"
}
ButtonWidgetClass btn_Player_tpMe {
position 610 330
size 350 45
hexactpos 1
vexactpos 1
hexactsize 1
vexactsize 1
text "Teleport To Player"
}
ButtonWidgetClass btn_Player_tpto {
position 610 390
size 350 45
hexactpos 1
@ -93,15 +102,6 @@ FrameWidgetClass rootFrame {
vexactsize 1
text "Teleport Player here"
}
ButtonWidgetClass btn_Player_tpto {
position 610 330
size 350 45
hexactpos 1
vexactpos 1
hexactsize 1
vexactsize 1
text "Teleport to Player"
}
ButtonWidgetClass btn_Player_Heal {
position 610 210
size 350 45