Raised This Month: $ Target: $400
 0% 

Exp Base - Classname help?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 04-12-2011 , 17:11   Exp Base - Classname help?
Reply With Quote #1

Hey i'm trying to make a basic xp mod.. but I want people to gain "Classname" instead of choosing like:
Code:
public Deathmsg() { new attacker = read_data(1) new victim = read_data(2) blablabla playerExp[id] += bla; while(playerLevel[id] >= 5 { playerClass[id] = 1//in this case "animal planet" } while(playerLevel[id] >= 10 { playerClass[id] = 2//in this case "star wars" }

I have tried several ways but this way worked untill it was time to change classname that will say... at that point it froze cs totaly :/
Code:
#include <amxmodx> #include <amxmisc> #define MAXCLASSES 5 enum {     CLASS_HORSESHOE = 0,     CLASS_ANIMALPLANET = 1,     CLASS_STARWARS = 2,     CLASS_HARRYPOTTER = 3,     CLASS_MRMIME = 4 } new const CLASSES[MAXCLASSES][] ={     "Horse Shoe",     "Animal Planet",     "Star Wars",     "Harry Potter",     "Mr Mime" };
... Awesome Classnames xD
and for the way to show it I use a menu like:
Code:
new MainTitle[128]     format(MainTitle, 127, "\rExpMod^n\wMain Menu^n^nExp: \y%i^n\wLvl: \y%i^n\wClass: \y%s", playerExp[id], playerLevel[id], CLASSES[playerClass[id]]); new Main = menu_create(MainTitle, "handleMain");
Anyone think they know how to fix this?... not that great with enums :/

Last edited by Erox902; 04-27-2011 at 09:30.
Erox902 is offline
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 04-26-2011 , 17:11   Re: Exp Base - Classname help?
Reply With Quote #2

bump
Erox902 is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 04-26-2011 , 17:16   Re: Exp Base - Classname help?
Reply With Quote #3

"Harry Potter",
"Mr Mime"
xD harry potter
Please post full code i can help i think...
.Dare Devil. is offline
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 04-26-2011 , 17:30   Re: Exp Base - Classname help?
Reply With Quote #4

Quote:
I have tried several ways but this way worked untill it was time to change classname that will say... at that point it froze cs totaly :/
Explain more clearly please.
__________________

SonicSonedit is offline
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 04-27-2011 , 09:22   Re: Exp Base - Classname help?
Reply With Quote #5

Quote:
Originally Posted by SonicSonedit View Post
Explain more clearly please.
I want to make a exp mod, the thing about it is that i don't want people to be able to choose what "class" they will be, like in uwc3ng and such... I want them to have the "classname" "harry potter" for example the first time they join... now when they level up to example lvl 5 they will change "classname" to something else, but what i exactly meant with cs freezing is that when it starts to "loop the levels" to see if he is in high lvl enough to get the new "classname", then cs freezes and i have to quit it with ctrl+alt+del ... accually i said that i used if statements but thats not true i'm looping them in the deathmsg... will edit in a sec...
Erox902 is offline
aaarnas
Veteran Member
Join Date: Jun 2008
Location: Lithuania
Old 04-27-2011 , 09:30   Re: Exp Base - Classname help?
Reply With Quote #6

If it freezes, it mean, that you created eternal cycle somewhere. Mostly expected while cycle.
__________________
My plugins:
[ZP] ZM_VIP (v2.0.0 is comming. v1.9.1 BETA is out!)

aaarnas is offline
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 04-27-2011 , 09:31   Re: Exp Base - Classname help?
Reply With Quote #7

eternal cycle? :S like looping doesn't stop or how do you mean?
Erox902 is offline
aaarnas
Veteran Member
Join Date: Jun 2008
Location: Lithuania
Old 04-27-2011 , 09:59   Re: Exp Base - Classname help?
Reply With Quote #8

Yes. Let's say something like this:
PHP Code:
program() {
    
    new 
abc
    b 
1
    
while(b) {
        
        
c++
        
c
    
}

This cycle will newer end, and after it comes, server(not client) console freezes and doesn't react at anything.
__________________
My plugins:
[ZP] ZM_VIP (v2.0.0 is comming. v1.9.1 BETA is out!)

aaarnas is offline
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 04-27-2011 , 10:00   Re: Exp Base - Classname help?
Reply With Quote #9

Erox902
Cycle like
PHP Code:
for (i=1i>0;i++) 
will never end.
Show all code.
__________________

SonicSonedit is offline
Old 04-27-2011, 10:10
Erox902
This message has been deleted by Erox902.
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 04-27-2011 , 10:14   Re: Exp Base - Classname help?
Reply With Quote #10

PHP Code:
public Classname(id)
{
   while(
playerLvl[id] >= 5)
   {
        
playerClass[id] = 1;
   }
   while(
playerLvl[id] >= 12)
   {
        
playerClass[id] = 2;
   }
   while(
playerLvl[id] >= 19)
   {
        
playerClass[id] = 3;
   }
   while(
playerLvl[id] >= 25)
   {
        
playerClass[id] = 4;
   }

Wow. It's supposed to be like this:
PHP Code:
public Classname(id)
{
   if (
playerLvl[id] >= 5)
        
playerClass[id] = 1;
   
   if (
playerLvl[id] >= 12)
        
playerClass[id] = 2;
   
   if (
playerLvl[id] >= 19)
        
playerClass[id] = 3;
   
   if (
playerLvl[id] >= 25)
        
playerClass[id] = 4;

__________________


Last edited by SonicSonedit; 04-27-2011 at 10:16.
SonicSonedit 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 20:12.


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