Raised This Month: $ Target: $400
 0% 

Change sprite when function is called?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
LynX
Veteran Member
Join Date: Oct 2004
Old 03-12-2005 , 17:16   Change sprite when function is called?
Reply With Quote #1

Mine idea is basically when I call some function I make ( let's say noclip ) - is it possible to change its sprite to another one, but only when one function is called?
So I turn noclip on and one sprite changes to another while noclip is on. And if noclip is off, the sprite changes back to normal. I know its possible, I saw it somewhere on one server...
__________________
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
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 03-12-2005 , 18:14  
Reply With Quote #2

Yes, it is possible. Are you confusing sprite with model? Do you want to change the player's model while they are noclipped? Where and how do you want the sprite to be displayed?
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
LynX
Veteran Member
Join Date: Oct 2004
Old 03-13-2005 , 02:37  
Reply With Quote #3

Nope, I know sprite is not player model, I'm not that much n00b
For mod I'm making plugin, it has charging attacks, and different sprite for every attack thats charging.
Mine idea is to replace that sprite by code if I use some action performed on me. So, if charging sprite is, let's say - charge.spr - I would like to change it via code to charge2.spr which is mine sprite and will work only if that function is happening right now. If function is not happening, or stoped, that sprite is returned to normal one.
__________________
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
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 03-13-2005 , 13:58  
Reply With Quote #4

You would have to find what entity they use to display the charge up sprite, and then find that entity and change whatever keyvalue it is that determines what sprite it displays.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
LynX
Veteran Member
Join Date: Oct 2004
Old 03-13-2005 , 14:28  
Reply With Quote #5

But that sprite is attached to player, not an entity, so I guess no entity finding is necesary? Or if it is, code snippet please... Coz I can't pretty much find it out myself...
__________________
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
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 03-13-2005 , 14:36  
Reply With Quote #6

ok u can do it this way

Code:
public changeClip(id) {      new clip = get_user_noclip(id) // Dont noe if this exists      //If it doesnt your next choice is to check his flags see if he has clip or not      if ( clip == 1) // user has noclip      {           set_user_noclip(id,0);           //Change user attached sprite back to normal here      }      else if ( clip == 0 )      {           set_user_noclip(id,1);           //Change user attached sprite to charging      }      return PLUGIN_HANDLED; }

This way all you do is call changeClip(id) and it will automaticly figure out whether to give them clip or to take it away

[EDIT]
This isnt a very best way to do it if ur changing sprite alot. To do it better its best to built another change sprite function where u would specify id and what sprite so u dont have to keep changing sprite in all ur charging functions
Freecode is offline
LynX
Veteran Member
Join Date: Oct 2004
Old 03-13-2005 , 15:00  
Reply With Quote #7

Noclip was just example - but the problem is how to actually find out whos using that sprite and then change it? Is something like this possible:
Code:
new sprite[33][33] public checksprite(id) { get_user_info(id,"spritenamehere",sprite[32]) return PLUGIN_HANDLED }

But yet if this above is true, then the main question is - how to replace that sprite?
__________________
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
TotalNoobScripter
Senior Member
Join Date: Aug 2004
Old 03-13-2005 , 19:26  
Reply With Quote #8

are u sure the playermodel itself doesnt have the 'sprite' built in? I have a player model that shoots lightning bolts, but the 'charging' effect is actualy built into the model. A plugin i have actually 'shoots' lightning.
TotalNoobScripter is offline
Send a message via AIM to TotalNoobScripter
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 03-13-2005 , 21:56  
Reply With Quote #9

Lynx ur confusing me and urself.
First of tell me how your setting the sprite? Player attachment or as an entity?
In both ways you can just make a bool to identify that the player either has or doesnt have the sprite.
Code:
new bool:hasCharge[32] = false; ...... public changeClip(id) {      new clip = get_user_noclip(id) // Dont noe if this exists      //If it doesnt your next choice is to check his flags see if he has clip or not      if ( clip == 1 && hasCharge[id]) // user has noclip      {           set_user_noclip(id,0);           //Change user attached sprite back to normal here           hasCharge[id] = false; // This user doesnt have charge sprite      }      else if ( clip == 0 && !hasCharge[id])      {           set_user_noclip(id,1);           //Change user attached sprite to charging           hasCharge[id] = true; // This user has charge sprite      }      return PLUGIN_HANDLED; }
Freecode is offline
LynX
Veteran Member
Join Date: Oct 2004
Old 03-14-2005 , 03:18  
Reply With Quote #10

Okay, this way - that sprite is a player attachment which follows his right hand and is attached to player as long as I'm holding Mouse1 to charge ( that's an weapon ). I need the code snippet which will replace any sprite under name, let's say, "bigbanga.spr", and replace it with "bigbang2.spr". Only on one player. For others it should remain unchanged. You get me 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
Reply


Thread Tools
Display Modes

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:03.


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