Raised This Month: $ Target: $400
 0% 

Getting error in server console


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-31-2010 , 02:16   Re: Getting error in server console
Reply With Quote #1

Show the full code.
The error will be near a line with set_task().
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 05-31-2010 , 08:31   Re: Getting error in server console
Reply With Quote #2

Quote:
Originally Posted by 'Exolent[jNr
The error will be near a line with set_task().
How do you know that when he didn't show a set_task yet? Tell me your secret
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Effect
Junior Member
Join Date: May 2010
Old 05-31-2010 , 12:52   Re: Getting error in server console
Reply With Quote #3

Here set_task:
PHP Code:
set_task(0.5"ShowHealth"id
Effect is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-31-2010 , 16:00   Re: Getting error in server console
Reply With Quote #4

ZombieClass[id] > 3 will also cause an index out of bounds.

Quote:
Originally Posted by drekes View Post
he means that you should post the code he asked in his previous post, and that Exolent may have confused you by saying that the error is near a set_task call.
lol, you just repeated what Bugsy had just said.

This is the previous post to which Bugsy is refering:

Quote:
Originally Posted by Bugsy View Post
Show where ZombieClass[ id ] is assigned a value and make sure id is a value (1-32) player id.
Either way, the full code will provide the easiest and quickest way to get this problem solved.
__________________

Last edited by fysiks; 05-31-2010 at 16:04.
fysiks is offline
Effect
Junior Member
Join Date: May 2010
Old 06-01-2010 , 06:51   Re: Getting error in server console
Reply With Quote #5

Thanks for help.

Last edited by Effect; 06-02-2010 at 07:37.
Effect is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-01-2010 , 19:21   Re: Getting error in server console
Reply With Quote #6

You are setting the ZombieClass[] value via random_num( 1 , 4 ) which will give you a number in the range of 1 - 4. The max number that you can use to not error is 0 - 3; remember, arrays range from 0 to size-1. Change random_num(1,4) to random( 3 ). You will need to make adjustments with other parts of your code because it looks like you used numbers 1-4 for zombieclasses instead of 0-3. Instead of using numbers, use the enum names.

Code:
#define MAXCLASSES 4 new ZombieClass[33] //CLASSES array sized @ 4. 0=Classic, 1=ELectric, 2=Strong, 3=Mystic new const CLASSES[MAXCLASSES][] = {     "Classic",     "Electric",     "Strong",     "Mystic" } //Use these enum names in your code instead of numbers!! //Like this: if ( ZombieClass[ id ] == Strong )  etc enum {     Classic = 0,     Electric,     Strong,     Mystic }   // ... public fw_PlayerSpawn(id) {         if (!is_user_alive(id))         return;         set_task(0.5, "ShowHealth", id)         g_zombie[id] = (get_user_team(id) == 1)         ZombieClass[id] = random_num(1, 4)         //Change to         ZombieClass[id] = random( 3 )

And here, it will be easier to use your enums
PHP Code:
        // if ( ZombieClass[id] == Classic ) is the same as "if ZombieClass[] == 0"
        
if (ZombieClass[id] == 1)
        {
            new 
FloatGravity1FloatHealth1
            Health1 
get_pcvar_float(classic_health)
            
Gravity1 get_pcvar_float(classic_gravity)
            
set_pev(idpev_healthHealth1)
            
set_user_gravity(idGravity1)
        }
        
// if ( ZombieClass[id] == Electric ) is the same as "if ZombieClass[] == 1"
        
else if (ZombieClass[id] == 2
__________________
Bugsy is offline
Effect
Junior Member
Join Date: May 2010
Old 06-02-2010 , 07:39   Re: Getting error in server console
Reply With Quote #7

Can delete your this post? Thanks.
Effect 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 05:23.


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