AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   2 things.. Send a sprite message only to a team. and another thing! (https://forums.alliedmods.net/showthread.php?t=271549)

nico_barrera 09-14-2015 16:52

2 things.. Send a sprite message only to a team. and another thing!
 
1 Attachment(s)
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! :stupid:

nico_barrera 09-23-2015 19:29

Re: 2 things.. Send a sprite message only to a team. and another thing!
 
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...

wickedd 09-23-2015 19:51

Re: 2 things.. Send a sprite message only to a team. and another thing!
 
That code wont work as is. Use get_players() then you wouldn't need a loop.
PHP Code:

get_playersplayerscount"eh" "CT" 


nico_barrera 09-23-2015 20:08

Re: 2 things.. Send a sprite message only to a team. and another thing!
 
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 09-25-2015 02:05

Re: 2 things.. Send a sprite message only to a team. and another thing!
 
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?

OnePL 09-25-2015 08:04

Re: 2 things.. Send a sprite message only to a team. and another thing!
 
PHP Code:

write_short(30

is a life * 10

HamletEagle 09-25-2015 09:06

Re: 2 things.. Send a sprite message only to a team. and another thing!
 
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 )


nico_barrera 09-25-2015 23:42

Re: 2 things.. Send a sprite message only to a team. and another thing!
 
1 Attachment(s)
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!
https://forums.alliedmods.net/attach...0&d=1442263849

nico_barrera 10-07-2015 19:46

Re: 2 things.. Send a sprite message only to a team. and another thing!
 
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!..


All times are GMT -4. The time now is 22:14.

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