Raised This Month: $ Target: $400
 0% 

Use custom Sprite there when precached


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Stephen
Senior Member
Join Date: Aug 2004
Old 03-06-2006 , 08:13   Use custom Sprite there when precached
Reply With Quote #1

Code:
#include <amxmodx> #include <engine> #include <fakemeta> #include <amxmisc> #include <string> #include <fun> #define TE_FIREFIELD 123 public plugin_init() {     register_plugin("stuff","Beta","Stephen")     register_clcmd(".fx.fxFireField","fieldfire",ADMIN_ALL,"[radius], [sprite], [count], [flags], [duration]")     return PLUGIN_CONTINUE; } new smoke public fieldfire(id, level, cid, radius, count, flags, duration) {     if(!cmd_access(id,level,cid,5))             return PLUGIN_HANDLED     new user[33], space[1], many[1], dothat[1], life[1]     read_argv(0, user, 32)     read_argv(1, space, 33)//RADIUS     new radius = str_to_num(space)     read_argv(2, many, 33)//count     new count = str_to_num(many)     read_argv(3, dothat, 33)//flags     new flags = str_to_num(dothat)     read_argv(4, life, 33)//flags     new duration = str_to_num(life)     new spriteorigin[3]         get_user_origin(id, spriteorigin);         message_begin(MSG_BROADCAST,SVC_TEMPENTITY, spriteorigin);         write_byte( TE_FIREFIELD );         write_coord( spriteorigin[0] ); //coord coord coord (position)     write_coord( spriteorigin[1] );     write_coord( spriteorigin[2] );     write_short( radius ); //Radius     write_short( smoke );         write_byte( count ); // count     write_byte( flags ); //flags     write_byte( duration ); // duration in sec.         message_end();         return PLUGIN_HANDLED } //Precaching Sprites //================================== public plugin_precache() {     smoke = precache_model("sprites/smoke.spr");         return PLUGIN_HANDLED }

How can i make it that when i type in the console
.fx.fxFireField 100 "sprites"<--- 5 2 100 : that i can choose an other sprite instead of recompiling it with an other sprite ?
cause all the other stuff works but im binded to that 1 one sprite. >_>
So HOW is that possible ?
Stephen is offline
Charr
Senior Member
Join Date: Jul 2005
Location: Long Island, New York, U
Old 03-06-2006 , 08:32  
Reply With Quote #2

You could try precaching several sprites, and use an if() system when showing the sprite.
__________________
Charr is offline
Send a message via AIM to Charr Send a message via MSN to Charr
Stephen
Senior Member
Join Date: Aug 2004
Old 03-06-2006 , 08:39  
Reply With Quote #3

Can you show me an snippet of how it would be putted in the plugin where i have now ?
Stephen is offline
Stephen
Senior Member
Join Date: Aug 2004
Old 03-06-2006 , 09:43  
Reply With Quote #4

What i would like to have is this.
Code:
.fx.fxFireField radius "spritepath/sprite" count flags duration
Like that i want it to be enterable in the console
Stephen is offline
Charr
Senior Member
Join Date: Jul 2005
Location: Long Island, New York, U
Old 03-06-2006 , 15:18  
Reply With Quote #5

When a sprite is precached, the returned value is pointer (location in memory) so using a string in the message probably won't work. Instead you can use this:

Code:
#include <amxmodx> #include <engine> #include <fakemeta> #include <amxmisc> #include <string> #include <fun> #define TE_FIREFIELD 123 new gSpr[3],smoke; public plugin_init() {     register_plugin("stuff","Beta","Stephen")     register_clcmd(".fx.fxFireField","fieldfire",ADMIN_ALL,"[radius], [sprite], [count], [flags], [duration]")     return PLUGIN_CONTINUE; } public fieldfire(id, level, cid) {     if(!cmd_access(id,level,cid,5))             return PLUGIN_HANDLED     new sprite[33],space[32], many[32], dothat[32], life[32]     read_argv(1, space, 33)//RADIUS     new radius = str_to_num(space)     read_argv(2,sprite,31);     read_argv(3, many, 33)//count     new count = str_to_num(many)     read_argv(4, dothat, 33)//flags     new flags = str_to_num(dothat)     read_argv(5, life, 33)//flags     new duration = str_to_num(life)     new spriteorigin[3]     get_user_origin(id, spriteorigin);     message_begin(MSG_BROADCAST,SVC_TEMPENTITY, spriteorigin);     write_byte( TE_FIREFIELD );     write_coord( spriteorigin[0] ); //coord coord coord (position)     write_coord( spriteorigin[1] );     write_coord( spriteorigin[2] );     write_short( radius ); //Radius     if(equali(sprite,"smoke"))     {         write_short( smoke );     }     else if(equali(sprite,"1"))     {         write_short(gSpr[0]);     }     else if(equali(sprite,"2"))     {         write_short(gSpr[1]);     }     else if(equali(sprite,"3"))     {         write_short(gSpr[2]);     }     else     {         write_short(smoke);     }     write_byte( count ); // count     write_byte( flags ); //flags     write_byte( duration ); // duration in sec.     message_end();     return PLUGIN_HANDLED } //Precaching Sprites //================================== public plugin_precache() {     smoke = precache_model("sprites/smoke.spr");     spr[0] = precache_sprite("sprites/1.spr");     spr[1] = precache_sprite("sprites/2.spr");     spr[2] = precache_sprite("sprites/3.spr");         return PLUGIN_HANDLED }
__________________
Charr is offline
Send a message via AIM to Charr Send a message via MSN to Charr
Stephen
Senior Member
Join Date: Aug 2004
Old 03-06-2006 , 16:08  
Reply With Quote #6

It didnt compile.

Got 4 Errors.
Stephen is offline
Charr
Senior Member
Join Date: Jul 2005
Location: Long Island, New York, U
Old 03-07-2006 , 14:27  
Reply With Quote #7

Stupid mistakes, my bad:
Code:
#include <amxmodx> #include <engine> #include <fakemeta> #include <amxmisc> #include <string> #include <fun> #define TE_FIREFIELD 123 new gSpr[3],smoke; public plugin_init() {     register_plugin("stuff","Beta","Stephen")     register_clcmd(".fx.fxFireField","fieldfire",ADMIN_ALL,"[radius], [sprite], [count], [flags], [duration]")     return PLUGIN_CONTINUE; } public fieldfire(id, level, cid) {     if(!cmd_access(id,level,cid,5))             return PLUGIN_HANDLED     new sprite[33],space[32], many[32], dothat[32], life[32]     read_argv(1, space, 33)//RADIUS     new radius = str_to_num(space)     read_argv(2,sprite,31);     read_argv(3, many, 33)//count     new count = str_to_num(many)     read_argv(4, dothat, 33)//flags     new flags = str_to_num(dothat)     read_argv(5, life, 33)//flags     new duration = str_to_num(life)     new spriteorigin[3]     get_user_origin(id, spriteorigin);     message_begin(MSG_BROADCAST,SVC_TEMPENTITY, spriteorigin);     write_byte( TE_FIREFIELD );     write_coord( spriteorigin[0] ); //coord coord coord (position)     write_coord( spriteorigin[1] );     write_coord( spriteorigin[2] );     write_short( radius ); //Radius     if(equali(sprite,"smoke"))     {         write_short( smoke );     }     else if(equali(sprite,"1"))     {         write_short(gSpr[0]);     }     else if(equali(sprite,"2"))     {         write_short(gSpr[1]);     }     else if(equali(sprite,"3"))     {         write_short(gSpr[2]);     }     else     {         write_short(smoke);     }     write_byte( count ); // count     write_byte( flags ); //flags     write_byte( duration ); // duration in sec.     message_end();     return PLUGIN_HANDLED } //Precaching Sprites //================================== public plugin_precache() {     smoke = precache_model("sprites/smoke.spr");     gSpr[0] = precache_model("sprites/1.spr");     gSpr[1] = precache_model("sprites/2.spr");     gSpr[2] = precache_model("sprites/3.spr");         return PLUGIN_HANDLED }
__________________
Charr is offline
Send a message via AIM to Charr Send a message via MSN to Charr
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 20:21.


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