Raised This Month: $32 Target: $400
 8% 

How to make this correctly


Post New Thread Reply   
 
Thread Tools Display Modes
Croxeye.
Member
Join Date: Nov 2018
Old 11-20-2018 , 17:02   Re: How to make this correctly
Reply With Quote #11

This is all what i'm trying todo:

For every kill player will receive xp. By by receiving, player join leagues. By joining leagues, player unlock achievements. By unlocking achievements, player receive golds.

My current database looks like this:

achievements:
id | name | description | reward_amount | to_unlock (int)
1 | League Master | Join %s League | 100 | 5

leagues:
id | name | xp
1 | Bronze | 250
2 | Silver | 500
3 | Gold | 1000
4 | Cristal | 2000
5 | Titan | 5000

player:
id | nick | golds
1 | Croxeye | 100

player_achievements:
player_id | achievement_id | unlocked
1 | 1 | 1

player_stats:
player_id | xp | league
1 | 250 | 1

So, I have 250 xp and I'm in Bronze League so I have unlocked 1 achievement (I have 5 to unlock becouse there's 5 leagues) and now I want to replace '%s' from 'description' and I try to do it like this:

PHP Code:
%s, (player[id][playerAchievements[i][unlocked]] == achievements[i][toUnlock] ? ("\d%s"achievements[i][description]) : ("\wCompleted.")) 
EDIT: I also need sopport for MySQL 8 server

Last edited by Croxeye.; 11-20-2018 at 17:29.
Croxeye. is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-20-2018 , 22:52   Re: How to make this correctly
Reply With Quote #12

If you are using a database I would have the plugin only track how much XP a player has, the rest will be managed by the db, right? I'm not sure why you are defining the achievements and leagues in arrays.
__________________
Bugsy 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 23:44.


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