Raised This Month: $ Target: $400
 0% 

Message ignore spectators


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Roccoxx
AlliedModders Donor
Join Date: Jan 2012
Location: Argentina
Old 08-09-2014 , 12:09   Message ignore spectators
Reply With Quote #1

hi, i need a MSG_ or form to ignore spectators, and show the effect to the rest of players, in preference with UNRELIABLE chanel

example this effect:

PHP Code:
message_begin(MSG_BROADCASTSVC_TEMPENTITYorigin2)
    
write_byte(TE_BREAKMODEL)
    
write_coord(origin2[0])
    
write_coord(origin2[1])
    
write_coord(origin2[2]+24)
    
write_coord(16)
    
write_coord(16)
    
write_coord(16)
    
write_coord(random_num(-5050)) 
    
write_coord(random_num(-5050))
    
write_coord(25)
    
write_byte(10)
    
write_short(g_glassSpr)
    
write_byte(10)
    
write_byte(25)
    
write_byte(BREAK_GLASS)
    
message_end() 
__________________
Tutorials here (Spanish)

Like as another Pijudo said: "Tired and retired"
Roccoxx is offline
Send a message via MSN to Roccoxx
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 08-09-2014 , 15:30   Re: Message ignore spectators
Reply With Quote #2

Loop through all clients and send the message with MSG_ONE_UNRELIABLE (to one client at a time) instead of MSG_BROADCAST (which targets everyone on the server). Skip all spectators.
__________________
In Flames we trust!
Nextra is offline
Roccoxx
AlliedModders Donor
Join Date: Jan 2012
Location: Argentina
Old 08-09-2014 , 15:44   Re: Message ignore spectators
Reply With Quote #3

Quote:
Originally Posted by Nextra View Post
Loop through all clients and send the message with MSG_ONE_UNRELIABLE (to one client at a time) instead of MSG_BROADCAST (which targets everyone on the server). Skip all spectators.
yes, i use this form. but I thought there was a better way :S
__________________
Tutorials here (Spanish)

Like as another Pijudo said: "Tired and retired"
Roccoxx is offline
Send a message via MSN to Roccoxx
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 08-10-2014 , 07:36   Re: Message ignore spectators
Reply With Quote #4

Quote:
Originally Posted by Roccoxx View Post
yes, i use this form. but I thought there was a better way :S
MSG_ALL and BROADCAST is basically the same thing as a loop
PHP Code:
for(new i;i<33;i++)
{
if(
is_user_connected[i])
{
new 
CsTeams:team cs_get_user_team(i)
switch(
team)
{
case 
CS_TEAM_CTCS_TEAM_T: {...msg_one_unreliable...}
}
}

__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
aron9forever is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-11-2014 , 04:19   Re: Message ignore spectators
Reply With Quote #5

Quote:
Originally Posted by aron9forever View Post
MSG_ALL and BROADCAST is basically the same thing as a loop
PHP Code:
for(new i;i<33;i++)
{
if(
is_user_connected[i])
{
new 
CsTeams:team cs_get_user_team(i)
switch(
team)
{
case 
CS_TEAM_CTCS_TEAM_T: {...msg_one_unreliable...}
}
}

Do you know that you can simply use continue when a player is spectator( to skip him ) ?
Also, why not using get_players ?
__________________
HamletEagle is offline
PreDominance
Member
Join Date: Jul 2014
Old 08-11-2014 , 15:17   Re: Message ignore spectators
Reply With Quote #6

What hamlet said: get_players returns the number of players in the server, so you only have to loop for (new i; i < num; i++) {}.
PreDominance is offline
Roccoxx
AlliedModders Donor
Join Date: Jan 2012
Location: Argentina
Old 08-11-2014 , 15:26   Re: Message ignore spectators
Reply With Quote #7

please close this
__________________
Tutorials here (Spanish)

Like as another Pijudo said: "Tired and retired"
Roccoxx is offline
Send a message via MSN to Roccoxx
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-12-2014 , 05:07   Re: Message ignore spectators
Reply With Quote #8

Quote:
Originally Posted by Roccoxx View Post
please close this
Nothing get closed
__________________
HamletEagle is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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