Raised This Month: $51 Target: $400
 12% 

How to show a specific sprite for everyone?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
danonix
Senior Member
Join Date: Dec 2012
Old 02-05-2015 , 11:18   How to show a specific sprite for everyone?
Reply With Quote #1

Hello, I would like to add something like "GOAAAAL sprite" to soccerjam mod, while goal.

Is it right?
Code:
stock Create_TE_PLAYERATTACHMENT(id, entity, vOffset, iSprite, life)
{
	message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, _, id);
	write_byte(TE_PLAYERATTACHMENT);
	write_byte(entity);	   	
	write_coord(vOffset);	
	write_short(iSprite);		
	write_short(life);		  
	message_end();

}

Last edited by danonix; 02-05-2015 at 12:22.
danonix is offline
Old 02-05-2015, 12:25
HamletEagle
This message has been deleted by HamletEagle.
milutinke
AlliedModders Donor
Join Date: Jun 2012
Location: Serbia
Old 02-05-2015 , 12:42   Re: How to show a specific sprite for everyone?
Reply With Quote #2

I wrote this via my mobile phone.
It compiles on amxmodx.org/webcompiler.cgi
It should work
Now you can show sprite.
NOTE: Is uses engine

Here is code:
Code:
stock ShowSprite( const szEntityName[ ] , const szSprite[ ], Float: fOrigin[ 3 ], Float: fFrame ) {
	new iEntity = create_entity( "info_target" );
	
	entity_set_model( iEntity, szSprite );
	entity_set_string( iEntity, EV_SZ_classname, szEntityName );
	entity_set_int( iEntity, EV_INT_movetype, MOVETYPE_NOCLIP ); 
	entity_set_float( iEntity, EV_FL_gravity, 0.0001 );
	entity_set_int( iEntity, EV_INT_solid, SOLID_TRIGGER );
	entity_set_int( iEntity, EV_INT_rendermode, kRenderTransAdd );
	entity_set_float( iEntity, EV_FL_renderamt, 250.0 );
	entity_set_vector( iEntity, EV_VEC_origin, fOrigin );
	entity_set_float( iEntity, EV_FL_scale, 0.4 );
	entity_set_float( iEntity, EV_FL_framerate, 0.0 );
	entity_set_float( iEntity, EV_FL_frame, fFrame );
	
	return iEntity;
}
Edit: I have wrote this before you edited your post
I refreshed page later and saw your new code

Last edited by milutinke; 02-05-2015 at 12:48.
milutinke is offline
Send a message via Skype™ to milutinke
danonix
Senior Member
Join Date: Dec 2012
Old 02-05-2015 , 13:40   Re: How to show a specific sprite for everyone?
Reply With Quote #3

Thanks, what should I enter in parameter szEntityName?
danonix is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 02-05-2015 , 13:48   Re: How to show a specific sprite for everyone?
Reply With Quote #4

Quote:
Originally Posted by danonix View Post
Thanks, what should I enter in parameter szEntityName?
Whatever you want, this is the entity classname.
__________________
HamletEagle is offline
danonix
Senior Member
Join Date: Dec 2012
Old 02-05-2015 , 14:57   Re: How to show a specific sprite for everyone?
Reply With Quote #5

What I am doing wrong?

Nothing shows:
Code:
ShowSprite("goal", "sprites/gol_bramka.spr", netOrig2, 10);
danonix is offline
Bos93
Veteran Member
Join Date: Jul 2010
Old 02-05-2015 , 15:07   Re: How to show a specific sprite for everyone?
Reply With Quote #6

Float: fFrame
__________________
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
danonix
Senior Member
Join Date: Dec 2012
Old 02-05-2015 , 15:15   Re: How to show a specific sprite for everyone?
Reply With Quote #7

Well, still doesn't work.

I have got this code, it works, but I have got one question
How I can make it dissapear after X seconds? Remove_entity?
PHP Code:
   new Float:fOrigin[3]
   new 
ent create_entity("env_sprite")

   
IVecFVec(iOriginfOrigin)

   
entity_set_string(entEV_SZ_classname"gol")
   
entity_set_model(ent"sprites/gol_bramka.spr")
   
entity_set_int(entEV_INT_spawnflagsSF_SPRITE_STARTON)
   
entity_set_float(entEV_FL_framerate30.0)

   
DispatchSpawn(ent)

   
entity_set_origin(entfOrigin)
   
entity_set_size(entFloat:{-25.0, -25.0, -25.0}, Float:{2000.02000.02000.0})
   
entity_set_int(entEV_INT_solidSOLID_TRIGGER)
   
entity_set_int(entEV_INT_movetypeMOVETYPE_FLY)
   
entity_set_int(entEV_INT_rendermodekRenderTransAdd)
   
entity_set_float(entEV_FL_renderamt255.0)
   
entity_set_float(entEV_FL_scale1.0

Last edited by danonix; 02-05-2015 at 15:20.
danonix is offline
Freezo Begin
BANNED
Join Date: Mar 2014
Location: Morocco
Old 02-05-2015 , 15:41   Re: How to show a specific sprite for everyone?
Reply With Quote #8

Yes you have do a create_entity so you can remove it by remove_entity . you can just do it with a set_task you know ...
Freezo Begin is offline
milutinke
AlliedModders Donor
Join Date: Jun 2012
Location: Serbia
Old 02-05-2015 , 16:10   Re: How to show a specific sprite for everyone?
Reply With Quote #9

It is working, i have tested it.
Sprite link: https://www.dropbox.com/s/2062rqqq7z...ill_1.spr?dl=0
Resoult: http://i.imgur.com/WSoO3ga.png

Example code:
PHP Code:
#include < amxmodx >
#include < engine >

new const g_szSprite[ ] = "sprites/kill_1.spr";

public 
plugin_init( ) {
    
register_plugin"Show Sprite Test""1.0""Milutinke (ByM)" );
    
    
register_clcmd"say /spr""CreateSprite" );
}

public 
plugin_precache( )
    
precache_modelg_szSprite );

public 
CreateSpriteid ) {
    if( !
is_user_connectedid ) || !is_user_aliveid ) )
        return;
        
    static 
Floatg_fMyOrigin];
    
entity_get_vectoridEV_VEC_origing_fMyOrigin );
    
g_fMyOrigin] += 10;
    
    
ShowSprite"Example"g_szSpriteg_fMyOrigin2.0 );
}

stock ShowSprite( const szEntityName[ ] , const szSprite[ ], FloatfOrigin], FloatfFrame ) {
    new 
iEntity create_entity"info_target" );
    
    
entity_set_modeliEntityszSprite );
    
entity_set_stringiEntityEV_SZ_classnameszEntityName );
    
entity_set_intiEntityEV_INT_movetypeMOVETYPE_NOCLIP ); 
    
entity_set_floatiEntityEV_FL_gravity0.0001 );
    
entity_set_intiEntityEV_INT_solidSOLID_TRIGGER );
    
entity_set_intiEntityEV_INT_rendermodekRenderTransAdd );
    
entity_set_floatiEntityEV_FL_renderamt250.0 );
    
entity_set_vectoriEntityEV_VEC_originfOrigin );
    
entity_set_floatiEntityEV_FL_scale0.4 );
    
entity_set_floatiEntityEV_FL_framerate0.0 );
    
entity_set_floatiEntityEV_FL_framefFrame );
    
    return 
iEntity;


Last edited by milutinke; 02-05-2015 at 16:20.
milutinke is offline
Send a message via Skype™ to milutinke
danonix
Senior Member
Join Date: Dec 2012
Old 02-05-2015 , 16:24   Re: How to show a specific sprite for everyone?
Reply With Quote #10

Well, maybe I have done something wrong :p
Thanks for help anyway!
Have a nice day guys
danonix 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 16:20.


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