AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help With Sprites And Origin stuff! (https://forums.alliedmods.net/showthread.php?t=22305)

Rixorster 12-23-2005 11:02

Help With Sprites And Origin stuff!
 
Well, when i use this code:
Code:
public ssjtrans1(){     client_cmd(0, "spk goku/scream2.wav");     new iOrigini[3];       get_user_origin(0, iOrigini, 0);       for(new i = 0; i < 6; i++){                   message_begin( MSG_BROADCAST, SVC_TEMPENTITY, iOrigini );                   write_byte ( TE_SPRITETRAIL );                   write_coord( iOrigini[0] );                   write_coord( iOrigini[1] );                   write_coord( iOrigini[2] );                   write_coord( iOrigini[0] );                   write_coord( iOrigini[1] );                   write_coord( iOrigini[2] );                   write_short( trans1 );                   write_byte ( 5 );                   write_byte ( 10 );                   write_byte ( 5 );                   write_byte ( 10 );                   write_byte ( 40 );                   message_end();     }       return PLUGIN_HANDLED }
With set_task:
Code:
    set_task(6.0, "ssjtrans1")
, it plays the sound, but when it comes to the part where the sprite is supposed to appear, the console says:
Code:

L 12/22/2005 - 17:43:09: Invalid player id 0
L 12/22/2005 - 17:43:09: [AMXX] Displaying debug trace (plugin "ssjsecret.amxx")
L 12/22/2005 - 17:43:09: [AMXX] Run time error 10: native error (native "get_user_origin")
L 12/22/2005 - 17:43:09: [AMXX]    [0] ssjsecret.sma::ssjtrans1 (line

And, when it runs the function, which runs set_task:
Code:
public ssj5_glow (id) {     new powerlevel = get_pdata_int(id,460);     if ( powerlevel < 2000000 )     {     client_cmd(0, "spk goku/trans2.wav")     entity_set_int(id,EV_INT_sequence,105)     set_task(6.0, "ssjtrans1")     set_pdata_int(id, 460,20000000 )     }     else     {     client_print(id, print_chat, " You are not allowed to be SSJ to do this. ")     }     new iOrigin[3];       get_user_origin(id, iOrigin, 0);       for(new i = 0; i < 6; i++){                   message_begin( MSG_BROADCAST, SVC_TEMPENTITY, iOrigin );                   write_byte ( TE_SPRITETRAIL );                   write_coord( iOrigin[0] );                   write_coord( iOrigin[1] );                   write_coord( iOrigin[2] - 1 );                   write_coord( iOrigin[0] );                   write_coord( iOrigin[1] );                   write_coord( iOrigin[2] + 1 );                   write_short( ascending );                   write_byte ( 5 );                   write_byte ( 10 );                   write_byte ( 5 );                   write_byte ( 10 );                   write_byte ( 40 );                   message_end();     }     return PLUGIN_HANDLED }
This:
Code:
    entity_set_int(id,EV_INT_sequence,105)
It wont work, it wont run the animation :/ And, when it spawns the sprite, it spawns many of them, and its supposed to spawn only one, and keep it at the same place where player is, even if player is in air :) And, also, i need to know how to make the player stay still? And, when i changed the:
Code:
    get_user_origin(0, iOrigini, 0);
to:
Code:
    get_user_origin(id, iOrigini, 0);
it said symbol id not found. :/ Please help asap :)

watch 12-23-2005 12:06

im a little confused by what your exactly trying to do but

the reason your spawning lots of sprites is beacause you have this
Code:
for(new i = 0; i < 6; i++){

and you cant use 0 in get_user_origin, you want to use id

when you added id to get_user_origin it said id isnt found because youve got

Code:
 public ssjtrans1(){
change to
Code:
 public ssjtrans1(id){

also change

Code:
set_task(6.0, "ssjtrans1")
to
Code:
  set_task(6.0, "ssjtrans1",id)

Rixorster 12-23-2005 12:29

Thanks man for that, BUT still:
#1:I need to know why it wont play this animation sequence:
Code:

entity_set_int(id,EV_INT_sequence,105)
#2:I need to know also, how can i make the sprite stay at the same place where the player is :) And so, that when the function ssj5_glow starts, it stops the player from moving, and make so that when the set_task function ssjtrans1 runs, the player can move again. :)

Edit:Can someone help?! :(

Rixorster 12-24-2005 04:12

Well, i got the code a little bit better, but i still cant figure out how to make only 1 sprite and make it stay at the same place where player is! :S Can someone help?
(I even asked help at #amxmodx @ Quakenet, but no one wont answer...)

watch 12-24-2005 05:49

aha your trying to make the sprite stay above the player, heres some example code from my speedrun plugin, i made it so a little clock with the hand that moves round appears abover their heads :)
Code:
new SpeedSprite //global << public plugin_precache()     SpeedSprite = precache_model("sprites/fm/speedrunclock.spr") // then to attach the sprite to a player message_begin(MSG_ALL,SVC_TEMPENTITY) write_byte(124) write_byte(id) // attach to player write_coord(65) // offset on the Z axis write_short(SpeedSprite) //sprite write_short(32767) // time, i believe this is the max time you can use message_end() // and if you want to remove it message_begin(MSG_ALL,SVC_TEMPENTITY) write_byte(125) write_byte(id) message_end()

with this you cant render sprites additivly aka the black bits will show. If you want to create transparency you have to create a sprite and render it alphatest, where the last colour in the pallete is the transparency colour. usually pure blue :)


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

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