AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Need help with sprite plugin for TS (https://forums.alliedmods.net/showthread.php?t=12247)

sephiroth_nightmare 04-09-2005 16:57

Need help with sprite plugin for TS
 
Hi, am new to AMX coding, and i need some help with my plugin, i have been working on it all day, and i need to to bring a sprite onto the screen (covering the player) once the player tyeps the command in the console, now my problem is that when i get in game, i type the command in the console and it gives me an error

Code:

L 04/09/2005 - 21:55:39: [AMXX] Native error in "precache_model" on line 20 (file "ssjtransform.sma")
and am not sure how to fix it, here is my plugin code

Code:
#include <amxmodx> #include <fun> new PLUGIN[]="ssjtransform" new AUTHOR[]="PvtHudson" new VERSION[]="1.00"  public plugin_init() {     register_clcmd("amx_ssjtrans","spawn_sprite")     register_plugin(PLUGIN, VERSION, AUTHOR)        return PLUGIN_CONTINUE } new theSprite;  public spawn_sprite(id){    theSprite = precache_model("sprites/trans.spr"); }  public myfunction(id) {         new spriteorigin[3];    get_user_origin(id,spriteorigin);        message_begin(MSG_BROADCAST,SVC_TEMPENTITY);    write_byte(17);    write_coord(spriteorigin[0]);      write_coord(spriteorigin[1]);    write_coord(spriteorigin[2]);    write_short(theSprite);      write_byte(20);        write_byte(200);      message_end(); } public plugin_precache() {         return PLUGIN_CONTINUE }

now im going to guess theres alot wrong with my code, i have been looking in this forum for about 2 hours for help and snippets that might help me with my code.

can any one correct my code for me?

thanks
Pvthudson/Sephiroth_nightmare

XxAvalanchexX 04-09-2005 22:06

Change public spawn_sprite to public plugin_precache, and public myfunction to public spawn_sprite

sephiroth_nightmare 04-10-2005 05:41

thanks for your help :)

but now that i have replaced them i get 2 errors during compile.

here is the code now

Code:
#include <amxmodx> #include <fun> new PLUGIN[]="ssjtransform" new AUTHOR[]="PvtHudson" new VERSION[]="1.00" public plugin_init() {        register_clcmd("amx_ssjtrans","spawn_sprite")     register_plugin(PLUGIN, VERSION, AUTHOR)        return PLUGIN_CONTINUE } new theSprite; public plugin_precache(id){    theSprite = precache_model("sprites/trans.spr"); } public spawn_sprite(id){              new spriteorigin[3];    get_user_origin(id,spriteorigin);          message_begin(MSG_BROADCAST,SVC_TEMPENTITY);    write_byte(17);    write_coord(spriteorigin[0]);      write_coord(spriteorigin[1]);    write_coord(spriteorigin[2]);    write_short(theSprite);      write_byte(20);        write_byte(200);      message_end(); } public plugin_precache() {           return PLUGIN_CONTINUE }

the errors i get are these

Code:

symbol already defined "plugin_precache"
and

Code:

function header differs from prototype
is there a way to fix these error?

thanks

v3x 04-10-2005 05:44

Remove
Code:
public plugin_precache() {           return PLUGIN_CONTINUE }

And replace plugin_precache(id) with plugin_precache().

sephiroth_nightmare 04-10-2005 06:55

thanks :D it works now.

thanks for all your help.

i have one more question tho

remeber in team fortress when you saw a concussion granade explode and it had that like push out effect?

how would i be able to make that effect play once my sprite has finished playing.

so it would be like

sprite starts playing
sprite finishs playing
push out effect start


i hope you understand what i mean :)

thanks

*edit*

i also want the player to be frozen whilst this stuff is happening, and once its over the player can move again.
Also how can i get a sound to play when the sprite starts, and make it stop when the sprite stops?

thanks

sephiroth_nightmare 04-11-2005 11:21

*bump*

cany anyone help me with my above post? :) any help will be greatful

thanks

XxAvalanchexX 04-11-2005 16:51

Push out effect? Is it like a shockwave?

Anpheus 04-12-2005 08:13

To do that, you need Fun With Vectors!

Still want to?

sephiroth_nightmare 04-12-2005 10:14

Quote:

Originally Posted by XxAvalanchexX
Push out effect? Is it like a shockwave?

yea like a shockwave effect :D

XxAvalanchexX 04-12-2005 15:33

Code:
 #define TE_BEAMCYLINDER 21 // cylinder that expands to max radius over lifetime  // coord coord coord (center position)  // coord coord coord (axis and radius)  // short (sprite index)  // byte (starting frame)  // byte (frame rate in 0.1's)  // byte (life in 0.1's)  // byte (line width in 0.1's)  // byte (noise amplitude in 0.01's)  // byte,byte,byte (color)  // byte (brightness)  // byte (scroll speed in 0.1's)  new shockwave_sprite; public plugin_precache() {    shockwave_sprite = precache_model("sprites/shockwave.spr"); } public function(id) {    new origin[3];    get_user_origin(id,origin);    // beams of light!    message_begin(MSG_PAS,SVC_TEMPENTITY,origin);    write_byte(TE_BEAMCYLINDER);    write_coord(origin[0]); // start X    write_coord(origin[1]); // start Y    write_coord(origin[2] - 16); // start Z    write_coord(origin[0]); // something X    write_coord(origin[1]); // something Y    write_coord(origin[2] - 16 + 50); // something Z    write_short(shockwave_sprite); // sprite    write_byte(0); // startframe    write_byte(0); // framerate    write_byte(10); // life    write_byte(60); // width    write_byte(0); // noise    write_byte(255); // red    write_byte(255); // green    write_byte(255); // blue    write_byte(255); // brightness    write_byte(0); // speed    message_end(); }


All times are GMT -4. The time now is 09:53.

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