AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   3d Array using map name (https://forums.alliedmods.net/showthread.php?t=223191)

^SmileY 08-10-2013 17:40

3d Array using map name
 
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]++;



TheDS1337 08-10-2013 17:52

Re: 3d Array using map name
 
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]++;     } }

^SmileY 08-10-2013 18:27

Re: 3d Array using map name
 
Thanks.

hleV 08-10-2013 19:09

Re: 3d Array using map name
 
If you want map-specific stats, then the above code doesn't do that. You'd need to use Tries.

fysiks 08-10-2013 19:25

Re: 3d Array using map name
 
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?

^SmileY 08-10-2013 23:00

Re: 3d Array using map name
 
Quote:

Originally Posted by fysiks (Post 2010277)
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

:)

fysiks 08-11-2013 02:21

Re: 3d Array using map name
 
Quote:

Originally Posted by ^SmileY (Post 2010358)
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.

^SmileY 08-11-2013 17:57

Re: 3d Array using map name
 
The problem is solved.

fysiks 08-11-2013 18:06

Re: 3d Array using map name
 
Quote:

Originally Posted by ^SmileY (Post 2011099)
The problem is solved.

And what was your solution?

^SmileY 08-11-2013 21:17

Re: 3d Array using map name
 
Quote:

Originally Posted by fysiks (Post 2010437)
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.


:bee:


All times are GMT -4. The time now is 15:52.

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