Raised This Month: $ Target: $400
 0% 

Frustration!!! (2 Problems)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BioHazardousWaste
Senior Member
Join Date: Apr 2005
Location: Ontario, Canada =)
Old 04-22-2005 , 18:27   Frustration!!! (2 Problems)
Reply With Quote #1

Hey guys

I'm getting really frustrated and feel like giving up, but I've done so much work I don't want to. I've been getting the weirdest errors since I added this line : num_to_str(PlayerExp[id],tmp_PlayerExp,32) Although it's probably unrelated. Anyways, here's the latest: Fuck... server crashed, hold on.

Problem #1
Quote:
L 04/22/2005 - 18:15:23: [AMXX] Run time error 4 (index out of bounds) on line 112 (file "ma_matrix.sma").
Code:
    register_event("ResetHUD", "NewRound", "be")//Call PlayerSpawn whenever someone spawns - in plugin _init new PlayerAlliance[34] = 0 //in vars.inc public NewRound() {     for(i=0;i<32;i++)     {         if(ReadyToLoad[i] == 1)         {             ReadyToLoad[i] = 0             LoadPlayer(i)                         new Name[32], Alliance[32]             if (PlayerAlliance[i] == 0) //line 112 (error here)                 copy(Alliance, 32, "Blue Pills")             else if (PlayerAlliance[i] == 1)                 copy(Alliance, 32, "Zionists")             else if (PlayerAlliance[i] == 2)                 copy(Alliance, 32, "Machines")             else if (PlayerAlliance[i] == 3)                 copy(Alliance, 32, "Exiles")                     get_user_name(i, Name, 31)                     //show other users             set_hudmessage(255, 255, 255, 0.5, 0.5, 0, 6.0, 12.0, 0.1, 0.2, 4)             show_hudmessage(0, "Beware: %s has joined the fight for the %s", Name, Alliance)         }         CheckLevel(i)     } }

Any idea what the problem is? I can't see how it can be invalid, because it goes from 0 to 32 and the array is from 0 to 34.

Problem #2
When the users exp is loaded, it is supposed to run through a quick calculation to tell the users level and say "You are level #x" However, it always says 100; even if someone has 0 exp.

Code:
new ExperienceForLevel[101] //levels, 0 - 100 (in vars.inc) //the following is in plugin _init     //bullshit to put levels, because using {} to assign values gives the error line to long     ExperienceForLevel[0] = 0     bullshit = 5     for(new i=1;i<101 ;i++)     {         bullshit = floatround(bullshit * 1.337)         ExperienceForLevel[i] = bullshit     } //end relevant plugin_init code //load exp procedure public LoadExp(id) {     //get user AuthID     new AuthID[34], value[9]     new key[99]         get_user_authid(id, AuthID, 33)         format(key, 98, "%s_exp", AuthID)         get_vaultdata(key, value, 8)     PlayerExp[id] = str_to_num(value)         PlayerFocus[id] = PlayerLevel[id]         //recreate bullshit to figure out level     bullshit = 5     for(i=1;i<101;i++)     {         bullshit = floatround(bullshit * 1.337)                 if(PlayerExp[id] > bullshit || PlayerExp[id] == bullshit)         {             PlayerLevel[id] = i         }     }     set_hudmessage(255, 255, 255, 0.5, 1.0, 1, 6.0, 25.0, 0.1, 0.2, 4)     show_hudmessage(0, "You are currently level #%i", PlayerLevel[id])         //Debug     client_print (0, print_console, "User %s is level %i", AuthID, PlayerLevel[id])     client_print (0, print_console, "Exp data (%s) loaded for user: %s", value, AuthID)     client_print (0, print_console, "Current exp = %i", PlayerExp[id])     }

Right now those are my 2 biggest problems, I still don't think you gain exp right, but i'll get to that after these. If someone can give me a hand, i'd really appreciate it.
__________________
"What then is truth? Truths are illusions which we have forgotten are illusions - they are metaphors that have become worn out... this (truth) is the duty to lie according to a fixed convention.

-Friedrich Nietzsche
BioHazardousWaste is offline
Send a message via MSN to BioHazardousWaste
BioHazardousWaste
Senior Member
Join Date: Apr 2005
Location: Ontario, Canada =)
Old 04-22-2005 , 20:44  
Reply With Quote #2

OK, I dunno wtf is going on. I think i've almost got it to work (for me). I've modded my code so much over the past few hours, it could have been anything. So i'm starting to get happy, although not really happy because i'm still a level 100 with 0 experience. So anyways, i'm getting happy, then some random asshole comes and joins my server and it says game commencing; then BOOM! it crashes!!! How the hell can I fix the problem if it crashes and I can't see the error? Anybody, somebody? Please help me
__________________
"What then is truth? Truths are illusions which we have forgotten are illusions - they are metaphors that have become worn out... this (truth) is the duty to lie according to a fixed convention.

-Friedrich Nietzsche
BioHazardousWaste is offline
Send a message via MSN to BioHazardousWaste
BioHazardousWaste
Senior Member
Join Date: Apr 2005
Location: Ontario, Canada =)
Old 04-22-2005 , 22:41  
Reply With Quote #3

Wow... it is now 10:40 PM and I finally figured out that the error was equivelant to an integer overflow. It's only been about 7 hours since I first got it! Congratualtions, excuse me while I go slit my wrist, and thanx for the help.
__________________
"What then is truth? Truths are illusions which we have forgotten are illusions - they are metaphors that have become worn out... this (truth) is the duty to lie according to a fixed convention.

-Friedrich Nietzsche
BioHazardousWaste is offline
Send a message via MSN to BioHazardousWaste
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 09:53.


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