Raised This Month: $ Target: $400
 0% 

random sprite


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 09-28-2009 , 10:48   random sprite
Reply With Quote #1

i want to use random sprites but dontknow how.

PHP Code:
#define NUM_SPRITES        12
new gl_sprite_name[NUM_SPRITES][] = {
    
"sprites/laserbeam.spr",
    
"sprites/blueflare1.spr",
    
"sprites/dot.spr",
    
"sprites/flare5.spr",
    
"sprites/flare6.spr",
    
"sprites/plasma.spr",
    
"sprites/smoke.spr",
    
"sprites/xbeam5.spr",
    
"sprites/xenobeam.spr",
    
"sprites/xssmke1.spr",
    
"sprites/zbeam3.spr",
    
"sprites/zbeam2.spr"
}


write_shortRANDOM SPRITES );           // HERE 
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 09-28-2009 , 10:50   Re: random sprite
Reply With Quote #2

Code:
write_short(random(NUM_SPRITES));
__________________
hleV is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 09-28-2009 , 10:56   Re: random sprite
Reply With Quote #3

not working
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Old 09-28-2009, 11:02
Sylwester
This message has been deleted by Sylwester. Reason: wrong idea...
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 09-28-2009 , 11:04   Re: random sprite
Reply With Quote #4

code removed


maybe is this better to find whats the problem
__________________

Last edited by One; 09-28-2009 at 12:16.
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 09-28-2009 , 11:08   Re: random sprite
Reply With Quote #5

try:
PHP Code:
#define NUM_SPRITES        12
new gl_sprite_name[NUM_SPRITES][] = {
    
"sprites/laserbeam.spr",
    
"sprites/blueflare1.spr",
    
"sprites/dot.spr",
    
"sprites/flare5.spr",
    
"sprites/flare6.spr",
    
"sprites/plasma.spr",
    
"sprites/smoke.spr",
    
"sprites/xbeam5.spr",
    
"sprites/xenobeam.spr",
    
"sprites/xssmke1.spr",
    
"sprites/zbeam3.spr",
    
"sprites/zbeam2.spr"
}
new 
g_sprite_ids[NUM_SPRITES]

public 
plugin_precache(){
    for(new 
i=0i<NUM_SPRITESi++)
        
g_sprite_ids[i] = precache_model(gl_sprite_name[i])
}

write_short(g_sprite_idsrandom(NUM_SPRITES) ]); 
__________________
Impossible is Nothing
Sylwester is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 09-28-2009 , 11:09   Re: random sprite
Reply With Quote #6

It must look like this ->
PHP Code:
#define NUM_SPRITES 12

new g_szSprites[NUM_SPRITES][] = {
    
    
"sprites/laserbeam.spr",
    
"sprites/blueflare1.spr",
    
"sprites/dot.spr",
    
"sprites/flare5.spr",
    
"sprites/flare6.spr",
    
"sprites/plasma.spr",
    
"sprites/smoke.spr",
    
"sprites/xbeam5.spr",
    
"sprites/xenobeam.spr",
    
"sprites/xssmke1.spr",
    
"sprites/zbeam3.spr",
    
"sprites/zbeam2.spr"
};
new 
g_iSprPointer[NUM_SPRITES];

public 
plugin_precache()
{
    for(new 
NUM_SPRITES i++)
    {
        
g_iSprPointer[i] = precache_model(g_szSprites[i]);
    }
}

write_short(g_iSprPointer[random(NUM_SPRITES)]); 
EDIT: -.- too slow.
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 09-28-2009 , 12:12   Re: random sprite
Reply With Quote #7

ty. it works. this is awesome now
Attached Thumbnails
Click image for larger version

Name:	1.jpg
Views:	445
Size:	100.4 KB
ID:	50675  
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 09-28-2009 , 14:33   Re: random sprite
Reply With Quote #8

lol, pink color -.-
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 09-28-2009 , 14:45   Re: random sprite
Reply With Quote #9

female server hello kitty
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 09-28-2009 , 15:13   Re: random sprite
Reply With Quote #10

Quote:
Originally Posted by One View Post
female server hello kitty
Doesn't have to be female for hello kitty.
Before I started playing in CS leagues, I had a hello kitty for my backpack
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
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 22:43.


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