SA-MP Forums Archive
[FilterScript] Experience system + Simple Account System - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] Experience system + Simple Account System (/showthread.php?tid=291325)



Experience system + Simple Account System - KingHual - 19.10.2011

Experience System & Simple Account System By King_Hual


Hello there. Here's another one of my scripts. It's an experience and level up system and a simple Account system.

Requirements:
You will need the includes "dudb" and "progress" which I have included in the file.

Version 1.0:
Here are the functions I created which you can use:

Код:
GivePlayerExp(playerid, ammount); //Gives the selected ID the selected ammount of experience.
GetPlayerExpLevel(playerid); //Returns the selected ID's Experience Level
GetPlayerExp(playerid); //Returns the selected ID's Experience
GetPlayerTotalExp(playerid); //Returns the selected ID's Total Experience (Experience needed to level up)
Here are the defines you can edit:
Код:
#define ExpForLevel 1000 //How much exp you need to pass a level. The Exp gets multiplied by the level. If you've got 1000 total exp then for lvl 2 it will be 2000
#define MaxLevel 99 //The maximum level a player can achieve.
#define UseProgBar // Define wheater to use the progress bar or not. Comment the line if you don't want a progress bar and leave like that if you do want a progress bar.
#define ProgBarColor 0x0000FFFF //The experience bar's color.
#define TextLabelColor 0x00FFFFFF // The textlabel's color.
#define CashForLevelUp 300 //This is the cash you get for levelling up. It gets multiplied by the level you achieved and one more time by a number you define.
#define CashMultiplier 1 //This multiplies the Cash * Level achieved by the number you want.
Version 1.1:
Edited Function "GivePlayerExp". Added reason. It's now:
Код:
GivePlayerExp(playerid, exp, reason[])
Added new defines:
Код:
#define GameTextStyle 4 //This defines the GameText's style used for the GivePlayerExp function.
#define GameTextTime 3000 //This defines the time for which the GameText for the GivePlayerExp function will be visible
Added example code in the script:
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
	if (killerid != playerid) {
	    if (GetPlayerExpLevel(playerid) < GetPlayerExpLevel(killerid))
	    {
    		GivePlayerExp(killerid, 100, "killing a lower level player");
	    }
	    else if (GetPlayerExpLevel(playerid) > GetPlayerExpLevel(killerid))
	    {
	    	GivePlayerExp(killerid, 300, "killing a higher level player");
	    }
	    else
	    {
	    	GivePlayerExp(killerid, 200, "killing a player at your own level");
	    }
	} // An example of using my exp system.
	return 1;
}
Well I hope you like it!

Screenshots:
Without Progress Bars:

With Progress Bars:



Video:
[ame]http://www.youtube.com/watch?v=haQuId0OGIw[/ame]

Special thanks to Michael@Belgium for helping me

Created by King_Hual

Version 1.0 Pastebin:
http://pastebin.com/4zxmbwpv

Version 1.1 Pastebin:
http://pastebin.com/xEp83EeS

!!!DON'T FORGET TO CREATE A FOLDER NAMED "HAccounts" IN YOUR SCRIPTFILES FOLDER AND TO PUT THE FILTERSCRIPT IN 1ST PLACE IN THE .cfg FILE!!!

Downloads:


Re: Experience system + Simple Account System - lordturhan - 19.10.2011

Cool useful for dm and tdms nice work


Re: Experience system + Simple Account System - KingHual - 19.10.2011

Quote:
Originally Posted by lordturhan
Посмотреть сообщение
Cool useful for dm and tdms nice work
Well you can use it for everything It can also be useful for RPG servers


Re: Experience system + Simple Account System - Michael@Belgium - 19.10.2011

haha Good FS !


Re: Experience system + Simple Account System - WoodPecker - 19.10.2011

Nice one i will use this to my script, thank you very much.


Re: Experience system + Simple Account System - KingHual - 19.10.2011

Quote:
Originally Posted by WoodPecker
Посмотреть сообщение
Nice one i will use this to my script, thank you very much.
You're welcome Glad you like it


Re: Experience system + Simple Account System - NessaHD - 19.10.2011

VERY NICE! Can the reason for XP be edited?


Re: Experience system + Simple Account System - KingHual - 19.10.2011

Quote:
Originally Posted by cruteX_modshop
Посмотреть сообщение
VERY NICE! Can the reason for XP be edited?
Well there's no reason for exp but ill create it in a minute. Thank you for the suggestion.


Re: Experience system + Simple Account System - NessaHD - 19.10.2011

No problem. I meant like when does the player get exp? When he kill someone, finish something or?..


Re: Experience system + Simple Account System - KingHual - 19.10.2011

Ok I updated it to 1.1. I made an option for reasons