AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Removing Spectator Banner (https://forums.alliedmods.net/showthread.php?t=156829)

johnally 05-12-2011 17:28

Removing Spectator Banner
 
Here I am again. I hate starting new threads but after some search, I guess It is a must :/

I used the coding below to add a spectator banner top-left.

PHP Code:

// sum of tga files
#define TGASUM 1

// tga of banners
new szTga[TGASUM][] ={
"gfx/banner1.tga"


PHP Code:

public joined_team()
{
    new 
id get_id();

    if ( 
g_SendOnce[id] && is_user_connected(id) )
    {
        
// random select one tga
        
new index random_num0TGASUM 1)
        
g_SendOnce[id] = false

        
// send show tga command to client
        
message_beginMSG_ONESVC_DIRECTOR_id )
        
write_bytestrlenszTga[index]) + // command length in bytes
        
write_byteDRC_CMD_BANNER )
        
write_stringszTga[index] ) // banner file
        
message_end()
   }


However, when client disconnects from server and connects somewhere else, he still sees the banner as I guess it was cached.

Is there a way to clear the banner from cache or add null data to replace the banner?

Btw, I am really thankful of the help you are giving me guys :)

Hunter-Digital 05-12-2011 18:36

Re: Removing Spectator Banner
 
Have you tried...

Code:

message_begin(MSG_ONE, SVC_DIRECTOR, _, id)
write_byte(2) // or 3 ?
write_byte(DRC_CMD_BANNER)
write_string("")
message_end()

?

fysiks 05-12-2011 19:05

Re: Removing Spectator Banner
 
And how are you going to do this after they already left the server? (or does it not take immediate affect when sending that message?)

Hunter-Digital 05-12-2011 23:17

Re: Removing Spectator Banner
 
Yeah that too, you can't send anything to the client if they disconnect.

Unless you want to disable the banner on your server to prevent players of seeing banners of their previous server.

johnally 05-13-2011 09:31

Re: Removing Spectator Banner
 
I'm not very sure if client_disconnect catches the event when the player is leaving or when he already left. That is a big consideration. :s

Thanks hunter-digital :).. Parsing an empty string might be the solution. Will test that as soon as I get my web interface down..

Thanks, you all.. From now on, I'll take a stick and poke my way through :D

SonicSonedit 05-13-2011 12:17

Re: Removing Spectator Banner
 
johnally
Quote:

Originally Posted by johnally
I'm not very sure if client_disconnect catches the event when the player is leaving or when he already left.

After player already left.

johnally 05-13-2011 18:21

Re: Removing Spectator Banner
 
Thanks sonicsonedit :) Now I can rest in peace :D


All times are GMT -4. The time now is 04:27.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.