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

How to make this correctly


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Croxeye.
Member
Join Date: Nov 2018
Old 11-18-2018 , 08:49   How to make this correctly
Reply With Quote #1

PHP Code:
enum _:playerAchievementsTable {
    
id,
    
achievement_id,
    
unlocked
}

enum _:playerTable {
    
/* ... */
        
id,
    
playerAchievements[][playerAchievementsTable// ERROR: error 029: invalid expression, assumed zero
}

new 
player[33][playerTable];

enum _:achievementsTable {
    
id,
    
name[64],
    
description[64],
    
rewardType[10],
    
rewardAmount,
    
to_unlock
}

new 
achievements[][achievementsTable];

for(new 
1achievements[]; i++) {
     
ColorChat(idGREEN"%s"player[id][playerAchievements[i][unlocked]] == achievements[i][to_unlock] ? ("%s"achievements[i][description]) : ("Achievement Completed.")); // ERRORS: error 028: invalid subscript (not an array or too many subscripts): "playerAchievements"; error 029: invalid expression, assumed zero


Last edited by Croxeye.; 11-18-2018 at 17:34.
Croxeye. is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 11-18-2018 , 08:54   Re: How to make this correctly
Reply With Quote #2

Remove the [].
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Croxeye.
Member
Join Date: Nov 2018
Old 11-18-2018 , 09:06   Re: How to make this correctly
Reply With Quote #3

Quote:
Originally Posted by OciXCrom View Post
Remove the [].
Code:
error 028: invalid subscript (not an array or too many subscripts): "playerAchievements"
(on last line)

Last edited by Croxeye.; 11-18-2018 at 09:07.
Croxeye. is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 11-18-2018 , 12:51   Re: How to make this correctly
Reply With Quote #4

Remove the [i] in the "playerachievements" too.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Croxeye.
Member
Join Date: Nov 2018
Old 11-18-2018 , 17:32   Re: How to make this correctly
Reply With Quote #5

Then that is not what i'm looking for.. I have to identify each achievement...
Croxeye. is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-18-2018 , 19:09   Re: How to make this correctly
Reply With Quote #6

You may want to re-think your data layout. Are multiple enumerators needed or can you put all data into 1 or possibly 2? You also cannot re-use the constant 'id' in all of your enumerators. In addition, which will resolve my previous statement, the player id who the data corresponds to is covered based on the index of the array holding the players data so there is no need to store it.
__________________
Bugsy is offline
Croxeye.
Member
Join Date: Nov 2018
Old 11-20-2018 , 12:06   Re: How to make this correctly
Reply With Quote #7

can you show me correct way to do this please.. I want to make player session and store data in it, and destroy session on client disconnect.

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

I need more info. Is achievementsTable a pre-defined set of achievements that any player can get? Can each player get a set number of achievements? The more info you can give me the better I can help you
__________________
Bugsy is offline
Croxeye.
Member
Join Date: Nov 2018
Old 11-20-2018 , 12:27   Re: How to make this correctly
Reply With Quote #9

achievements table:
id | name | description | reward_type | reward_amount | to_unlock
1 | League Master | Join Cristal League | 1 | 100 | 0

player_achievements table:
player_id | achievement_id | unlocked
1 | 1 | 0

Player with id 1 didn't unlocked achievement with id 1
Croxeye. is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-20-2018 , 12:41   Re: How to make this correctly
Reply With Quote #10

What does to_unlock correspond to? Is a player accumulating XP and once X is reached they get a reward? Does this value reset when they get one? The more info the better
__________________
Bugsy is offline
Reply


Thread Tools
Display Modes

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 00:08.


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