AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Exp system (https://forums.alliedmods.net/showthread.php?t=12374)

KyleD 04-13-2005 22:17

Exp system
 
Hey, I was wondering if anybody could at the very least show me an example on how to make an exp system.

I get the..

Code:
new Playerxp[33] new levels[5] = {100,200,400,800,1600};

I just don't get what to do after that.

XxAvalanchexX 04-13-2005 23:29

Re: Exp system
 
Quote:

Originally Posted by KyleD
Hey, I was wondering if anybody could at the very least show me an example on how to make an exp system.

I'd like you to more be vague, please, it'd really help me make you an example.

"an exp system" is a very, very, very broad subject. What mod is it? That's pretty important. Also, how the heck do you even want it to work? There are gillions of ways to make exp systems.

KyleD 04-13-2005 23:49

Your right.
I would like to make and exp system that works like UltimateWarCraft3 mod. I would like it to work for counter-strike and I was going to attempt to make a mod called "HaloMod". Just 2 basic sides where you dont changeclass your basicaly get better upgrades. So basicaly heres how it would work...

2 sides
exp is based on frags
when new lvl is gained class dont change but skills will

Hopefully that gave you a better understanding for what im looking for.

XxAvalanchexX 04-14-2005 02:21

Code:
#include <amxmodx> #define XP_FOR_KILL 50 #define MAX_LEVEL 10 new playerxp[33]; new level[33]; public plugin_init() {    register_event("DeathMsg","event_deathmsg","a"); } public event_deathmsg() {    new victim = read_data(2);    new attacker = get_user_attacker(victim);    if(!is_user_connected(attacker) || attacker == victim) {       return PLUGIN_CONTINUE;    }    if(level[attacker] < MAX_LEVEL) {       playerxp[attacker] += XP_FOR_KILL;       check_for_new_level(attacker);    }    return PLUGIN_CONTINUE; } // long function name, eh? public check_for_new_level(id) {    new xpneeded = get_user_nextxp(id);    if(playerxp[id] > xpneeded) {       level[id]++;       // congratulatory stuff here    } } public get_user_nextxp(id) {    new currxp = 100;    for(new i=0;i<level[id];i++) {       currxp *= 2;    }    return currxp; }

There's a start.

KyleD 04-14-2005 02:58

Could you explain to me the "read_data(2)" part because it says
- undefiend symbol "victim"..

XxAvalanchexX 04-14-2005 16:45

Whoops, used "victim" in place of "id" in the function to get the user's next experience amount. Anyway, read_data(2) grabs the 2nd parameter from the DeathMsg event, which is the killer.

KyleD 04-14-2005 17:21

Now, is the code you just posted supposed to give the attacker 50 xp everytime he kills the victim? I tested it, but when I killed another person I didn't get what I was supposed to get which was a weapon.

Ced 04-14-2005 20:53

his example only adds xp into an array for your id when u kill somebody and u get lvls up to 10

XxAvalanchexX 04-14-2005 22:11

Quote:

Originally Posted by KyleD
I didn't get what I was supposed to get which was a weapon.

What? You're supposed to get a weapon?

KyleD 04-15-2005 15:06

Yeah.

Code:
// long function name, eh? public check_for_new_level(id) {    new xpneeded = get_user_nextxp(id);    if(playerxp[id] > xpneeded) {       level[id]++;       // congratulatory stuff here    } }

I put "give_item(id,"weapon_m4a1") for // congratulatory stuff here

And what I thought was gonna happen was when I killed a person it would have given me the m4a1.


All times are GMT -4. The time now is 09:58.

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