AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Spite Help (https://forums.alliedmods.net/showthread.php?t=22548)

cjwprostar 12-29-2005 22:04

Spite Help
 
I've read some of the posts here and seached the net, but I'm still confused on how to display a sprite.
I know you need something like this.. (just the needed functions are shown)
Code:
new sprite new userorigin[33] public plugin_precache(){    sprite=precache_model("sprites/whatever.spr")    return PLUGIN_CONTINUE } public displaysprite(id){    get_user_origin(id,userorigin[id],0)    message_begin(MSG_ALL,SVC_TEMPENTITY)    write_byte(?)    write_coord(userorigin[id])    write_coord(userorigin[id])    write_coord(userorigin[id])    write_short(sprite)    message_end() }

Thx in advance

v3x 12-30-2005 01:07

A sprite that's attached to a player, or a sprite that stays in one spot on the map?

cjwprostar 12-30-2005 02:38

Stays in one spot and disappears after n seconds.
Also is there a way to change the size of the sprite.

BetaX 12-30-2005 18:46

Code:
new sprite new userorigin[33] new time public plugin_precache(){    sprite=precache_model("sprites/whatever.spr")    return PLUGIN_CONTINUE } // You'll probably have to make a set_task somewhere for this thing... and where you put that down, slam down this:  time = get_systime(0) public displaysprite(id){    get_user_origin(id,userorigin[id],0)    if(time == time+n) { // Where n = your number...    message_begin(MSG_ALL,SVC_TEMPENTITY)    write_byte(17)    write_coord(userorigin[id])    write_coord(userorigin[id])    write_coord(userorigin[id])    write_short(0)    write_byte(YourScaleHere) // (in 0.1s!)    write_byte(brightnessofthesprite)    message_end()    } else {    message_begin(MSG_ALL,SVC_TEMPENTITY)    write_byte(17)    write_coord(userorigin[id])    write_coord(userorigin[id])    write_coord(userorigin[id])    write_short(whatever.spr)    write_byte(YourScaleHere)    write_byte(brightnessofthesprite)    message_end()    }     }

I also kinda doubt that you want it to make it userorigin[id].

I am pretty damn sure you want it to be userorigin[0] and then [1] and then [2] but... then again... I am the noob. :)

I didn't try this, so feel free to edit it. Consider it a rough draft :D

cjwprostar 12-30-2005 19:29

Ok thanks I'll try it out.
I'm new to the message thing, what do the write_type()s do?
And it should be userorigin[33][3]..sry bout that.

BetaX 12-31-2005 03:05

The write_* basically fills in what you want the SVC_TEMPENTITY to be.

There's a list somewhere around here if you're not sure what they are. For that, I'll list what each of the bytes/shorts do.


Code:
   write_byte(17) // What kind of tempentity it is, in this case a regular ol' sprite    write_coord(userorigin[id]) // X Coordinate    write_coord(userorigin[id]) // Y Coordinate    write_coord(userorigin[id]) // Z Coordinate    write_short(0) // The spr's name. Giving it 0 means it has none...    write_byte(YourScaleHere) // The scale of the sprite (in 0.1s)    write_byte(brightnessofthesprite) // And, well, the brightness of the sprite.

cjwprostar 12-31-2005 21:03

Thanks alot that helped.


All times are GMT -4. The time now is 16:00.

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