Raised This Month: $ Target: $400
 0% 

[help] te_playerattachment


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Depresie
Veteran Member
Join Date: Nov 2013
Old 10-20-2015 , 05:06   [help] te_playerattachment
Reply With Quote #1

I've tried to create a sprite above the head for the members of a group, but i get the following error, Argument type mismatch (argument 1)

What did i do wrong?

Code:
#define iSprite "sprites/adn_sprites/adn_fireball_ex.spr"

public plugin_precache()
{
    precache_model(iSprite)
}

public cmdspr(id)
{
    new Players[32], user
    get_party_index(id, Players)
    for(new i; i < g_PartyData[id][Amount_In_Party]; i++)
    {
        user = Players[i]
        if(is_user_alive(user) && !zp_get_user_zombie(user))
        {
            Create_TE_PLAYERATTACHMENT(id, user)
        }
    }
}

stock Create_TE_PLAYERATTACHMENT(id, entity)
{
    message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, _, id)
    write_byte(TE_PLAYERATTACHMENT)
    write_byte(entity)
    write_coord(45)
    write_short(iSprite)
    write_short(0)
    message_end()
}
Depresie is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-20-2015 , 06:09   Re: [help] te_playerattachment
Reply With Quote #2

You are supposed to pass the sprite index, not the string. Either value returned by precache_model or EngFunc_ModelIndex.
__________________
Arkshine is offline
Chihuahuax
Senior Member
Join Date: Oct 2014
Location: Malaysia
Old 10-20-2015 , 06:12   Re: [help] te_playerattachment
Reply With Quote #3

PHP Code:
new iSprite

public plugin_precache()
{
    
iSprite precache_model("sprites/adn_sprites/adn_fireball_ex.spr")


Last edited by Chihuahuax; 10-20-2015 at 06:41.
Chihuahuax is offline
Send a message via Skype™ to Chihuahuax
Depresie
Veteran Member
Join Date: Nov 2013
Old 10-20-2015 , 06:50   Re: [help] te_playerattachment
Reply With Quote #4

works, but the sprite is displayed only for couple of seconds, how do i make it permanently? also, it has the black background and huge size =[

any parameters to fix these?

Last edited by Depresie; 10-20-2015 at 06:55.
Depresie is offline
Chihuahuax
Senior Member
Join Date: Oct 2014
Location: Malaysia
Old 10-20-2015 , 07:16   Re: [help] te_playerattachment
Reply With Quote #5

1)
Code:
write_coord(45)
decrease the size

2) You cant make the sprite to last permanently using this way... You might need to use entity_set_xxx stuff to "attach" it on a player
Chihuahuax is offline
Send a message via Skype™ to Chihuahuax
Depresie
Veteran Member
Join Date: Nov 2013
Old 10-20-2015 , 07:27   Re: [help] te_playerattachment
Reply With Quote #6

that is not the size but the position

about creating entities, the problem is that i want only the members of that group to see each other's sprite

fixed the size and the transparency problems using a full colored sprite with small size

but, now im trying to display the sprite above the head of all party memebers, but when i hit the command, it is displayed above every members head, but members can see only their own sprite above the head

Last edited by Depresie; 10-20-2015 at 07:55.
Depresie is offline
Chihuahuax
Senior Member
Join Date: Oct 2014
Location: Malaysia
Old 10-20-2015 , 08:13   Re: [help] te_playerattachment
Reply With Quote #7

Because youre only sending the message to each of the party members, not allowing them to see teamnates'
Chihuahuax is offline
Send a message via Skype™ to Chihuahuax
Depresie
Veteran Member
Join Date: Nov 2013
Old 10-20-2015 , 08:40   Re: [help] te_playerattachment
Reply With Quote #8

what should i do in the loop to fix that?

btw, if you do something like this, and the entity or the id leaves the game, wouldn't it result in a crash or error?
also if you set it twice for a player, like, if you make a set a task every one second to set the attachment, and the attachment is removed only after 2 seconds, what would happen?

PHP Code:
    message_begin(MSG_ONE_UNRELIABLESVC_TEMPENTITY_id)
    
write_byte(TE_PLAYERATTACHMENT)
    
write_byte(entity)
    
write_coord(45)
    
write_short(iSprite)
    
write_short(4000)
    
message_end() 

Last edited by Depresie; 10-20-2015 at 12:36.
Depresie 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 22:14.


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