Raised This Month: $ Target: $400
 0% 

3d Array using map name


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 08-10-2013 , 17:40   3d Array using map name
Reply With Quote #1

Hi all, how to create a 3d array to store map name to combine with user stats?

I need something like this >>

PHP Code:
#include <amxmodx>
#include <amxmisc>

enum Stats // Test for me :)
{
    
K,     // Kills
    
A,     // Assists
    
D,     // Deaths
    
HS,     // Headshots
    
ST,     // Shots
    
HT,     // Hits
    
DM,     // Damage
    
RP,     // Rounds Played
    
RL,     // Rounds Lose
    
RW     // Rounds Win
};

new 
g_iMaps[33][33][Stats];     // UserID, Map Name (?), Stats type

public client_death(iKiller,iVictim,iWP,iPlace,iTK)
{
    
g_iMaps[iKiller][MAP NAME????][K]++;

__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 08-10-2013 , 17:52   Re: 3d Array using map name
Reply With Quote #2

try something like:
Code:
#include <amxmodx> #include <amxmisc> enum Stats // Test for me :) {     K,     // Kills     A,     // Assists     D,     // Deaths     HS,     // Headshots     ST,     // Shots     HT,     // Hits     DM,     // Damage     RP,     // Rounds Played     RL,     // Rounds Lose     RW,     // Rounds Win     mapName[32] }; new g_iStats[33][Stats];     // UserID, Map Name (?), Stats type new g_mapName[32]; public plugin_init() {     get_mapname(g_mapName, charsmax(g_mapName)); } public client_putinserver(id) {     copy(g_iStats[id][mapName], charsmax(g_iStats[]), g_mapName);     } public client_death(iKiller,iVictim,iWP,iPlace,iTK) {     if (equal(g_iStats[iKiller][mapName], g_mapName))     {         g_iStats[iKiller][K]++;     } }

Last edited by TheDS1337; 08-10-2013 at 17:53.
TheDS1337 is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 08-10-2013 , 18:27   Re: 3d Array using map name
Reply With Quote #3

Thanks.
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 08-10-2013 , 19:09   Re: 3d Array using map name
Reply With Quote #4

If you want map-specific stats, then the above code doesn't do that. You'd need to use Tries.
__________________
hleV is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-10-2013 , 19:25   Re: 3d Array using map name
Reply With Quote #5

You can only play one map at a time so there is no real need to store the info for more than just that map. So, having said that, why are you needing to have any info about a different map?
__________________
fysiks is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 08-10-2013 , 23:00   Re: 3d Array using map name
Reply With Quote #6

Quote:
Originally Posted by fysiks View Post
You can only play one map at a time so there is no real need to store the info for more than just that map. So, having said that, why are you needing to have any info about a different map?
Yes, i need to upload to mysql the results of this map when client connect or disconnect from server

__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-11-2013 , 02:21   Re: 3d Array using map name
Reply With Quote #7

Quote:
Originally Posted by ^SmileY View Post
Yes, i need to upload to mysql the results of this map when client connect or disconnect from server

Then you don't need to index anything by the mapname nor do you need to know anything about other maps. When you send your query to the SQL server, you simply also provide the current map name in the query.
__________________
fysiks is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 08-11-2013 , 17:57   Re: 3d Array using map name
Reply With Quote #8

The problem is solved.
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 08-11-2013 , 21:17   Re: 3d Array using map name
Reply With Quote #9

Quote:
Originally Posted by fysiks View Post
Then you don't need to index anything by the mapname nor do you need to know anything about other maps. When you send your query to the SQL server, you simply also provide the current map name in the query.

__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
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 15:52.


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