Raised This Month: $ Target: $400
 0% 

Spawn sprite problem - code inside, needs fix


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
LynX
Veteran Member
Join Date: Oct 2004
Old 03-11-2005 , 11:15   Spawn sprite problem - code inside, needs fix
Reply With Quote #1

Ok, I wrote this small plugin to try to spawn sprite. Could you guys be so kind and polish it up so sprite shows on players position - sprite should totally hide player, so other players don't see that player whos using sprite until sprite vanishes. the code:
Code:
public plugin_init(id) {     register_plugin("Test","unknown","LynX")     register_clcmd("test","spawn_sprite")     return PLUGIN_CONTINUE } new sprite public spawn_sprite(id) {     new origin[3]     message_begin(MSG_ALL,SVC_TEMPENTITY)     write_entity(id)     write_coord(origin[0]) // x coordinate     write_coord(origin[1]) // y coordinate     write_coord(origin[2]) // z coordinate     write_short( sprite )  // sprite name     write_short( 6.0 )     // sprite life     message_end()     return PLUGIN_HANDLED } public plugin_precache() {     sprite = precache_model("sprites/testsprite.spr")     return PLUGIN_CONTINUE }
__________________
Current plugin : SoulPunisher anti-cheat
Percentage done : {||--------} 20%

If you think v3x is a PIMP, paste this into your sig!

If you think Bailopan is DA BOMB, paste this into your sig
LynX is offline
Send a message via ICQ to LynX
Knare
Member
Join Date: Oct 2004
Location: New York, USA
Old 03-11-2005 , 12:15  
Reply With Quote #2

umm gotta go but got
Code:
#include <amxmodx> //don't to include the include files or the compiler doesnt recognize any of the code #include <engine> // for origins, co-ods, etc. public plugin_init() {     register_plugin("Test","unknown","LynX")     register_clcmd("test","spawn_sprite")     return PLUGIN_CONTINUE } new sprite public spawn_sprite(id) {    new name[32],origin[3]    get_user_origin(id,name,31)    write_entity(id)    write_coord(origin[0]) // x coordinate    write_coord(origin[1]) // y coordinate    write_coord(origin[2]) // z coordinate    write_short(sprite)  // sprite name    message_end()    return PLUGIN_HANDLED } public plugin_precache() {    sprite = precache_model("sprites/testsprite.spr")    return PLUGIN_CONTINUE }

my teacher is gonna kill me (1 error, line 20)
__________________
0110101100111011100110000101110010011001
Knare is offline
Send a message via AIM to Knare Send a message via MSN to Knare
LynX
Veteran Member
Join Date: Oct 2004
Old 03-11-2005 , 12:19  
Reply With Quote #3

Ok, thanks!

[edit] - I was in hurry, so I didn't posted include files in, but it compiled, and didn't showed sprite - I'm gonna test your thing now...

[edit2] - doesn't compiles, array size problem on get_user_origin line...
__________________
Current plugin : SoulPunisher anti-cheat
Percentage done : {||--------} 20%

If you think v3x is a PIMP, paste this into your sig!

If you think Bailopan is DA BOMB, paste this into your sig
LynX is offline
Send a message via ICQ to LynX
knekter
Senior Member
Join Date: Mar 2004
Location: PA
Old 03-11-2005 , 12:32   ouch
Reply With Quote #4

Code:
new origin[3] get_user_origin(id, origin, 0) // id, array origin, 0 means current origin



Code:
/* Gets origin from player.
* Modes:
* 0 - current position.
* 1 - position from eyes (weapon aiming).
* 2 - end position from player position.
* 3 - end position from eyes (hit point for weapon). 
* 4 - position of last bullet hit (only CS). */
native get_user_origin(index, origin[3], mode = 0);
__________________
More updates for Matrix Mod!
knekter is offline
Send a message via AIM to knekter Send a message via MSN to knekter
LynX
Veteran Member
Join Date: Oct 2004
Old 03-11-2005 , 14:25  
Reply With Quote #5

Okay, I'll try... But how to make sprite lasts only for number of seconds I defined, or how do I remove it once its spawned?
__________________
Current plugin : SoulPunisher anti-cheat
Percentage done : {||--------} 20%

If you think v3x is a PIMP, paste this into your sig!

If you think Bailopan is DA BOMB, paste this into your sig
LynX is offline
Send a message via ICQ to LynX
LynX
Veteran Member
Join Date: Oct 2004
Old 03-11-2005 , 14:39  
Reply With Quote #6

Now I have this:
Code:
#include <amxmodx> #include <engine> public plugin_init(id) {     register_plugin("Test","unknown","LynX")     register_clcmd("test","spawn_sprite")     return PLUGIN_CONTINUE } new sprite public spawn_sprite(id) {     new origin[3]     get_user_origin(id, origin, 0) // id, array origin, 0 means current origin     message_begin(MSG_ALL,SVC_TEMPENTITY)     write_entity(id)     write_coord(origin[0]) // x coordinate     write_coord(origin[1]) // y coordinate     write_coord(origin[2]) // z coordinate     write_short( sprite )  // sprite name     write_short( 6.0 )     // sprite life     message_end()     return PLUGIN_HANDLED } public plugin_precache() {     sprite = precache_model("sprites/testsprite.spr")     return PLUGIN_CONTINUE }

When I compile it, its fine.
But when I try to use it ingame ( I have adecquate sprite for plugin ), it crashes with this message:
Quote:
PF_WriteEntity_I called with no active message
Please, help me
__________________
Current plugin : SoulPunisher anti-cheat
Percentage done : {||--------} 20%

If you think v3x is a PIMP, paste this into your sig!

If you think Bailopan is DA BOMB, paste this into your sig
LynX is offline
Send a message via ICQ to LynX
Knare
Member
Join Date: Oct 2004
Location: New York, USA
Old 03-11-2005 , 14:39  
Reply With Quote #7

My code was, well, rushed because I was coding in a very annoying computer class where we were learning how to use MS Excel
__________________
0110101100111011100110000101110010011001
Knare is offline
Send a message via AIM to Knare Send a message via MSN to Knare
knekter
Senior Member
Join Date: Mar 2004
Location: PA
Old 03-11-2005 , 15:50   I see the problem
Reply With Quote #8

You never defined what message your using, try this:

Code:
message_begin(MSG_ALL,SVC_TEMPENTITY) write_byte(124) // TE_PLAYERATTACHMENT write_entity(id) write_coord(origin[0]) // x coordinate write_coord(origin[1]) // y coordinate write_coord(origin[2]) // z coordinate write_short( sprite ) // sprite name write_short( 6.0 ) // sprite life message_end()
__________________
More updates for Matrix Mod!
knekter is offline
Send a message via AIM to knekter Send a message via MSN to knekter
LynX
Veteran Member
Join Date: Oct 2004
Old 03-11-2005 , 16:00  
Reply With Quote #9

I'm going to try it now...
__________________
Current plugin : SoulPunisher anti-cheat
Percentage done : {||--------} 20%

If you think v3x is a PIMP, paste this into your sig!

If you think Bailopan is DA BOMB, paste this into your sig
LynX is offline
Send a message via ICQ to LynX
LynX
Veteran Member
Join Date: Oct 2004
Old 03-11-2005 , 16:07  
Reply With Quote #10

Now quits to main menu without any message... I'm ok, now desperate
__________________
Current plugin : SoulPunisher anti-cheat
Percentage done : {||--------} 20%

If you think v3x is a PIMP, paste this into your sig!

If you think Bailopan is DA BOMB, paste this into your sig
LynX is offline
Send a message via ICQ to LynX
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 14:13.


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