AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Good programmers, I need help with XP system... (https://forums.alliedmods.net/showthread.php?t=10980)

XunTric 03-06-2005 13:06

Good programmers, I need help with XP system...
 
Hey im working on a new big plugin with xp system.
When you level up, there isnt any upgrade menu.
The upgrades are auto, depending on what class you are.
When you level up, it shows a motd style window that says all the upgrades you got.
But this is annyoing, if you level up in the middle of a round, and that window shows up on their screen when they get attacked.
So what i want, is to get that message to show up on next round instead, so they wont get attacked when reading.
So i want it to show up with the ResetHud function on next round.
How do i make it show up on next round?
I know i just can put the upgrade motd lines in ResetHud, but then that window will show up every round.
I just want it to show up next round after you got a level, and not all rounds.
I got so you can say "/level" and that message will show up, but i want it on next round after you level up too.

Hope somebody can help!
Thanks

XxAvalanchexX 03-06-2005 13:34

Common logic man, sheesh!

When they level set a variable to 1. On ResetHUD, if that variable is 1, display the MoTD window and set that variable to 0.

Easy.

Come on, now.

XunTric 03-06-2005 13:53

Omg didnt know it was that easy.

Can you just give me a example so im sure?
-----------------------------------------------
EDIT:
Im pretty unsure really. I've never done that before :P
Should i make a clcmd?

XxAvalanchexX 03-06-2005 17:50

...Why would you need a client command for that?

You know about variables, right?

XunTric 03-07-2005 07:50

I started learning AMX Mod X a month ago, and havnt really used that kind of code before... Can you just tell me how to do it?

XunTric 03-07-2005 07:59

This is just a example... Is this right?
Code:
public plugin_init() {     register_cvar("upgrades", "0") } public event_DeathMsg(id) {     new attacker = read_data(1)       g_playerXP[attacker] += (g_playerLevel[id] * 5) + 3000     if(g_playerXP[attacker] >= LEVELS[g_playerLevel[attacker]]) {         g_playerLevel[attacker] += 1         set_cvar_num("upgrades", "1")     }     return PLUGIN_CONTINUE } public ResetHud {     if (upgrades == 1)     {     //code     set_cvar_num("upgrades", "0")     } }

Note: Dont care about the XP code... I know that part works... Just to show you.

XunTric 03-07-2005 15:04

Sorry for the spam, but my thread was going far down on the thread list. :P

XxAvalanchexX 03-07-2005 16:29

My goodness man, have you ready any tutorials? Variables are like the most freakishly important building block. I don't see how you could have made so much of your plugin already and not know about variables.

Go read the tutorials.

Da Bishop 03-07-2005 16:54

lol, if you try that code at all with resetHUD your gonna spam the hell out of people with motd, thats if it doesn't crash the server :/ ......

TotalNoobScripter 03-07-2005 17:29

arent u suppose to register a new round or something? becuz im pretty sure ResetHud gets called mroe than once a round.


All times are GMT -4. The time now is 14:11.

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