Renegade Creativity!
Welcome to Renegadeskins! You'll need to login in order to use all the features, like downloads, and view all the sections of this site.
[CODE] cScTextObj class definition Joinus10

Registration is free and will only take a few seconds of your time.
Features of a registered account:
-Your allowed to post and comment Skins.
-No Ads.
And much more
Renegade Creativity!
Welcome to Renegadeskins! You'll need to login in order to use all the features, like downloads, and view all the sections of this site.
[CODE] cScTextObj class definition Joinus10

Registration is free and will only take a few seconds of your time.
Features of a registered account:
-Your allowed to post and comment Skins.
-No Ads.
And much more
Renegade Creativity!
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Renegade Creativity!

Forum Statistics: 2766 Threads | 19061 Posts | 1536 Users | Welcome to our newest member https://renegadeskins.forumieren.de/u1562
 
HomeSearchLatest imagesRegisterStaffLog in
We're attempting to expand to support more games, please post skinable games suggestions and tell your friends!

Share | 
 

 [CODE] cScTextObj class definition

View previous topic View next topic Go down 
AuthorMessage
marcin205  
  
marcin205
   Active Member


Number of posts : 986

Age : 40

Reputation : 38

Registration date : 2008-11-11


[CODE] cScTextObj class definition _
PostSubject: [CODE] cScTextObj class definition   [CODE] cScTextObj class definition EmptyMon Jun 11, 2012 12:52 pm

Quote :
This is what the engine uses to send out most text "stuff" to players. It's used by the PPAGE, MSG, AMSG, TMSG console commands and it's called whenever a player sends team, public and private chat to the server (to echo the text to the target(s)).

ID is the player ID of the guy to send the text as, this is set to -1 if you want to send as the host (for PPAGE, MSG etc)

Target is a specific player ID to send the message to, leave this -1 if you don't have a specific target (e.g. want to send a team chat or a HOST message).

Type can be public, private or team chat. Team chat is done with an 'ID' that is a valid player ID, 'Target' set to -1 and type set to TEXT_MESSAGE_TEAM (value is 1).

Message is the message to send..

IsPopup is used by the AMSG console command and variants of it, it will show the text as a message window.



.h
Quote :
class cScTextObj : public NetworkObjectClass
{
public:

int ID;
int Target;
TextMessageEnum Type;
WideStringClass Message;
bool IsPopup;

void Init(const WideStringClass& Message, TextMessageEnum Type, bool IsPopup, int ID, int Target);
cScTextObj* Constructor();

void Act();
}

.cpp (without the header #includes)

Quote :
void* HookupAT3x(void* a, void* b, void* c, void* patch_start, void* patch_end, int (*version_selector)())
{
return HookupAT3(a,b,c,patch_start,patch_end,version_selector);
}

RENEGADE_FUNCTION
uint Send_Object_Update(NetworkObjectClass* object, int remoteHostId)
AT2(0x00461820,0x004612F0);

RENEGADE_FUNCTION
void cScTextObj::Act()
AT2(0x004B9720, 0x004B9720);

RENEGADE_FUNCTION
cScTextObj* __thiscall cScTextObj::Constructor()
AT2(0x004B9140, 0x004B9140);
//AT2(0x004B5AA0, 0x004B5AA0);

RENEGADE_FUNCTION
void cScTextObj::Init(const WideStringClass& Message, TextMessageEnum Type, bool IsPopup, int ID, int Target)
AT2(0x004B91F0, 0x004B91F0);

Examples:

Have PlayerID show him sending a team chat mesage with the text "DERP", only on his client (the other players won't see this team chat message)

Quote :
// Create a new cScTextObj
cScTextObj* TextObj = (cScTextObj*)operator new(sizeof(cScTextObj));
TextObj = TextObj->Constructor();


TextObj->ID = PlayerID; // Sender is PlayerID
TextObj->Type = TEXT_MESSAGE_TEAM; // Team chat message
TextObj->Message = L"DERP"; // Message to send

// Show the message only to PlayerID
TextObj->Set_Object_Dirty_Bits(PlayerID, NetworkObjectClass::BIT_CREATION);
Send_Object_Update(TextObj, PlayerID);

// Delete stuff
TextObj->Set_Delete_Pending();
delete TextObj;

Show a message window for every player (same thing as AMSG does):

Quote :
cScTextObj* TextObj = (cScTextObj*)operator new(sizeof(cScTextObj));
TextObj = TextObj->Constructor();
TextObj->Init(L"DERP", TEXT_MESSAGE_PUBLIC, true, -1, -1);


Send a host message to all players not running scripts 2.9 or higher and send a white coloured message for those who do (can be expanded on to change the name of a player and send the text as that player, then change his name back):


Quote :
void Send_Special_Host_Message(const char *Format, ...)
{
char buffer[256];

va_list va;
_crt_va_start(va, Format);
vsnprintf(buffer, 256, Format, va);
va_end(va);

cScTextObj* TextObj = (cScTextObj*)operator new(sizeof(cScTextObj));
TextObj = TextObj->Constructor();

TextObj->Message = buffer;

for (SLNode* PlayerIter = Get_Player_List()->Head(); (PlayerIter != NULL); PlayerIter = PlayerIter->Next())
{
cPlayer *p = PlayerIter->Data();

if (p->IsActive && Get_GameObj(p->Get_Id()))
{
float Version = Get_Client_Version(p->Get_Id());

if (Version < 2.9)
{
TextObj->Set_Object_Dirty_Bits(p->Get_Id(), NetworkObjectClass::BIT_CREATION);
Send_Object_Update(TextObj, p->Get_Id());
}
else
{
Send_Message_Player(Get_GameObj(p->Get_Id()), 250, 255, 255, buffer);
}
}
}
TextObj->Set_Delete_Pending();
delete TextObj;
}

Creator:Iranian
Back to top Go down
 

[CODE] cScTextObj class definition

View previous topic View next topic Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Renegade Creativity! :: Video Game Skins :: Renegade Skins :: -Other Downloads- :: ServerSide Plugins :: Sources SSGM-
Jump to: