Raised This Month: $ Target: $400
 0% 

3d Array saving (MySQL) [90 Queires?]


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 08-15-2013 , 14:16   3d Array saving (MySQL) [90 Queires?]
Reply With Quote #1

Hi, i need a little help to save a 3d array into mysql db
I need to know how to create a table for do this.

I have this array:

PHP Code:
#include <amxmodx>

new g_iMaxPlayers;

#define IsPlayer(%0) (1 <= %0 <= g_iMaxPlayers)

enum _:Stats
{
    
KILLS 0,
    
DEATHS,
    
HEADSHOTS,
    
SHOTS,
    
DAMAGE,
    
HITS
};

#define MAX_PLAYERS     33
#define MAX_WEAPONS     33
#define MAX_STATS     6

new g_iWeapon[MAX_PLAYERS][MAX_WEAPONS][Stats];     // 

public plugin_init()
{
    
register_plugin("CS Stats Test",AMXX_VERSION_STR,"Amxx Dev Team");

    
register_event("DeathMsg","ev_DeathMsg","a","1>0","2>0");
    
    
g_iMaxPlayers get_maxplayers();
}

public 
ev_DeathMsg()
{
    new 
iVictim read_data(2);
    new 
iKiller get_user_attacker(iVictim);
    new 
iWeapon get_user_weapon(iKiller);
    
    
g_iWeapon[iVictim][iWeapon][DEATHS]++;
    
    if(
IsPlayer(iKiller) && (iKiller != iVictim))
    {
        
g_iWeapon[iKiller][iWeapon][KILLS]++;
        
        if(
read_data(3)) g_iWeapon[iKiller][iWeapon][HEADSHOTS]++;
    }
    
    new 
szName[2][32],szWeapon[32];
    
get_user_name(iKiller,szName[0],charsmax(szName[]));
    
get_user_name(iVictim,szName[1],charsmax(szName[]));
    
    
get_weaponname(iWeapon,szWeapon,charsmax(szWeapon));
    
    
replace_all(szWeapon,charsmax(szWeapon),"weapon_","");

    
client_print
    
(
        
0,
        
print_center,
        
"%s Killed %s with their %s",
        
szName[0],
        
szName[1],
        
szWeapon
    
);

__________________
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
 


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:51.


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