Raised This Month: $ Target: $400
 0% 

Sprite edit


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
thomp22
Junior Member
Join Date: Feb 2011
Old 06-16-2011 , 14:25   Sprite edit
Reply With Quote #1

How could i manipulate the sprite of only a certain player, not everyones?


ie:
Code:
spr = get_user_msgid( "someSprite" );
register_message( spr, "Message_spr" );
 
    
    public Message_spr()
    {
        set_msg_arg_int( 2, ARG_BYTE, 255 ); 
        set_msg_arg_int( 3, ARG_BYTE, 0 ); 
        set_msg_arg_int( 4, ARG_BYTE, 0 );
    }
thomp22 is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 06-16-2011 , 19:04   Re: Sprite edit
Reply With Quote #2

3rd input variable is the player id:
Code:
public Message_spr(msgid, dest, id)
Use that to filter players.

If it doesn't seem to work, make sure it's beeing sent to each player, print a debug message with dest and id variables (dest beeing MSG_* defines from message_const.inc)
__________________

Last edited by Hunter-Digital; 06-16-2011 at 19:08.
Hunter-Digital is offline
thomp22
Junior Member
Join Date: Feb 2011
Old 06-17-2011 , 05:02   Re: Sprite edit
Reply With Quote #3

I have no idea how this filtering works how do you make it?. I tried:

Code:
 public Message_Powerup(msgid, dest, id)
    {
        
        if( id == 0 )
    {
            set_msg_arg_int( 2, ARG_BYTE, 255 ); 
            set_msg_arg_int( 3, ARG_BYTE, 0 ); 
                set_msg_arg_int( 4, ARG_BYTE, 0 );
    }
    else if( id == 1 ) 
    {
        set_msg_arg_int( 2, ARG_BYTE, 0 ); 
            set_msg_arg_int( 3, ARG_BYTE, 255 ); 
                set_msg_arg_int( 4, ARG_BYTE, 0 );
    }
    else
    {
        set_msg_arg_int( 2, ARG_BYTE, 0 ); 
            set_msg_arg_int( 3, ARG_BYTE, 0 ); 
                set_msg_arg_int( 4, ARG_BYTE, 0 );
    }
}
thomp22 is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 06-17-2011 , 06:24   Re: Sprite edit
Reply With Quote #4

id is the player's entity from 1 to 32, 0 is the server.

You don't just hardcode the values because any player can be entity id.

You can toggle sprites on/off using a command for example:

Code:
#include <amxmodx>

new bool:g_bSpr[33]

public plugin_init()
{
    register_message(get_user_msgid("What message ??"), "msg_test")

    register_clcmd("say /test", "cmd_test")
}

public cmd_test(id)
{
    g_bSpr[id] = !g_bSpr[id] /* assign the variable to it's opossite value, if true, set false, if false, set true. */

    if(g_bSpr[id])
    {
        client_print(id, print_chat, "Toggled ON")
    }
    else
    {
        client_print(id, print_chat, "Toggled OFF")
    }
}

public msg_test(msgid, dest, id)
{
    if(g_bSpr[id])
    {
        // if toggled ON, this code executes when the message triggers for this player
    }
}
Also, get_user_msgid() gets a MESSAGE id, you can't hook sprite files.
__________________
Hunter-Digital is offline
thomp22
Junior Member
Join Date: Feb 2011
Old 06-17-2011 , 09:55   Re: Sprite edit
Reply With Quote #5

It didn't seem to work. It doesn't identify each players but treats them in a similar fashion imo. I use pl[] bool array to see which color to show for each player. But i found out the only value that matters is pl[0] and when it is true, it changes the color for all players vice versa. I wonder what goes wrong? If pl[1] = true then it should change the color only for player1.
Ideas?

Anyway are there other methods to manipulate sprite colors and other values?
Code:
#include <amxmodx>
#include <fakemeta>
#include <amxmisc>

    #define PLUGIN  "ESF color change"
    #define VERSION "1.0"
    #define AUTHOR  "thompsoni"



    
        new gMsgPowerUp;
    new bool:pl[33]
    new i;



    public plugin_init()
    {
        register_plugin( PLUGIN, VERSION, AUTHOR );
        //register_forward( FM_EmitSound, "fw_EmitSound" );
        
    //change color cmd
    register_clcmd("say /test", "cmd_test")


        gMsgPowerUp = get_user_msgid( "Powerup" );
        register_message( gMsgPowerUp, "Message_Powerup" );

    
    
        
    
    for(i=0; i<32; i++)
    {
        pl[i] = false;
    }
    

    }
    

    
public cmd_test(id)
{
    pl[id] = !pl[id] /* assign the variable to it's opossite value, if true, set false, if false, set true. */

    if(pl[id])
    {
        client_print(id, print_chat, "Toggled ON")
    }
    else
    {
        client_print(id, print_chat, "Toggled OFF")
    }
}




    public Message_Powerup(msgid, dest, id)
    {
        
        if( pl[id] )
    {
            set_msg_arg_int( 2, ARG_BYTE, 255 ); 
            set_msg_arg_int( 3, ARG_BYTE, 0 ); 
                set_msg_arg_int( 4, ARG_BYTE, 0 );
    }
    else
    {
        set_msg_arg_int( 2, ARG_BYTE, 255 ); 
            set_msg_arg_int( 3, ARG_BYTE, 0 ); 
                set_msg_arg_int( 4, ARG_BYTE, 255 );
    }



    }
thomp22 is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 06-17-2011 , 15:59   Re: Sprite edit
Reply With Quote #6

You might want to learn to indent your code... too many random spaces there.

Next, if your initial code worked, this should work too... I don't know ESF's messages so I can't help you there.
__________________
Hunter-Digital is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 06-18-2011 , 05:38   Re: Sprite edit
Reply With Quote #7

There's a plugin that changes smoke's color, if you're interested how he did it, just look into it's source.
__________________
Hunter-Digital 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 23:29.


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