AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Levels with XP, like wc3 (https://forums.alliedmods.net/showthread.php?t=12693)

stigma 04-21-2005 19:34

Levels with XP, like wc3
 
Hey - Can someone explain to me how i can add addtional experince to a player when he shot a client? Just like in wc3 mod.

Ced 04-21-2005 19:51

catch the damage event and u can give xp based off of the dmg or by a kill.

stigma 04-21-2005 19:57

Yes i know, but how can i save the XP, so the script remembers what the actual XP are for a client

Code:
new xp[32] // Would the script remember that all the time?

Ced 04-21-2005 20:22

it would remember it if it was global until it was changed or the map changed. Thats why the wc3 saves your xp to a vault.ini.

stigma 04-21-2005 20:27

Can you give an example please? ;S

Ced 04-21-2005 20:31

so say we have a plugin, you would declare a global variable like so...
Code:
//Put our includes #include <amxmodx> // Then next we could declare a global new g_xp[33]
then plugin init could come next and so on

stigma 04-21-2005 21:12

okay - But how can i give a use the XP that he have deserved

BioHazardousWaste 04-21-2005 21:37

look up vault.. what i did was d/ld the uwc3 source code, you can learn a hell of a lot from there, as well as by searching then posting on these forums, and last but not least use the functionwiki thing on the main page. It's extremely helpful but sometimes confusing. Using vault is really really easy:

//save exp
set_vaultdata (key, data)
//set_vaultdata (USER_exp, userexp[2]) //save player 2s exp

get_vaultdata (key, data)
//get_vaultdata (USER_exp, userexp[2])//load player 2s exp

You wouldn't actually do this, you would use steam ids and player ids and so forth, but that's the 2 basic vault commands.. another one is:
vaultdata_exists(data)

//if(vaultdata_exits(USER_exp)) //see if user has any exp saved or not (extremely useful for setting up new players)

that's basically it... have fun :)

KyleD 04-21-2005 21:54

http://forums.alliedmods.net/showthread.php?t=12518

stigma 04-22-2005 10:06

Hrmph, im a little noobi to this scripting thing, one of you cant you make a function, that would give a user 20 xp, per kill.

And it would be very good if you could add some comments into the script...


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

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