Raised This Month: $ Target: $400
 0% 

2 things.. Send a sprite message only to a team. and another thing!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
nico_barrera
Junior Member
Join Date: Nov 2009
Location: PC
Old 09-14-2015 , 16:52   2 things.. Send a sprite message only to a team. and another thing!
Reply With Quote #1

Title! ...
this is my code for the sprite...

Code:
    message_begin(MSG_ALL,SVC_TEMPENTITY)
    write_byte(124)
    write_byte(id)
    write_coord(65)
    write_short(myspr)
    write_short(20)
    message_end();
i don't want to be visible for ct team, or tt team...
i had some ideas like:
Code:
    for(id=1 ; id<=maxplayers ; id++)
    {
      if(userteam == 1)
            sprite_code(id,team)
and modify the code so it's send to only one player..
i don't know if that is possible at all!
also... how i increase/decrease the duration of the sprite?!


and the other part is in the attached image, that snapshot it's from a mod called "Trouble in terrorist town"... i check the mod but it has aprox.. 20 plugins to work and i wasn't able to find where is that part of code... ty!

PS: in ttt uses the sprite thing that i need, i mean.. they put a sprite above te players that are traitors, and only traitors are able to see it! so... probably the answer of my post is in the sma's of ttt.. sadly i can't find it!..

ty for reading and sorry 4 the english mistakes! i didn't realize that is more easy to talk english that write english!
Attached Images
File Type: jpg asdasd.jpg (24.1 KB, 298 views)
nico_barrera is offline
Send a message via MSN to nico_barrera
nico_barrera
Junior Member
Join Date: Nov 2009
Location: PC
Old 09-23-2015 , 19:29   Re: 2 things.. Send a sprite message only to a team. and another thing!
Reply With Quote #2

UPDATE!

It's okay if i do this?
Code:
public Code_Pase(id)
{
    new CsTeams:cs = cs_get_user_team(id)
    for( new i = 1; i <= maxplayers; i++ )
    {
        if (cs_get_user_team(i) == cs)
        {
            message_begin(MSG_ONE,SVC_TEMPENTITY)
            write_byte(124)
            write_byte(id)
            write_coord(65)
            write_short(pasespr )
            write_short(20)
            message_end();
        }
    }
}

the idea is to show the sprite only to "ID" team...
nico_barrera is offline
Send a message via MSN to nico_barrera
wickedd
Veteran Member
Join Date: Nov 2009
Old 09-23-2015 , 19:51   Re: 2 things.. Send a sprite message only to a team. and another thing!
Reply With Quote #3

That code wont work as is. Use get_players() then you wouldn't need a loop.
PHP Code:
get_playersplayerscount"eh" "CT" 
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
nico_barrera
Junior Member
Join Date: Nov 2009
Location: PC
Old 09-23-2015 , 20:08   Re: 2 things.. Send a sprite message only to a team. and another thing!
Reply With Quote #4

In plugin-init i do

maxplayers = get_maxplayers()

i don't understand what are you trying to say..

without looping? how is that?
nico_barrera is offline
Send a message via MSN to nico_barrera
nico_barrera
Junior Member
Join Date: Nov 2009
Location: PC
Old 09-25-2015 , 02:05   Re: 2 things.. Send a sprite message only to a team. and another thing!
Reply With Quote #5

Update 2 folks!

new code for sprite..

Code:
public Code_Pase(id)
{
	new team = get_user_team(id)
	for( new i = 1; i <= MAX_PLAYER; i++ )
	{
		if (get_user_team(i) == team  && is_user_connected(i))
		{
			message_begin(MSG_ONE, SVC_TEMPENTITY, _, i);
			write_byte(TE_PLAYERATTACHMENT);
			write_byte(id);
			write_coord(45);
			write_short(pasespr)
			write_short(30);
			message_end();
		}
	}
}

the idea is that the sprite "pasespr" appears at one player (in this case is *id*) and only his team can see it!

and another question wich part of write_ sends the duration of the sprite?
nico_barrera is offline
Send a message via MSN to nico_barrera
OnePL
BANNED
Join Date: May 2012
Location: GB
Old 09-25-2015 , 08:04   Re: 2 things.. Send a sprite message only to a team. and another thing!
Reply With Quote #6

PHP Code:
write_short(30
is a life * 10
OnePL is offline
Send a message via ICQ to OnePL Send a message via AIM to OnePL Send a message via Yahoo to OnePL Send a message via Skype™ to OnePL
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-25-2015 , 09:06   Re: 2 things.. Send a sprite message only to a team. and another thing!
Reply With Quote #7

Look in messages_const, you have there the message structure.
Quote:
Originally Posted by messages_const.inc
#define TE_PLAYERATTACHMENT 124 // Attaches a TENT to a player (this is a high-priority tent)
// write_byte(TE_PLAYERATTACHMENT)
// write_byte(entity index of player)
// write_coord(vertical offset) (attachment origin.z = player origin.z + vertical offset)
// write_short(model index)
// write_short(life * 10 )
__________________

Last edited by HamletEagle; 09-25-2015 at 09:06.
HamletEagle is offline
nico_barrera
Junior Member
Join Date: Nov 2009
Location: PC
Old 09-25-2015 , 23:42   Re: 2 things.. Send a sprite message only to a team. and another thing!
Reply With Quote #8

Perfect guys... now i'm having one problem.. why the sprite looks like this?

See Attached Image!

with some other sprites works fine, without that black background, somehow with another looks like the image. That depends on what?.. the code or the sprite file?


PD: the second question that no one answer me!
Attached Images
File Type: jpg sj_indoorx_small0007.jpg (31.4 KB, 173 views)
nico_barrera is offline
Send a message via MSN to nico_barrera
nico_barrera
Junior Member
Join Date: Nov 2009
Location: PC
Old 10-07-2015 , 19:46   Re: 2 things.. Send a sprite message only to a team. and another thing!
Reply With Quote #9

and the other part is in the attached image, that snapshot it's from a mod called "Trouble in terrorist town"... i check the mod but it has aprox.. 20 plugins to work and i wasn't able to find where is that part of code... ty!

PS: in ttt uses the sprite thing that i need, i mean.. they put a sprite above te players that are traitors, and only traitors are able to see it! so... probably the answer of my post is in the sma's of ttt.. sadly i can't find it!..
nico_barrera is offline
Send a message via MSN to nico_barrera
Reply


Thread Tools
Display Modes

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 22:14.


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