Raised This Month: $ Target: $400
 0% 

Create new entity and give him spr model, need help :)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
deadman909
Veteran Member
Join Date: Oct 2008
Old 05-14-2013 , 02:01   Re: Create new entity and give him spr model, need help :)
Reply With Quote #1

I know this thread is old but I was wondering if someone can help on why I get this error
Run time error 4: index out of bounds
For this line : entity_set_vector(ent, EV_VEC_rendercolor, colors[rand])

PHP Code:
new Float:colors[TOTALCOLORS][3] = {
    {
255.00.00.0},
    {
165.00.00.0},
    {
255.0100.0100.0},
    {
0.00.0255.0},
    {
0.00.0136.0},
    {
95.0200.0255.0},
    {
0.0150.0255.0},
    {
0.0255.00.0},
    {
180.0255.0175.0},
    {
0.0155.00.0},
    {
255.0255.0255.0},
    {
255.0255.00.0},
    {
189.0182.00.0},
    {
255.0255.0109.0},
    {
255.0150.00.0},
    {
255.0190.090.0},
    {
222.0110.00.0},
    {
243.0138.0255.0},
    {
255.00.0255.0},
    {
150.00.0150.0},
    {
100.00.0100.0},
    {
200.00.00.0},
    {
220.0220.00.0},
    {
192.0192.0192.0},
    {
190.0100.010.0},
    {
114.0114.0114.0},
    {
0.00.0150.0}

PHP Code:
new filename[32]
format(filename31"models/box%d.mdl"random_num(12))
                
if(
random_num(14) != 4)
{
    new 
rand random_num(1TOTALCOLORS)    
    
    
entity_set_int(entEV_INT_renderfxkRenderFxGlowShell)
    
entity_set_float(entEV_FL_renderamt1000.0)
    
entity_set_int(entEV_INT_rendermodekRenderTransAlpha)
    
entity_set_vector(entEV_VEC_rendercolorcolors[rand])

__________________

deadman909 is offline
Send a message via MSN to deadman909 Send a message via Yahoo to deadman909
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 05-14-2013 , 06:36   Re: Create new entity and give him spr model, need help :)
Reply With Quote #2

new rand = random_num(1, TOTALCOLORS) -1
jimaway is offline
deadman909
Veteran Member
Join Date: Oct 2008
Old 05-14-2013 , 10:55   Re: Create new entity and give him spr model, need help :)
Reply With Quote #3

Quote:
Originally Posted by jimaway View Post
new rand = random_num(1, TOTALCOLORS) -1
Alright thanks I will try that.

Also do you know why sometimes there is no color added.
__________________


Last edited by deadman909; 05-14-2013 at 12:29.
deadman909 is offline
Send a message via MSN to deadman909 Send a message via Yahoo to deadman909
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 23:35.


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