AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [help] te_playerattachment (https://forums.alliedmods.net/showthread.php?t=273504)

Depresie 10-20-2015 05:06

[help] te_playerattachment
 
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()
}


Arkshine 10-20-2015 06:09

Re: [help] te_playerattachment
 
You are supposed to pass the sprite index, not the string. Either value returned by precache_model or EngFunc_ModelIndex.

Chihuahuax 10-20-2015 06:12

Re: [help] te_playerattachment
 
PHP Code:

new iSprite

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



Depresie 10-20-2015 06:50

Re: [help] te_playerattachment
 
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?

Chihuahuax 10-20-2015 07:16

Re: [help] te_playerattachment
 
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

Depresie 10-20-2015 07:27

Re: [help] te_playerattachment
 
that is not the size :P but the position

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

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

Chihuahuax 10-20-2015 08:13

Re: [help] te_playerattachment
 
Because youre only sending the message to each of the party members, not allowing them to see teamnates'

Depresie 10-20-2015 08:40

Re: [help] te_playerattachment
 
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() 



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

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