Raised This Month: $ Target: $400
 0% 

Cannot save by player name


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lauliu
Member
Join Date: Jun 2009
Old 08-16-2010 , 23:59   Cannot save by player name
Reply With Quote #1

Dear All,

I have no idea on rpgX mod save exp by players name instead of player steam id.

I had tried to replace szAuthId by szName but nothing changes.

Please help

PHP Code:
/*
*    RPGx AMX Mod X Plugin
*    Copyright (C) 2009 by roflmao456
*
*    This program is free software: you can redistribute it and/or modify
*    it under the terms of the GNU General Public License as published by
*    the Free Software Foundation, either version 3 of the License, or
*    (at your option) any later version.
*
*    This program is distributed in the hope that it will be useful,
*    but WITHOUT ANY WARRANTY; without even the implied warranty of
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*    GNU General Public License for more details.
*
*    You should have received a copy of the GNU General Public License
*    along with this program.  If not, see <http://www.gnu.org/licenses/>.

*     In addition, as a special exception, the author gives permission to
*     link the code of this program with the Half-Life Game Engine ("HL
*     Engine") and Modified Game Libraries ("MODs") developed by Valve,
*     L.L.C ("Valve"). You must obey the GNU General Public License in all
*     respects for all of the code used other than the HL Engine and MODs
*     from Valve. If you modify this file, you may extend this exception
*     to your version of the file, but you are not obligated to do so. If
*     you do not wish to do so, delete this exception statement from your
*     version.
*/

/* 
* If you have Counter-Strike 1.6...
* Come join us at the Zombies on Weed CS 1.6 community!

* Forum/Website: www.ZombiesonWeed.com

* Servers:
* - Zombie Plague
*     - 74.81.90.122:27015
*     - 74.81.90.122:27016
* - Prison Break
*     - 74.81.90.122:27017
* - Deathrun
*     - 74.81.90.122:27018

* Note: IPs may change, so keep yourself updated at our website!
*/

#include <amxmodx>
#include <amxmisc>

/* PLUGIN COMPILE CONFIGURATION */
/* 
* This is where you could change your saving option from
* - None (comment both includes)
* - nVault (comment only sqlx include)
* - SQL (comment only nvault include)
*/

//#include <nvault>
#include <sqlx>

/*
* Increase this if you don't see some upgrades
*/

#define MAX_UPGRADES 16

/* PLUGIN COMPILE CONFIGURATION */

#pragma semicolon 1

#include <cstrike>
#include <csx>
#include <fun>
#include <hamsandwich>

#define _VAULT defined _nvault_included
#define _SQL defined _sqlx_included
#define SAVABLE _VAULT || _SQL

#define required_xp(%1) get_pcvar_num(g_pXPStart) + (g_iLevel[%1] * get_pcvar_num(g_pXPInc))
#define PlaySound(%1,%2) client_cmd(%1, "spk sound/rpgx/%s.wav", %2)

#if SAVABLE
    #if _VAULT
        
new g_hVault;
    
#endif
    #if _SQL
        
new Handle:g_hSQLTuple;
        new 
g_szSQLTable[64], g_szSQLHost[64], g_szSQLUser[64], g_szSQLPass[64], g_szSQLDB[64];
        new 
g_pSQLHostg_pSQLUserg_pSQLPassg_pSQLDBg_pSQLTable;
    
#endif
#endif

new g_iUpgrades;

new 
g_fwPluginReadyg_fwPluginAuthg_fwPlayerSpawng_fwPlayerLevelUpg_fwPlayerDeath,
    
g_fwPlayerHurtg_fwPluginUpgradePurchaseg_fwPluginUpgradeSellg_fwLastResult;

new 
g_pXPNoticeg_pXPMaxg_pXPStartg_pXPIncg_pXPKillg_pXPHeadshotg_pXPDamageg_pXPKnifeDmg,
    
g_pXPTeamWing_pXPBombPlantg_pXPBombDefuseg_pXPBombExplode;

new 
g_pCreditsIncg_pCreditsStartg_pCreditsSellPct;

new 
bool:g_bIsFrozen[33];

new 
g_iLevel[33], g_iXP[33], g_iCredits[33], g_iSpawnHealth[33];

new 
g_iUpgrade_Level[33][MAX_UPGRADES], g_iUpgrade_Info[MAX_UPGRADES][3], g_szUpgrade_Name[MAX_UPGRADES][64];

public 
plugin_init(){
    
register_plugin("RPGx""2.0""roflmao456");
    
register_cvar("rpgx_version""2.0"FCVAR_SPONLY|FCVAR_SERVER);
    
#if SAVABLE
        #if _SQL
            
g_pSQLHost register_cvar("rpgx_sql_host"""FCVAR_PROTECTED);
            
g_pSQLUser register_cvar("rpgx_sql_user"""FCVAR_PROTECTED);
            
g_pSQLPass register_cvar("rpgx_sql_pass"""FCVAR_PROTECTED);
            
g_pSQLDB register_cvar("rpgx_sql_db"""FCVAR_PROTECTED);
            
g_pSQLTable register_cvar("rpgx_sql_table""RPGx"FCVAR_PROTECTED);
            
            static 
szConfigDir[64];
            
get_configsdir(szConfigDir63);
            
server_cmd("exec %s/rpgx/sql.cfg"szConfigDir);
            
server_exec();
            
            
get_pcvar_string(g_pSQLHostg_szSQLHost63);
            
get_pcvar_string(g_pSQLUserg_szSQLUser63);
            
get_pcvar_string(g_pSQLPassg_szSQLPass63);
            
get_pcvar_string(g_pSQLDBg_szSQLDB63);
            
get_pcvar_string(g_pSQLTableg_szSQLTable63);
            
            
g_hSQLTuple SQL_MakeDbTuple(g_szSQLHostg_szSQLUserg_szSQLPassg_szSQLDB);
            
            static 
iErrorszError[256];
            new 
Handle:hSQLConnection SQL_Connect(g_hSQLTupleiErrorszError255);
            
            if(
hSQLConnection != Empty_Handle){
                
SQL_QueryAndIgnore(hSQLConnection,
                    
"CREATE TABLE IF NOT EXISTS `%s` (\
                        authid VARCHAR(64) NOT NULL PRIMARY KEY, \
                        level INT NOT NULL DEFAULT 0, \
                        experience INT NOT NULL DEFAULT 0, \
                        credits INT NOT NULL DEFAULT 0, \
                        upgrades VARCHAR(128) NOT NULL \
                    ) ENGINE=MyISAM;"
g_szSQLTable);
                
SQL_FreeHandle(hSQLConnection);
                }
        
#endif
        #if _VAULT
            
g_hVault nvault_open("RPGx");
        
#endif
    #endif
    
    
g_pXPNotice register_cvar("rpgx_xp_notice""1");
    
g_pXPMax register_cvar("rpgx_xp_max""50000");
    
g_pXPStart register_cvar("rpgx_xp_start""250");
    
g_pXPInc register_cvar("rpgx_xp_inc""75");
    
g_pXPKill register_cvar("rpgx_xp_kill""15");
    
g_pXPHeadshot register_cvar("rpgx_xp_headshot""50");
    
g_pXPDamage register_cvar("rpgx_xp_damage""1.0");
    
g_pXPKnifeDmg register_cvar("rpgx_xp_knifedmg""8.0");
    
g_pXPTeamWin register_cvar("rpgx_xp_teamwin""0.15");
    
g_pXPBombPlant register_cvar("rpgx_xp_bombplanted""0.15");
    
g_pXPBombDefuse register_cvar("rpgx_xp_bombdefused""0.30");
    
g_pXPBombExplode register_cvar("rpgx_xp_bombexploded""0.20");
    
    
g_pCreditsInc register_cvar("rpgx_credits_inc""5");
    
g_pCreditsStart register_cvar("rpgx_credits_start""5");
    
g_pCreditsSellPct register_cvar("rpgx_credits_sellpercent""0.75");
    
    
g_fwPluginReady CreateMultiForward("RPGx_OnPluginReady"ET_IGNORE);
    
g_fwPluginAuth CreateMultiForward("RPGx_OnPlayerAuth"ET_IGNOREFP_CELL);
    
g_fwPluginUpgradePurchase CreateMultiForward("RPGx_OnUpgradePurchase"ET_IGNOREFP_CELLFP_CELLFP_CELL);
    
g_fwPluginUpgradeSell CreateMultiForward("RPGx_OnUpgradeSell"ET_IGNOREFP_CELLFP_CELLFP_CELL);
    
g_fwPlayerSpawn CreateMultiForward("RPGx_OnPlayerSpawn"ET_IGNOREFP_CELL);
    
g_fwPlayerLevelUp CreateMultiForward("RPGx_OnPlayerLevel"ET_IGNOREFP_CELLFP_CELL);
    
g_fwPlayerDeath CreateMultiForward("RPGx_OnPlayerDeath"ET_IGNOREFP_CELLFP_CELLFP_CELL);
    
g_fwPlayerHurt CreateMultiForward("RPGx_OnPlayerHurt"ET_IGNOREFP_CELLFP_CELLFP_CELLFP_CELL);
    
    
register_clcmd("say rpgmenu""RPGx_ShowMainMenu");
    
register_clcmd("say /rpgmenu""RPGx_ShowMainMenu");
    
    
register_message(get_user_msgid("TextMsg"), "OnEvent_TextMsg");
    
    
register_dictionary("rpgx.txt");
    
    
RegisterHam(Ham_Spawn"player""OnPlayerEvent_Spawn"1);
    }

public 
plugin_cfg(){
    static 
szConfigDir[64];
    
get_configsdir(szConfigDir63);
    
server_cmd("exec %s/rpgx/rpgx.cfg"szConfigDir);
    
    
ExecuteForward(g_fwPluginReadyg_fwLastResult);
    }

public 
plugin_natives(){
    
register_native("RPGx_MakeUpgrade""Native_MakeUpgrade"1);    
    
register_native("RPGx_GetUpgradeLevel""Native_GetUpgradeLevel"1);
    
register_native("RPGx_GetUpgradeMaxLevel""Native_GetUpgradeMaxLevel"1);
    
register_native("RPGx_Freeze""Native_Freeze"1);
    
register_native("RPGx_IsFrozen""Native_IsFrozen"1);
    
register_native("RPGx_GetXP""Native_GetXP"1);
    
register_native("RPGx_GetLevel""Native_GetLevel"1);
    
register_native("RPGx_GetCredits""Native_GetCredits"1);
    
register_native("RPGx_SetSpawnHealth""Native_SetSpawnHealth"1);
    
register_native("RPGx_GetSpawnHealth""Native_GetSpawnHealth"1);
    }

public 
plugin_precache(){
    
precache_sound("rpgx/levelup.wav");
    
precache_sound("rpgx/reset_stats.wav");
    
precache_sound("rpgx/upgrade_purchase.wav");
    
precache_sound("rpgx/upgrade_sell.wav");
    
precache_sound("rpgx/upgrade_error.wav");
    
precache_sound("rpgx/menu_select.wav");
    
precache_sound("rpgx/menu_exit.wav");
    }

#if SAVABLE
public plugin_end(){
    
#if _VAULT
    
nvault_close(g_hVault);
    
#endif
    #if _SQL
    
SQL_FreeHandle(g_hSQLTuple);
    
#endif
    
}

public 
client_disconnect(id)
    
RPGx_Save(id);

public 
RPGx_Save(id){
    new 
szAuthId[64], data[129], upgrade[5];
    
get_user_authid(idszAuthId63);
    
    for(new 
i;i<g_iUpgrades;i++){
        
formatex(upgrade4"%i "g_iUpgrade_Level[id][i]);
        
add(data128upgrade);
        }
    
    
#if _VAULT
    
new key[72], stats[34];
    
formatex(key71"%s-stats"szAuthId);
    
formatex(stats33"%i %i %i"g_iLevel[id], g_iXP[id], g_iCredits[id]);
    
nvault_set(g_hVaultkeystats);
    
nvault_set(g_hVaultszAuthIddata);
    
#endif
    #if _SQL
    
new szQuery[129];
    
formatex(szQuery128"REPLACE INTO `%s` VALUES ('%s', %d, %d, %d, '%s');"g_szSQLTableszAuthIdg_iLevel[id], g_iXP[id], g_iCredits[id], data);
    
SQL_ThreadQuery(g_hSQLTuple"RPGx_HandleSQL"szQuery);
    
#endif
    
}

public 
RPGx_Load(id){
    new 
szAuthId[64], data[129];
    
get_user_authid(idszAuthId63);
    
    
#if _VAULT
    
new key[72], stats[34], stat[3][12];
    
formatex(key71"%s-stats"szAuthId);
    
    
nvault_get(g_hVaultkeystats33);
    
    
parse(statsstat[0], 11stat[1], 11stat[2], 11);
    
    
g_iLevel[id] = str_to_num(stat[0]);
    
g_iXP[id] = str_to_num(stat[1]);
    
g_iCredits[id] = str_to_num(stat[2]);
    
    if(!
g_iCredits[id])
        
g_iCredits[id] = get_pcvar_num(g_pCreditsStart);
    
    
nvault_get(g_hVaultszAuthIddata128);
    
LoadUserUpgradeStats(iddata);
    
    
ExecuteForward(g_fwPluginAuthg_fwLastResultid);
    
#else
        #if _SQL
        
new szQuery[129];
        
num_to_str(iddata2);
        
formatex(szQuery128"SELECT * FROM `%s` WHERE authid = '%s';"g_szSQLTableszAuthId);
        
SQL_ThreadQuery(g_hSQLTuple"RPGx_HandleSQL"szQuerydata3);
        
#endif
    #endif
    
}

#if _SQL
public RPGx_HandleSQL(failstateHandle:queryerror[], errnumdata[], sizeFloat:queuetime){
    if(
SQL_NumResults(query)){
        new 
id str_to_num(data);
        
g_iLevel[id] = SQL_ReadResult(query1);
        
g_iXP[id] = SQL_ReadResult(query2);
        
g_iCredits[id] = SQL_ReadResult(query3);
        
        static 
stats[129];
        
SQL_ReadResult(query4stats128);
        
        
LoadUserUpgradeStats(idstats);
        
        
ExecuteForward(g_fwPluginAuthg_fwLastResultid);
        }
    }
#endif

LoadUserUpgradeStats(iddata[]){
    if(
equal(data""))
        return;
    new 
upgradelevel[6], remover[6], i;
    
parse(dataupgradelevel5);
    
formatex(remover5upgradelevel);
    while(
replace(data128remover"")){
        
g_iUpgrade_Level[id][i++] = str_to_num(upgradelevel);
        
parse(dataupgradelevel5);
        
formatex(remover5upgradelevel);
        }
    
g_iUpgrade_Level[id][i] = str_to_num(upgradelevel);
    for(new 
x;x<g_iUpgrades;x++){
        if(
g_iUpgrade_Level[id][x] > g_iUpgrade_Info[x][0])
            
g_iUpgrade_Level[id][x] = g_iUpgrade_Info[x][0];
        }
    }
#endif

public client_authorized(id){
    
g_iCredits[id] = get_pcvar_num(g_pCreditsStart);
    
g_iLevel[id] = 0;
    
g_iXP[id] = 0;
    
g_iSpawnHealth[id] = 100;
    
arrayset(g_iUpgrade_Level[id], 0g_iUpgrades);
    
#if SAVABLE
    
RPGx_Load(id);
    
#else
    
ExecuteForward(g_fwPluginAuthg_fwLastResultid);
    
#endif
    
}

public 
OnPlayerEvent_Spawn(id){
    if(
is_user_alive(id)){
        
client_print(idprint_chat"%L"id"rpgx_running");
        
set_user_health(idg_iSpawnHealth[id]);
        
ExecuteForward(g_fwPlayerSpawng_fwLastResultid);
        }
    }

public 
OnEvent_TextMsg(){
    static 
szTextMsg[16];
    
get_msg_arg_string(2szTextMsg15);
    
    static 
players[32], numplayer;
    
    if(
equal(szTextMsg"#Terrorists_Win")){
        
get_players(playersnum"e""TERRORIST");
        for(new 
i;i<num;i++){
            
player players[i];
            
g_iXP[player] += floatround(required_xp(player) * get_pcvar_float(g_pXPTeamWin));
            
RPGx_CheckXP(player);
            }
        }
    if(
equal(szTextMsg"#CTs_Win")){
        
get_players(playersnum"e""CT");
        for(new 
i;i<num;i++){
            
player players[i];
            
g_iXP[player] += floatround(required_xp(player) * get_pcvar_float(g_pXPTeamWin));
            
RPGx_CheckXP(player);
            }
        }
    }

public 
client_damage(attackervictimdamagewpnindexhitplaceTA){
    if(!
TA){
        
g_iXP[attacker] += floatround(damage get_pcvar_float(wpnindex == CSW_KNIFE?g_pXPKnifeDmg:g_pXPDamage));
        
RPGx_CheckXP(attacker);
        }
    
ExecuteForward(g_fwPlayerHurtg_fwLastResultvictimattackerdamagewpnindex);
    }

public 
client_death(killervictimwpnindexhitplaceTK){
    new 
headshot hitplace==HIT_HEAD?1:0;
    if(!
TK){
        
g_iXP[killer] += get_pcvar_num(g_pXPKill) + headshot?get_pcvar_num(g_pXPHeadshot):0;
        
RPGx_CheckXP(killer);
        }
    
ExecuteForward(g_fwPlayerDeathg_fwLastResultvictimkillerheadshot);
    }

public 
bomb_defused(defuser){
    
g_iXP[defuser] += floatround(required_xp(defuser) * get_pcvar_float(g_pXPBombDefuse));
    
RPGx_CheckXP(defuser);
    }

public 
bomb_planted(planter){
    
g_iXP[planter] += floatround(required_xp(planter) * get_pcvar_float(g_pXPBombPlant));
    
RPGx_CheckXP(planter);
    }

public 
bomb_explode(planterdefuser){
    static 
players[32], numplayer;
    
get_players(playersnum"e""TERRORIST");
    for(new 
i;i<num;i++){
        
player players[i];
        
g_iXP[player] += floatround(required_xp(player) * get_pcvar_float(g_pXPBombExplode));
        
RPGx_CheckXP(player);
        }
    
g_iXP[planter] += floatround(required_xp(planter) * get_pcvar_float(g_pXPBombPlant));
    
RPGx_CheckXP(planter);
    
g_iXP[defuser]++;
    
RPGx_CheckXP(defuser);
    }

public 
RPGx_CheckXP(id){
    new 
XP g_iXP[id];
    if(
XP >= required_xp(id)){
        new 
MaxXP get_pcvar_num(g_pXPMax);
        if(
MaxXP && XP >= MaxXP)
            return;
        
g_iXP[id] -= required_xp(id);
        
g_iLevel[id]++;
        
g_iCredits[id] += get_pcvar_num(g_pCreditsInc);
        
        if(
get_pcvar_num(g_pXPNotice)){
            static 
szName[32];
            
get_user_name(idszName31);
            
client_print(0print_chat"%L"LANG_PLAYER"rpgx_stats_levelup"szNameg_iLevel[id]);
            }
        
        
client_print(idprint_chat"%L"id"rpgx_notice_newcredits"g_iCredits[id]);
        
        
PlaySound(id"levelup");
        
ExecuteForward(g_fwPlayerLevelUpg_fwLastResultidg_iLevel[id]);
        }
    }

public 
Native_MakeUpgrade(const name[], maxlevelcosticost){
    if(
g_iUpgrades MAX_UPGRADES){
        
param_convert(1);
        
formatex(g_szUpgrade_Name[g_iUpgrades], 63name);
        
g_iUpgrade_Info[g_iUpgrades][0] = maxlevel;
        
g_iUpgrade_Info[g_iUpgrades][1] = cost;
        
g_iUpgrade_Info[g_iUpgrades][2] = icost;
        
g_iUpgrades++;
        return 
g_iUpgrades-1;
        }
    return -
1;
    }

public 
Native_GetUpgradeLevel(playerupgrade)
    return 
g_iUpgrade_Level[player][upgrade];

public 
Native_GetUpgradeMaxLevel(upgrade)
    return 
g_iUpgrade_Info[upgrade][0];

public 
Native_Freeze(playerbool:freeze){
    
g_bIsFrozen[player] = freeze;
    
set_user_maxspeed(playerfreeze?10.0:240.0);
    
set_user_rendering(playerfreeze?kRenderFxGlowShell:kRenderFxNone00255kRenderNormal25);
    }

public 
Native_IsFrozen(player)
    return 
g_bIsFrozen[player];

public 
Native_GetXP(player)
    return 
g_iXP[player];

public 
Native_GetLevel(player)
    return 
g_iLevel[player];

public 
Native_GetCredits(player)
    return 
g_iCredits[player];

public 
Native_SetSpawnHealth(playerhealth)
    
g_iSpawnHealth[player] = health;

public 
Native_GetSpawnHealth(player)
    return 
g_iSpawnHealth[player];

public 
RPGx_ShowMainMenu(id){
    new 
menu menu_create("Main Menu""HandleMainMenu");
    
    
menu_additem(menu"Purchase Upgrades");
    
menu_additem(menu"Sell Upgrades");
    
menu_additem(menu"View Stats");
    
menu_additem(menu"About RPGx");
    
    
menu_setprop(menuMPROP_EXITMEXIT_NORMAL);
    
    
menu_display(idmenu);
    return 
PLUGIN_HANDLED;
    }

public 
HandleMainMenu(idmenuitem){
    
PlaySound(iditem != MENU_EXIT?"menu_select":"menu_exit");
    switch(
item){
        case 
0:PurchaseMenu(id);
        case 
1:SellMenu(id);
        case 
2:StatsMenu(id);
        case 
3:AboutRPGx(id);
        }
    
menu_destroy(menu);
    }

public 
PurchaseMenu(id){
    static 
szTempStr[86], szTitle[64], iLevel;
    
formatex(szTitle63"Upgrade Shop - Purchase [Cr: %i]"g_iCredits[id]);
    new 
menu menu_create(szTitle"HandlePurchaseMenu");
    
    for(new 
i;i<g_iUpgrades;i++){
        
iLevel g_iUpgrade_Level[id][i];
        
formatex(szTempStr85"%s Level %i [Cost: %i]"g_szUpgrade_Name[i], iLevel 1g_iUpgrade_Info[i][1] + (iLevel g_iUpgrade_Info[i][2]));
        
menu_additem(menuszTempStr);
        }
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
    if(
g_iUpgrades)
        
menu_display(idmenu);
        else {
        
menu_destroy(menu);
        
client_print(idprint_chat"%L"id"rpgx_error_noupgrades");
        }
    }

public 
HandlePurchaseMenu(idmenuitem){
    if(
item MENU_EXIT){
        new 
iCost g_iUpgrade_Info[item][1] + (g_iUpgrade_Level[id][item] * g_iUpgrade_Info[item][2]);
        if(
g_iCredits[id] >= iCost){
            if(
g_iUpgrade_Level[id][item] < g_iUpgrade_Info[item][0]){
                
g_iCredits[id] -= iCost;
                
ExecuteForward(g_fwPluginUpgradePurchaseg_fwLastResultiditem, ++g_iUpgrade_Level[id][item]);
                
client_print(idprint_chat"%L"id"rpgx_shop_buy_success"g_szUpgrade_Name[item], g_iUpgrade_Level[id][item]);
                
PurchaseMenu(id);
                
PlaySound(id"upgrade_purchase");
                } else {
                
client_print(idprint_chat"%L"id"rpgx_shop_buy_error_maxlevel");
                
PurchaseMenu(id);
                
PlaySound(id"upgrade_error");
                }
            } else {
            
client_print(idprint_chat"%L"id"rpgx_shop_buy_error_insufficient");
            
PurchaseMenu(id);
            
PlaySound(id"upgrade_error");
            }
        } else
        
PlaySound(iditem != MENU_EXIT?"menu_select":"menu_exit");
    
menu_destroy(menu);
    }

public 
SellMenu(id){
    static 
szTempStr[86], szTitle[64], iLevel;
    
formatex(szTitle63"Upgrade Shop - Sell [Cr: %i]"g_iCredits[id]);
    new 
menu menu_create(szTitle"HandleSellMenu");
    
    for(new 
i;i<g_iUpgrades;i++){
        
iLevel g_iUpgrade_Level[id][i];
        
formatex(szTempStr85"%s Level %i [Credit: %i]"g_szUpgrade_Name[i], iLevelfloatround((iLevel g_iUpgrade_Info[i][2]) * get_pcvar_float(g_pCreditsSellPct)));
        
menu_additem(menuszTempStr);
        }
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
    if(
g_iUpgrades)
        
menu_display(idmenu);
        else {
        
menu_destroy(menu);
        
client_print(idprint_chat"%L"id"rpgx_error_noupgrades");
        }
    }

public 
HandleSellMenu(idmenuitem){
    if(
item MENU_EXIT){
        if(
g_iUpgrade_Level[id][item] > 0){
            
g_iCredits[id] += floatround((g_iUpgrade_Level[id][item] * g_iUpgrade_Info[item][2]) * get_pcvar_float(g_pCreditsSellPct));
            
ExecuteForward(g_fwPluginUpgradeSellg_fwLastResultiditem, --g_iUpgrade_Level[id][item]);
            
client_print(idprint_chat"%L"id"rpgx_shop_sell_success"g_szUpgrade_Name[item], g_iUpgrade_Level[id][item]+1);
            
SellMenu(id);
            
PlaySound(id"upgrade_sell");
            } else {
            
client_print(idprint_chat"%L"id"rpgx_shop_error_notpurchased");
            
SellMenu(id);
            
PlaySound(id"upgrade_error");
            }
        } else
        
PlaySound(iditem != MENU_EXIT?"menu_select":"menu_exit");
    
menu_destroy(menu);
    }

public 
StatsMenu(id){
    static 
szTempStr[32];
    new 
menu menu_create("Current Stats""HandleStatsMenu");
    
menu_additem(menu"Reset Stats");
    
    
menu_addblank(menu);
    
    
formatex(szTempStr31"Level: %i"g_iLevel[id]);
    
menu_addtext(menuszTempStr);
    
    
formatex(szTempStr31"Credits: %i"g_iCredits[id]);
    
menu_addtext(menuszTempStr);
    
    
formatex(szTempStr31"XP: %i/%i"g_iXP[id], required_xp(id));
    
menu_addtext(menuszTempStr);
    
    
menu_setprop(menuMPROP_EXITMEXIT_NORMAL);
    
    
menu_display(idmenu);
    }

public 
HandleStatsMenu(idmenuitem){
    
PlaySound(iditem != MENU_EXIT?"menu_select":"menu_exit");
    if(
item == 0){
        new 
menu2 menu_create("Reset Stats?""HandleConfirmReset");
        
        
menu_additem(menu2"Yes");
        
menu_additem(menu2"No");
        
        
menu_display(idmenu2);
        }
    
menu_destroy(menu);
    }

public 
HandleConfirmReset(idmenuitem){
    if(
item == 0){
        
g_iCredits[id] = get_pcvar_num(g_pCreditsStart);
        
g_iLevel[id] = 0;
        
g_iXP[id] = 0;
        
g_iSpawnHealth[id] = 100;
        
arrayset(g_iUpgrade_Level[id], 0g_iUpgrades);
        
client_print(idprint_chat"%L"id"rpgx_stats_reset");
        
PlaySound(id"reset_stats");
        }
    if(
item == 1)
        
StatsMenu(id);
    
menu_destroy(menu);
    }

public 
AboutRPGx(id){
    new 
menu menu_create("About RPGx""AboutHandler");
    
    
menu_additem(menu"Back to Main Menu");
    
    
menu_addblank(menu);
    
    
menu_addtext(menu"Author: roflmao456");
    
menu_addtext(menu"Website: www.zombiesonweed.com");
    
    
menu_addblank(menu);
    
    
menu_addtext(menu"Inspired by RPGx 1.1.3 by sumguy14 for CS:S.");
    
    
menu_display(idmenu);
    }

public 
AboutHandler(idmenuitem){
    if(
item == 0)
        
RPGx_ShowMainMenu(id);
    
menu_destroy(menu);
    } 
lauliu is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 08-17-2010 , 00:04   Re: Cannot save by player name
Reply With Quote #2

Well, by searching "authid" you can find most codes that use that... and replace them with name, IP, or whatever.

Still, steamid is verry reliable for saving player-data stuff... if you use a steam only server.
__________________
Hunter-Digital is offline
lauliu
Member
Join Date: Jun 2009
Old 08-17-2010 , 00:15   Re: Cannot save by player name
Reply With Quote #3

Because of some player said they have same steam id with 2 different players.
So Player Name is better for this case

so szName is not use to save data by player name ?

please advise
lauliu is offline
lauliu
Member
Join Date: Jun 2009
Old 08-17-2010 , 01:48   Re: Cannot save by player name
Reply With Quote #4

[Solved] thanks for your advise
lauliu 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 22:02.


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