AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   can i make MSG_PVS or MSG_BRADCAST not be shown to specific players? possible? (https://forums.alliedmods.net/showthread.php?t=89207)

Owyn 04-03-2009 16:17

can i make MSG_PVS or MSG_BRADCAST not be shown to specific players? possible?
 
cuz i want to make effects ON\OFF option for players but have no idea (if possible) how to limit them from seeing MSG_PVS and MSG_BRADCAST effects, tell me if you have any ideas how to

ot_207 04-03-2009 16:33

Re: can i make MSG_PVS or MSG_BRADCAST not be shown to specific players? possible?
 
Quote:

Originally Posted by .Owyn. (Post 796540)
cuz i want to make effects ON\OFF option for players but have no idea (if possible) how to limit them from seeing MSG_PVS and MSG_BRADCAST effects, tell me if you have any ideas how to

You can do that through this: register_message()
You register the message block it and resend it to the players you want ...

Owyn 04-03-2009 16:58

Re: can i make MSG_PVS or MSG_BRADCAST not be shown to specific players? possible?
 
you sure? about msgID, what will it be like?

can you please post more information how to do it, kinda hard for me to figure all out

ot_207 04-03-2009 16:58

Re: can i make MSG_PVS or MSG_BRADCAST not be shown to specific players? possible?
 
Quote:

Originally Posted by .Owyn. (Post 796569)
you sure? about msgID, what will it be like?

can you please post more information how to do it, kinda hard for me to figure all out

What type of messages would you like to block so I can give an specific example.
Tempentities?

Owyn 04-03-2009 17:04

Re: can i make MSG_PVS or MSG_BRADCAST not be shown to specific players? possible?
 
yes i suppose

here are list of my messages
effects.inl
PHP Code:

stock Create_TE_Smoke(originSight[3], position[3], iSpritescaleframerate){

    
message_beginMSG_PVSSVC_TEMPENTITYoriginSight )
    
write_byteTE_SMOKE )
    
write_coordposition[0] )            // Position
    
write_coordposition[1] )
    
write_coordposition[2] )
    
write_shortiSprite )                // Sprite index
    
write_bytescale )                    // scale * 10
    
write_byteframerate  )            // framerate
    
message_end()
}

stock Create_DeathMsg_CS(killer_id,victim_id,headshot,weaponname[]){

    
message_begin(MSG_ALL,gmsgDeathMsg)
    
write_byte(killer_id)
    
write_byte(victim_id)
    
write_byte(headshot)
    
write_string(weaponname)
    
message_end()
}

stock Create_TE_IMPLOSION(position[3], radiuscountlife){

    
message_beginMSG_BROADCASTSVC_TEMPENTITY )
    
write_byte TE_IMPLOSION )
    
write_coordposition[0] )            // position (X)
    
write_coordposition[1] )            // position (Y)
    
write_coordposition[2] )            // position (Z)
    
write_byte radius )                // radius
    
write_byte count )                // count
    
write_byte life )                    // life in 0.1's
    
message_end()
}

stock Create_TE_BEAMCYLINDER(origin[3], center[3], axis[3], iSpritestartFrameframeRatelifewidthamplituderedgreenbluebrightnessspeed){

    
message_beginMSG_PASSVC_TEMPENTITYorigin )
    
write_byteTE_BEAMCYLINDER )
    
write_coordcenter[0] )            // center position (X)
    
write_coordcenter[1] )            // center position (Y)
    
write_coordcenter[2] )            // center position (Z)
    
write_coordaxis[0] )                // axis and radius (X)
    
write_coordaxis[1] )                // axis and radius (Y)
    
write_coordaxis[2] )                // axis and radius (Z)
    
write_shortiSprite )                // sprite index
    
write_bytestartFrame )            // starting frame
    
write_byteframeRate )                // frame rate in 0.1's
    
write_bytelife )                    // life in 0.1's
    
write_bytewidth )                    // line width in 0.1's
    
write_byteamplitude )                // noise amplitude in 0.01's
    
write_bytered )                    // color (red)
    
write_bytegreen )                    // color (green)
    
write_byteblue )                    // color (blue)
    
write_bytebrightness )            // brightness
    
write_bytespeed )                    // scroll speed in 0.1's
    
message_end()
}

stock Create_TE_EXPLOSIONorigin[3], origin2[3], iSpritescaleframeRateflags ){

    
message_beginMSG_PVSSVC_TEMPENTITYorigin )
    
write_byteTE_EXPLOSION )
    
write_coordorigin2[0] )            // position (X)
    
write_coordorigin2[1] )            // position (Y)
    
write_coordorigin2[2]    )            // position (Z)
    
write_shortiSprite )                // sprite index
    
write_bytescale )                    // scale in 0.1's
    
write_byteframeRate )                // framerate
    
write_byteflags )                    // flags
    
message_end()
}

stock Create_ScreenShake(idamountdurationfrequency){

    if( 
is_user_connected(id) && !is_user_bot(id) )
    {

    
message_begin(MSG_ONE,gmsgScreenShake,{0,0,0},id
    
write_shortamount )                // ammount 
    
write_shortduration )                // lasts this long 
    
write_shortfrequency )            // frequency
    
message_end()
    
    }
}

stock Create_ScreenFade(iddurationholdtimefadetyperedgreenbluealpha){


    if( 
is_user_connected(id) && !is_user_bot(id) )
    {
    
message_beginMSG_ONE,gmsgScreenFade,{0,0,0},id )            
    
write_shortduration )            // fade lasts this long duration
    
write_shortholdtime )            // fade lasts this long hold time
    
write_shortfadetype )            // fade type (in / out)
    
write_bytered )                // fade red
    
write_bytegreen )                // fade green
    
write_byteblue )                // fade blue
    
write_bytealpha )                // fade alpha
    
message_end()
    }
}

stock Create_ScoreInfo(id,frags,deaths,playerClass,team ){

    
message_begin(MSG_ALL,gmsgScoreInfo)
    
write_byte(id)
    
write_short(frags)
    
write_short(deaths)
    
write_short(playerClass)
    
write_short(team)
    
message_end()
}

stock Create_TE_SPRITETRAIL(start[3], end[3], iSpritecountlifescalevelocityrandom ){

    
message_beginMSG_BROADCAST,SVC_TEMPENTITY)
    
write_byteTE_SPRITETRAIL )
    
write_coordstart[0] )                // start position (X)
    
write_coordstart[1] )                // start position (Y)
    
write_coordstart[2] )                // start position (Z)
    
write_coordend[0] )                // end position (X)
    
write_coordend[1] )                // end position (Y)
    
write_coordend[2] )                // end position (Z)
    
write_shortiSprite )                // sprite index
    
write_bytecount )                    // count
    
write_bytelife)                    // life in 0.1's
    
write_bytescale)                    // scale in 0.1's
    
write_bytevelocity )                // velocity along vector in 10's
    
write_byterandom )                // randomness of velocity in 10's
    
message_end()
}

stock Create_StatusText(idlinenumbertext[]){

    if( 
is_user_connected(id) && !is_user_bot(id) )
    {

    
message_beginMSG_ONEgmsgStatusText, {0,0,0}, id )
    
write_bytelinenumber )            // line number of status bar text
    
write_stringtext )                // status bar text
    
message_end()
    
    }
}

stock Create_BarTime(iddurationflag){

    if( 
is_user_connected(id) && !is_user_bot(id) )
    {

    
message_beginMSG_ONEgmsgBarTime, {0,0,0}, id )
    
write_byteduration // duration 
    
write_byteflag )
    
message_end() 
    
    }
}

stock Create_TE_BEAMFOLLOW(entityiSpritelifewidthredgreenbluealpha){

    
message_beginMSG_BROADCASTSVC_TEMPENTITY )
    
write_byteTE_BEAMFOLLOW )
    
write_shortentity )            // entity
    
write_shortiSprite )            // model
    
write_bytelife )                // life
    
write_bytewidth )                // width
    
write_bytered )                // red
    
write_bytegreen )                // green
    
write_byteblue )                // blue
    
write_bytealpha )                // brightness
    
message_end()
}

stock Create_TE_BEAMPOINTS(start[3], end[3], iSpritestartFrameframeRatelifewidthnoiseredgreenbluealphaspeed){

    
message_beginMSG_BROADCASTSVC_TEMPENTITY )
    
write_byteTE_BEAMPOINTS )
    
write_coordstart[0] )
    
write_coordstart[1] )
    
write_coordstart[2] )
    
write_coordend[0] )
    
write_coordend[1] )
    
write_coordend[2] )
    
write_shortiSprite )            // model
    
write_bytestartFrame )        // start frame
    
write_byteframeRate )            // framerate
    
write_bytelife )                // life
    
write_bytewidth )                // width
    
write_bytenoise )                // noise
    
write_bytered)                // red
    
write_bytegreen )                // green
    
write_byteblue )                // blue
    
write_bytealpha )                // brightness
    
write_bytespeed )                // speed
    
message_end()
}

stock Create_TE_BEAMENTS(startEntityendEntityiSpritestartFrameframeRatelifewidthnoiseredgreenbluealphaspeed){

    
message_beginMSG_BROADCASTSVC_TEMPENTITY )
    
write_byteTE_BEAMENTS )
    
write_shortstartEntity )        // start entity
    
write_shortendEntity )        // end entity
    
write_shortiSprite )            // model
    
write_bytestartFrame )        // starting frame
    
write_byteframeRate )            // frame rate
    
write_bytelife )                // life
    
write_bytewidth )                // line width
    
write_bytenoise )                // noise amplitude
    
write_bytered )                // red
    
write_bytegreen )                // green
    
write_byteblue )                // blue
    
write_bytealpha )                // brightness
    
write_bytespeed )                // scroll speed
    
message_end()
}

stock Create_TE_ELIGHT(entitystart[3], radiusredgreenbluelifedecayRate){

    
message_beginMSG_BROADCASTSVC_TEMPENTITY )
    
write_byteTE_ELIGHT )
    
write_shortentity )            // entity
    
write_coordstart[0] )            // initial position
    
write_coordstart[1] )            // initial position
    
write_coordstart[2] )            // initial position
    
write_coordradius )            // radius
    
write_bytered )                // red
    
write_bytegreen )                // green
    
write_byteblue )                // blue
    
write_bytelife )                // life
    
write_coorddecayRate )        // decay rate
    
message_end()
}

stock Create_TE_SPRAY(position[3], direction[3], iSpritecountspeednoiserendermode){

    
message_beginMSG_BROADCAST,SVC_TEMPENTITY 
    
write_byteTE_SPRAY )
    
write_coordposition[0] )        // Position
    
write_coordposition[1] ) 
    
write_coordposition[2] ) 
    
write_coorddirection[0] )        // Direction 
    
write_coorddirection[1] )  
    
write_coorddirection[2] ) 
    
write_shortiSprite )            // Sprite
    
write_bytecount )                // count 
    
write_bytespeed )                // speed 
    
write_bytenoise )                // noise
    
write_byterendermode )        // rendermode
    
message_end() 
}

stock Create_TE_SPRITE(position[3], iSpritescalealpha){

    
message_beginMSG_BROADCAST,SVC_TEMPENTITY 
    
write_byteTE_SPRITE 
    
write_coordposition[0] )        // position)
    
write_coordposition[1] ) 
    
write_coordposition[2] ) 
    
write_shortiSprite )            // sprite index
    
write_bytescale)                // scale in 0.1's
    
write_bytealpha )                // brightness
    
message_end() 
}

stock Create_StatusIcon(idstatussprite[], redgreenblue){

    if( 
is_user_connected(id) && !is_user_bot(id) )
    {

    
message_beginMSG_ONEgmsgStatusIcon, {0,0,0}, id 
    
write_bytestatus )            // status 
    
write_stringsprite )            // sprite name 
    
write_bytered )                // red 
    
write_bytegreen )                // green 
    
write_byteblue )                // blue 
    
message_end()
    
    }
}

stock Create_TE_LARGEFUNNEL(position[3], iSpriteflags){

    
message_beginMSG_BROADCASTSVC_TEMPENTITY )    
    
write_byteTE_LARGEFUNNEL )
    
write_coordposition[0] )        // origin, x
    
write_coordposition[1] )        // origin, y
    
write_coordposition[2] )        // origin, z
    
write_shortiSprite )            // sprite (0 for none)
    
write_shortflags )            // 0 for collapsing, 1 for sending outward
    
message_end() 
}

stock Create_TE_PLAYERATTACHMENT(identityvOffsetiSpritelife){

    if( 
is_user_connected(id) && !is_user_bot(id) )
    {

    
message_beginMSG_ONESVC_TEMPENTITY, { 00}, id )
    
write_byteTE_PLAYERATTACHMENT )
    
write_byteentity )            // entity
    
write_coordvOffset )            // vertical offset ( attachment origin.z = player origin.z + vertical offset )
    
write_shortiSprite )            // model index
    
write_shortlife )                // (life * 10 )
    
message_end()
    
    }
}
    
stock Create_TE_TELEPORT(position[3]){

    
message_beginMSG_PVSSVC_TEMPENTITYposition
    
write_byteTE_TELEPORT 
    
write_coordposition[0] ) 
    
write_coordposition[1] ) 
    
write_coordposition[2] ) 
    
message_end()



ot_207 04-03-2009 17:08

Re: can i make MSG_PVS or MSG_BRADCAST not be shown to specific players? possible?
 
Don't need that :).


PHP Code:

// 23 comes from temp entity message, for other messages use get_user_msgid()
// in plugin_init()
register_message("23","msg_tempentity")

public 
msg_tempentity(msg_id,msg_dest,ent)
{
        
// do stuff
        
return PLUGIN_HANDLED // to block it



Owyn 04-03-2009 17:16

Re: can i make MSG_PVS or MSG_BRADCAST not be shown to specific players? possible?
 
omg, supposted to work awesome, will it work for all SVC_TEMPENTITY ? will it hook temp entities created by other plugins too?

ot_207 04-03-2009 17:19

Re: can i make MSG_PVS or MSG_BRADCAST not be shown to specific players? possible?
 
Quote:

Originally Posted by .Owyn. (Post 796583)
omg, supposted to work awesome, will it work for all SVC_TEMPENTITY ? will it hook temp entities created by other plugins too?

Yes it will. The messages from the plugins will be blocked if they use emessage not message functions,

Owyn 04-03-2009 17:27

Re: can i make MSG_PVS or MSG_BRADCAST not be shown to specific players? possible?
 
so it won't affect messages like i posted above if they are not in the same plugin with code you posted? but it will if i replace message with emessage in other plugin? what is the difference between message and emessage?

ot_207 04-03-2009 17:30

Re: can i make MSG_PVS or MSG_BRADCAST not be shown to specific players? possible?
 
Quote:

Originally Posted by .Owyn. (Post 796594)
so it won't affect messages like i posted above if they are not in the same plugin with code you posted? but it will if i replace message with emessage in other plugin? what is the difference between message and emessage?

The emessages are hookable via register_event or register_message, that is the difference.
Emessage: PLUGIN->CORE->METAMOD->CORE->PLUGINS->CORE->METAMOD->GAME ENGINE
Message PLUGIN->CORE->METAMOD->GAME ENGINE


All times are GMT -4. The time now is 02:20.

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