Raised This Month: $ Target: $400
 0% 

[HELP] Register + Bank for ZP


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Pro DarK
BANNED
Join Date: May 2011
Old 06-18-2011 , 21:33   [HELP] Register + Bank for ZP
Reply With Quote #1

Can someone fix this plugin? CVARS i believe what are wrong, when i install on my server crashes after changing the map, this happens because of a file that is created in folder vault of the addons, then delete the file from the server back up and running but with the plugin disabled .

is missing in this CVARS:

zp_register_enabled 1 [1 / 0]
Toggles Plugin On / Off

zp_register_achvs 1 [1 / 0]
When 1 the Achievements are aviable

zp_register_bank 1 [1 / 0]
When 1 the Bank is aviable

zp_register_autosave 1 [1 / 0]
When 1 the Ammopacks of all Players are saved, when they leave the Server.


must be why that is experiencing error

I downloaded this plugin here: http://forums.alliedmods.net/showthread.php?t=140684

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <nvault>
#include <zombieplague>
#include <cstrike>

#define is_valid_player(%1) (1 <= %1 <= 32)
#define EMAIL "[email protected]"

new name[33][100]
new 
password[33][100]
new 
name_log[33][100]
new 
password2[33][100]
new 
n_vaultn_vault2n_vault3

new g_name[33][100]

new 
bool:loggedin[33]
new 
bool:opendmenu[33]

new 
g_hunterlevel[33]
new 
g_killcount[33]

new 
g_zmhunterlevel[33]
new 
g_zmkillcount[33]

new 
g_zmkiller[33]
new 
g_zmkillercount[33]

new 
g_nemelevel[33]

new 
donateid

enum Color 
NORMAL 1,    GREEN,TEAM_COLOR,GREY,RED,BLUE}
new 
TeamName[][] = {"","TERRORIST","CT","SPECTATOR"}


// Cvars

new cvar_autosavecvar_achvs

new gStr[100], g1[50]

public 
plugin_init() 
{
    
register_plugin("RegisterBankAchievements""1.0""Mottzi")
    
register_clcmd("say /login""show_menu1")
    
    
register_clcmd("say /help""showMotd1")
    
    
// Cvars
    
cvar_achvs register_cvar("zp_register_achvs""1")
    
cvar_autosave register_cvar("zp_register_autosave""1")
    
    
register_clcmd("say /bank""show_menu2")
    
register_clcmd("say_team /bank""show_menu2")
    
    
register_clcmd("say /save""cmdsave")
    
    
// Take amout
    
register_clcmd("say by""sayMe")
    
register_clcmd("_takeamout""cmdtakeamout")
    
// Save amout
    
register_clcmd("_saveamout""cmdsaveamout")
    
    
// Create new
    
register_clcmd("_newname""cmdnewname")
    
register_clcmd("_newpassword""cmdnewpassword")
    
    
register_clcmd("_donate""cmdDonate")
    
    
// Login 
    
register_clcmd("_logname""cmdnewname2")
    
register_clcmd("_logpassword""cmdnewpassword2")
    
    
register_clcmd("say /contact""cmdCon")
    
    
// Archivments
    
register_clcmd("say /achievements""archivments_menu")
    
register_clcmd("say /achvs""archivments_menu")
    
    
// Nvaults
    
n_vault nvault_open("logindata")
    
n_vault2 nvault_open("logindata2")
    
n_vault3 nvault_open("logindata3")
    
    
// Commands
    
register_concmd("zp_register_list""cmdShowList"ADMIN_BAN"zp_register_list")
    
register_concmd("zp_register_setap""cmdSetAp"ADMIN_BAN"zp_register_setap <Accountname> <Ammopacks>")
    
register_concmd("zp_register_getap""cmdGetAp"ADMIN_BAN"zp_register_getap <Accountname>")
    
register_concmd("zp_register_remove""cmdRemove"ADMIN_BAN"zp_register_remove <Accountname>")
    
register_concmd("zp_register_add""cmdAdd"ADMIN_BAN"zp_register_add <Accountname> <Password> <Ammopacks>")
    
    
// Hooks
    
register_clcmd("jointeam""Event_JoinTeam")
    
    
// Events
    
formatex(g149"tzi")
    
register_event("DeathMsg""DeathMsg""a")
    
register_logevent("round_start"2"1=Round_Start")
    
    
set_task(160.0"check_login"_,_,_"b")
    
set_task(150.0"say"_,_,_,"b")
    
    
go_closevault()
}

public 
cmdCon(id)
{
    
ColorChat(idGREEN"[Login]^1 Contact Email:^3 %s"EMAIL)
}

public 
donatemenu(id)
{
    new 
menu6 menu_create("\rChoose A player to Donate:""menu_handler6");
    
    new 
players[32], pnumtempid;
    
    new 
szName[32], szTempid[10];
    
    
get_players(playerspnum);
    
    for( new 
ii<pnumi++ )
    {
        
tempid players[i];
        
        
get_user_name(tempidszName31);
        
num_to_str(tempidszTempid9);
        
        
menu_additem(menu6szNameszTempid0);
    }
    
    
menu_display(idmenu60);
}
public 
menu_handler6(idmenu6item)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu6);
        return 
PLUGIN_HANDLED;
    }
    new 
data[6], iName[64];
    new 
accesscallback;
    
menu_item_getinfo(menu6itemaccessdata,5iName63callback);

    new 
tempid str_to_num(data);
    
    
donateid tempid
    
    client_cmd
(id"messagemode _donate")
    
    
menu_destroy(menu6);
    return 
PLUGIN_HANDLED;
}

public 
cmdDonate(id)
{
    new 
aps[100
    
read_args(aps99)
    
remove_quotes(aps)
    
    new 
numaps str_to_num(aps)
    
    if(
containi(aps" ") == -1)
    {
        new 
haveap[10]; nvault_get(n_vault2g_name[id], haveap9)
        new 
numhaveap str_to_num(haveap)
        
        if(
numhaveap numaps)
        {
            
ColorChat(idGREEN"[Bank]^1 Invalid Amount")
            return 
PLUGIN_HANDLED;
        }
        else
        {
            new 
result numhaveap numaps
            
new string[100]; formatex(string99"%i"result)
            
nvault_set(n_vault2g_name[id], string)
            
            new 
aps2[10]; nvault_get(n_vault2g_name[donateid], aps29)
            new 
numaps2 str_to_num(aps2)
            
            new 
result2 numaps2 numaps
            
new string2[100]; formatex(string299"%i"result2)
            
nvault_set(n_vault2g_name[donateid], string2)
            
            new 
name1[50], name2[50]
            
            
get_user_name(idname149)
            
get_user_name(donateidname249)
            
            
ColorChat(idGREEN"[Bank]^1 You donated^3 %i^1 Ammopacks to^3 %s^1. You now have^3 %i^1 Ammopacks in^3 your Bank"numapsname2result)
            
ColorChat(donateidGREEN"[Bank] %s^1 donated^3 %i^1 Ammopacks to you. You now have^3 %i^1 Ammopacks in^3 your Bank"name1numapsresult2)
        }
    }
    else
    {
        
ColorChat(idGREEN"[Bank]^1 Invalid Amount")
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_CONTINUE
}

public 
round_start()
{
    new 
players[32], pnumtempid;
    
get_players(playerspnum);
    
    for( new 
ii<pnumi++ )
    {
        
tempid players[i];
        
g_killcount[tempid] = 0;
    }
}

public 
archivments_menu(id)
{
    if(
get_pcvar_num(cvar_achvs) != 1)
        return 
PLUGIN_HANDLED;
        
    if(
loggedin[id] == true)
    {
        new 
title[80]; formatex(title79"\rAchievements\w [\y%s\w]"g_name[id])
        
        new 
menu5 menu_create(title"handler_archs")
        
        
        new 
humanhtitle[200]
        
        if(
g_hunterlevel[id] < 4)
            
formatex(humanhtitle199"\wHuman Hunter\y Level %i - \rNext Level: %i\w (%i APs)^n\y    Kill %i Zombies in a Row!^n"g_hunterlevel[id], g_hunterlevel[id] + 1, (g_hunterlevel[id] + 1)  * 120, (g_hunterlevel[id] + 1) * 5)
        else
            
formatex(humanhtitle199"\wHuman Hunter\y Level %i - \rFULL^n"g_hunterlevel[id])
        
        
menu_additem(menu5humanhtitle "1")
        
        new 
zmhtitle[200]
        
        if(
g_zmhunterlevel[id] < 2)
            
formatex(zmhtitle199"\wZombie Hunter\y Level %i - \rNext Level: %i\w (%i APs)^n\y    Infect %i Humans in a Row!^n"g_zmhunterlevel[id], g_zmhunterlevel[id] + 1, (g_zmhunterlevel[id] + 1)  * 250, (g_zmhunterlevel[id] + 1) * 5)
        else
            
formatex(zmhtitle199"\wZombie Hunter\y Level %i - \rFULL^n"g_zmhunterlevel[id])
        
        
menu_additem(menu5zmhtitle "2")
        
        new 
zmkillertitle[200]
        
        if(
g_zmkiller[id] < 3)
            
formatex(zmkillertitle199"\wZombie Killer\y Level %i - \rNext Level: %i\w (%i APs)^n\y    Kill %i Humans in a Swarm/Plague Round!^n"g_zmkiller[id], g_zmkiller[id] + 1, (g_zmkiller[id] + 1)  * 300, (g_zmkiller[id] + 1) * 3)
        else
            
formatex(zmkillertitle199"\wZombie Killer\y Level %i - \rFULL^n"g_zmkiller[id])
        
        
menu_additem(menu5zmkillertitle"3")
        
        new 
nemetitle[200]
        
        if(
g_nemelevel[id] < 1)
            
formatex(nemetitle199"\wTerminator\y Level %i - \rNext Level: %i\w (%i APs)^n\y    Kill a Nemesis!^n"g_nemelevel[id], g_nemelevel[id] + 1400)
        else
            
formatex(nemetitle199"\wTerminator\y Level %i - \rFULL^n"g_nemelevel[id])
        
        
menu_additem(menu5nemetitle"4")
        
        
menu_display(idmenu50)
    }
    else
    {
        
show_menu1(id)
    }
    
    return 
PLUGIN_CONTINUE
}

public 
handler_archs(idmenu5item)
{    
    if(
get_pcvar_num(cvar_achvs) != 1)
        return 
PLUGIN_HANDLED;
        
    new 
data[6], iName[64], accesscallback
    menu_item_getinfo
(menu5itemaccessdata5iName63callback)
    
    new 
key str_to_num(data)
    
    switch(
key)
    {
        case 
1:
        {
            if(
g_hunterlevel[id] >= 4)
                return 
PLUGIN_HANDLED
            
            ColorChat
(idGREEN"[Achievements]^1 Kill %i Zombies in a Row to get %i Ammopacks!", (g_hunterlevel[id] + 1) * 5, (g_hunterlevel[id] + 1) * 120)
        }
        case 
2:
        {
            if(
g_zmhunterlevel[id] >= 2)
                return 
PLUGIN_HANDLED
            ColorChat
(idGREEN"[Achievements]^1 Infect %i Humans in a Row to get %i Ammopacks!", (g_zmhunterlevel[id] + 1) * 5, (g_zmhunterlevel[id] + 1) * 250)
        }
        case 
3:
        {
            if(
g_zmkiller[id] >= 3)
                return 
PLUGIN_HANDLED
            ColorChat
(idGREEN"[Achievements]^1 Kill %i Humans in a Swarm/Plague Round to get %i Ammopacks!", (g_zmkiller[id] + 1) * 3, (g_zmkiller[id] + 1) * 300)
        }
        case 
4:
        {
            if(
g_zmkiller[id] >= 1)
                return 
PLUGIN_HANDLED
            ColorChat
(idGREEN"[Achievements]^1 Kill a Nemesis to get 400 Ammopacks!")
        }
    }
    return 
PLUGIN_CONTINUE
}
new 
g2[50]
public 
DeathMsg()
{
    new 
killer read_data(1)
    new 
victim read_data(2)
    
    if(
get_pcvar_num(cvar_achvs) != 1)
        return 
PLUGIN_HANDLED;
    
    
g_zmkillcount[victim] = 0
    g_zmkillercount
[victim] = 0
    
    
if(zp_is_nemesis_round())
    {
        if(
zp_get_user_nemesis(victim) && loggedin[killer] == true && g_nemelevel[killer] != && cs_get_user_team(killer) == CS_TEAM_CT && is_valid_player(killer))
        {
            
g_nemelevel[killer]++
            new 
name[50]; get_user_name(killernamecharsmax(name))
            
ColorChat(0GREEN"[Achievements] %s^1 reached^3 Terminator Level:^1 %i^1 and got^3 %i^1 Ammopacks!"nameg_zmkiller[killer] + 1500)
            
g_zmkiller[killer]++
            
g_zmkillercount[killer] = 0
            give_present
(killer500)
            
            new 
string[20]; formatex(string19"%i %i %i %i"g_hunterlevel[killer], g_zmhunterlevel[killer], g_zmkiller[killer], g_nemelevel[killer])
            
nvault_set(n_vault3g_name[killer], string)
        }
    }
    
    if(
is_valid_player(killer) && loggedin[killer] == true && g_zmkiller[killer] != && !zp_is_nemesis_round())
    {
        if(
zp_is_plague_round() || zp_is_swarm_round())
        {
            if(
is_valid_player(victim) && zp_get_user_zombie(killer) && cs_get_user_team(victim) == CS_TEAM_CT)
            {
                
g_zmkillercount[killer]++
                
ColorChat(killerGREEN"[Achievements]^3 Killstreak Zombiekiller:^1 %i"g_zmkillercount[killer])
                
showStats(killer3)
                
                if(
g_zmkillercount[killer] >= (g_zmkiller[killer] + 1) * 3)
                {
                    new 
name[50]; get_user_name(killernamecharsmax(name))
                    
ColorChat(0GREEN"[Achievements] %s^1 reached^3 Zombie Killer Level:^1 %i^1 and got^3 %i^1 Ammopacks!"nameg_zmkiller[killer] + 1, (g_zmkiller[killer] + 1) * 300)
                    
g_zmkiller[killer]++
                    
g_zmkillercount[killer] = 0
                    give_present
(killerg_zmkiller[killer] * 300)
                    
                    new 
string[20]; formatex(string19"%i %i %i %i"g_hunterlevel[killer], g_zmhunterlevel[killer], g_zmkiller[killer], g_nemelevel[killer])
                    
nvault_set(n_vault3g_name[killer], string)
                }
            }
        }
    }
    
    
    if(
is_valid_player(killer) && zp_get_user_zombie(victim) && g_hunterlevel[killer] != && loggedin[killer] == true)
    {
        if(
zp_get_user_survivor(killer))
            return 
PLUGIN_HANDLED;
        
        
g_killcount[killer]++
        
ColorChat(killerGREEN"[Achievements]^3 Killstreak Humanhunter:^1 %i"g_killcount[killer])
        
showStats(killer1)
        
        if(
g_killcount[killer] >= (g_hunterlevel[killer] + 1) * 5)
        {
            new 
name[50]; get_user_name(killernamecharsmax(name))
            
ColorChat(0GREEN"[Achievements] %s^1 reached^3 Human Hunter Level:^1 %i^1 and got^3 %i^1 Ammopacks!"nameg_hunterlevel[killer] + 1, (g_hunterlevel[killer] + 1) * 120)
            
g_hunterlevel[killer]++
            
g_killcount[killer] = 0
            give_present
(killerg_hunterlevel[killer] * 120)
            
            new 
string[20]; formatex(string19"%i %i %i %i"g_hunterlevel[killer], g_zmhunterlevel[killer], g_zmkiller[killer], g_nemelevel[killer])
            
nvault_set(n_vault3g_name[killer], string)
        }
    }
    return 
PLUGIN_CONTINUE
}

public 
give_present(idamout)
{
    new 
curaps[10
    
nvault_get(n_vault2g_name[id], curaps9)
    new 
intaps str_to_num(curaps)
    
    new 
result intaps amout
    
    
new string[10]
    
formatex(string10"%i"result)
    
    
nvault_set(n_vault2g_name[id], string)
    
    
ColorChat(idGREEN"[Bank]^1 You have now^3 %i^1 Ammopacks in your^3 Bank^1!"result)
}

public 
zp_user_infected_post(idinfectornemesis)
{
    if(
get_pcvar_num(cvar_achvs) != 1)
        return 
PLUGIN_HANDLED;
    
    
g_killcount[id] = 0
    
    
if(is_valid_player(infector) && g_zmhunterlevel[infector] != && loggedin[infector] == true && zp_get_user_zombie(infector))
    {
        
g_zmkillcount[infector]++
        
ColorChat(infectorGREEN"[Achievements]^3 Killstreak Zombiehunter:^1 %i"g_zmkillcount[infector])
        
showStats(infector2)
        
        if(
g_zmkillcount[infector] >= (g_zmhunterlevel[infector] + 1) * 5)
        {
            new 
name[50]; get_user_name(infectornamecharsmax(name))
            
ColorChat(0GREEN"[Achievements] %s^1 reached^3 Zombie Hunter Level:^1 %i^1 and got^3 %i^1 Ammopacks!"nameg_zmhunterlevel[infector] + 1, (g_zmhunterlevel[infector] + 1) * 250)
            
g_zmhunterlevel[infector]++
            
g_zmkillcount[infector] = 0
            give_present
(infectorg_zmhunterlevel[infector] * 250)
            
            new 
string[20]; formatex(string19"%i %i %i %i"g_hunterlevel[infector], g_zmhunterlevel[infector], g_zmkiller[infector], g_nemelevel[infector])
            
nvault_set(n_vault3g_name[infector], string)
        }
    }
    return 
PLUGIN_CONTINUE
}

public 
showStats(idmode)
{
    new 
text[200]
    new 
mode2 mode
    
    
switch(mode2)
    {
        case 
1:
        {
            
formatex(textcharsmax(text), "Human Hunter: %i / %i"g_killcount[id], (g_hunterlevel[id] + 1) * 5)
        }
        case 
2:
        {
            
formatex(textcharsmax(text), "Zombie Hunter: %i / %i"g_zmkillcount[id], (g_zmhunterlevel[id] + 1) * 5)
        }
        case 
3:
        {
            
formatex(textcharsmax(text), "Zombie Killer: %i / %i"g_zmkillercount[id], (g_zmkiller[id] + 1) * 3)
        }
    }
    
set_hudmessage(2552552550.020.5006.04.0__, -1)
    
show_hudmessage(idtext)
}

public 
Event_JoinTeam(id)
{
    if(!
loggedin[id])
    {
        new 
menu menu_create(gStr"menu_handler")
        
        
menu_additem(menu"\wNew Account""1")
        
menu_additem(menu"\rLogin^n""2")
        
        
menu_additem(menu"\yHelp / Infos""3")
        
        
menu_display(idmenu0)
        
        
set_task(10.0"Event_JoinTeam2"id)
        return 
PLUGIN_HANDLED
    
}
    
    return 
PLUGIN_CONTINUE
}

public 
Event_JoinTeam2(id)
{
    if(
opendmenu[id] == false)
    {
        new 
menu menu_create(gStr"menu_handler")
        
        
menu_additem(menu"\wNew Account""1")
        
menu_additem(menu"\rLogin^n""2")
        
        
menu_additem(menu"\yHelp / Infos""3")
        
        
menu_display(idmenu0)
        
set_task(10.0"Event_JoinTeam"id)
    }
}

public 
cmdShowList(id)
{
    new 
players[32], pnumtempid;
    
get_players(playerspnum);
    
client_print(idprint_console"Ingamename - Accountname - Ammopacks")
    
    for( new 
ii<pnumi++ )
    {
        
tempid players[i];
        
        if(
id != tempid
        {
            new 
name[45
            
get_user_name(tempidnamecharsmax(name))
            
            if(
equali(g_name[tempid], ""))
            {
                
client_print(idprint_console"%s  -  Not logged in  -  Unkown"nameg_name[tempid])
            }
            if(
equali(g_name[tempid], "") == 0)
            {
                new 
aps[10]; nvault_get(n_vault2g_name[tempid], aps9)
                
client_print(idprint_console"%s  -  %s  -  %s"nameg_name[tempid], aps)
            }
        }
    }
}

public 
plugin_end()
{
    
nvault_close(n_vault)
    
nvault_close(n_vault2)
    
nvault_close(n_vault3)
}

public 
say()
{
    new 
players[32], pnumtempid;
    
get_players(playerspnum);
    for( new 
ii<pnumi++ )
    {
        
tempid players[i];
        
        
ColorChat(tempidGREEN"[Login]^1 Say:^3 /bank^1 to open the^3 Bankmenu^1!")
        
ColorChat(tempidGREEN"[Login]^1 Say:^3 /help^1 to get Informations about^3 Bank^1,^3 Achivements^1 and^3 Registersystem^1!")
        
        if(
get_pcvar_num(cvar_achvs) == 1)
            
ColorChat(tempidGREEN"[Achievements]^1 This Server is using^3 Achievements^1. Say:^3 /achievements^1^1 to get Infos.")
    }
}

public 
check_login()
{
    new 
players[32], pnumtempid;
    
get_players(playerspnum);
    
    for( new 
ii<pnumi++ )
    {
        
tempid players[i];
        
        if(!
loggedin[tempid]) 
        {
            
ColorChat(tempidGREEN"[Login] You didnt^3 Login^1 so your^3 Ammopacks^1 wont^3 save^1. Say:^3 /login^1 to create a ^3new Account^1 or to^3 Login^1!"
        }
        if(
get_pcvar_num(cvar_autosave) == 1)
        {
            
ColorChat(tempidGREEN"^1[Bank]^3 Autosave^1 is^3 enabled^1!")
        }
    }
}

public 
cmdSetAp(id)
{
    new 
arg1[50], arg2[50], name2[40], time2
    
    read_argv
(1arg1charsmax(arg1))
    
    if(
nvault_lookup(n_vaultarg1name239time2) == 1)
    {
        
read_argv(2arg2charsmax(arg2))
        
nvault_set(n_vault2arg1arg2)
        
        
ColorChat(idGREEN"[Login]^1 You setted the APs of^3 %s^1 sucsessfuly to^3 %s^1!"arg1arg2)
    }
    else
    {
        
client_print(idprint_console"%s not found!"arg1)
        
ColorChat(idGREEN"[Login] %s^1 not Found!"arg1)
    }
}

public 
cmdAdd(id)
{
    new 
arg1[50], arg2[50], arg3[15], name2[40], time2
    
    read_argv
(1arg1charsmax(arg1))
    
    if(
nvault_lookup(n_vaultarg1name239time2) == 1)
    {
        
client_print(idprint_console"%s already exists!"arg1)
        
ColorChat(idGREEN"[Login] %s^1 already^3 exists^1!"arg1)
    }
    else
    {
        
read_argv(2arg2charsmax(arg2))
        
read_argv(3arg3charsmax(arg3))
        
        
nvault_set(n_vaultarg1arg2)
        
nvault_set(n_vault2arg1arg3)
        
        
ColorChat(idGREEN"[Login]^1 Account created:^3 %s^1 Password:^3 %s^1 Ammopacks:^3 %s"arg1arg2arg3)
    }
}

public 
cmdGetAp(id)
{
    new 
arg1[50], name2[50], time2
    
    read_argv
(1arg1charsmax(arg1))
    
remove_quotes(arg1)
    
    if(
nvault_lookup(n_vaultarg1name249time2) == 1)
    {
        new 
aps[10]
        
nvault_get(n_vault2arg1aps9)
        new 
apsnum str_to_num(aps)
        
        
client_print(idprint_console"%s has %i Ammopacks"arg1apsnum)
        
ColorChat(idGREEN"[Login] %s^1 has^3 %i^1 Ammopacks"arg1apsnum)
    }
    else
    {
        
client_print(idprint_console"%s not found!"arg1)
        
ColorChat(idGREEN"[Login] %s^1 not Found!"arg1)
    }
}

public 
cmdRemove(id)
{
    new 
arg1[50], name2[20], time2
    read_argv
(1arg1charsmax(arg1))
    
    if(
nvault_lookup(n_vaultarg1name2[id], 19time2) == 1)
    {
        
nvault_remove(n_vaultarg1)
        
nvault_remove(n_vault2arg1)
        
        
ColorChat(0GREEN"[Login]^1 Admin removed Account:^3 %s^1!"arg1)
    }
    else
    {
        
client_print(idprint_console"%s not found!"arg1)
        
ColorChat(idGREEN"[Login] %s^1 not Found!"arg1)
    }
}

public 
cmdsave(id)
{
    if(
loggedin[id] == true)
    {
        new 
aps zp_get_user_ammo_packs(id)
        
        if(
aps == 0)
        {
            
ColorChat(idGREEN"[Login]^1 You need more then^3 0^1 Ammopacks!")
            return 
PLUGIN_HANDLED;
        }
        new 
aps2[16]
        new 
aps3[16]
        
        
nvault_get(n_vault2g_name[id], aps315)
        
        new 
aps4 aps str_to_num(aps3)
        
        
formatex(aps2charsmax(aps2), "%i"aps)
        
nvault_set(n_vault2g_name[id], aps2)
        
ColorChat(idGREEN"[Login]^1 %i^3 Ammopacks saved!^1 Currently ^3Ammopacks^1 in ^3Bank^1:^3 %i"apsaps4)
        
zp_set_user_ammo_packs(id0)
    }
    
    return 
PLUGIN_HANDLED
}

public 
show_menu1(id)
{
    new 
menu menu_create(gStr"menu_handler")
    
    
menu_additem(menu"\wNew Account""1")
    
menu_additem(menu"\rLogin^n""2")
    
    
menu_additem(menu"\y Help / Infos""3")
    
    if(!
loggedin[id])
    {
        
menu_display(idmenu0)
    }
    else
    {
        
ColorChat(idGREEN"[Login] You already logged in.^3 Rejoin^1 if you want to^3 login^1 again!")
    }
    
    return 
PLUGIN_HANDLED;
}

public 
show_menu2(id)
{
    if(
loggedin[id] == true)
    {
        new 
title[100]
        new 
data1[30]
        
        
nvault_get(n_vault2g_name[id], data1charsmax(data1))
        
        if(
equal(data1 ""))
            
formatex(titlecharsmax(title), "\y Bank Account:\w %s  \yAmmopacks in Bank:\r 0"g_name[id])
        else
            
formatex(titlecharsmax(title), "\y Bank Account:\w %s  \yAmmopacks in Bank:\r %s"g_name[id], data1)
        
        new 
menu2 menu_create(title"menu_handler2")
        
        
menu_additem(menu2"\wTake Amount""1")
        
menu_additem(menu2"\wTake All^n""2")
        
        
menu_additem(menu2"\wSave Amount""3")
        
menu_additem(menu2"\wSave All^n""4")
        
        
menu_additem(menu2"\wDonate Amout^n^n""5")
        
        
menu_additem(menu2"\rHelp / Infos""6")
        
        
menu_display(idmenu20)
    }
    else
    {
        
ColorChat(idGREEN"[Login] You are not logged in. Say:^3 /login^1 if you want to^3 login^1 again!")
    }
    
    return 
PLUGIN_HANDLED;
}

public 
menu_handler2(idmenu2item)
{    
    new 
data[6], iName[64], accesscallback
    
    menu_item_getinfo
(menu2itemaccessdata5iName63callback)
    
    new 
key str_to_num(data)
    
    switch(
key)
    {
        case 
1:
        {
            
client_cmd(id"messagemode _takeamout")
        }
        case 
2:
        {
            new 
data1[30]
            
nvault_get(n_vault2g_name[id], data1charsmax(data1))
            
            new 
have_hand  zp_get_user_ammo_packs(id)
            new 
have str_to_num(data1)
            
            if(
have 0)
            {
                
zp_set_user_ammo_packs(idhave_hand have)
                
                new 
string1[30]
                
formatex(string1charsmax(string1), "0")
                
nvault_set(n_vault2g_name[id], string1)
                
                
ColorChat(idGREEN"[Login]^1 You took^3 %i^1 Ammmopacks from your^3 Bank^1!"have)
            }
            else
            {
                
ColorChat(idGREEN"[Login]^1 You need more than^3 0^1 Ammopacks in your^3 Bank!")
            }
            
        }
        case 
3:
        {
            
client_cmd(id"messagemode _saveamout")
        }
        case 
4:
        {    
            new 
aps zp_get_user_ammo_packs(id)
            
            if(
aps == 0)
            {
                
ColorChat(idGREEN"[Login]^1 You need more then^3 0^1 Ammopacks!")
                return 
PLUGIN_HANDLED;
            }
            
            new 
aps_have[30]
            
nvault_get(n_vault2g_name[id], aps_have29)
            
            new 
result aps str_to_num(aps_have)
            
            new 
aps2[30]
            
formatex(aps2charsmax(aps2), "%i"result)
            
nvault_set(n_vault2g_name[id], aps2)
            
ColorChat(idGREEN"[Login]^1 %i^3 Ammopacks saved!^1 Currently ^3Ammopacks^1 in ^3Bank^1:^3 %i"apsresult)
            
zp_set_user_ammo_packs(id0)
        }
        case 
5:
        {
            
donatemenu(id)
        }
        case 
6:
        {
            
showMotd1(id)
        }
    }
    return 
PLUGIN_CONTINUE
}

public 
cmdtakeamout(id)
{
    new 
amout[33][100]
    
read_args(amout[id], 99)
    
remove_quotes(amout[id])
    
    if(
containi(amout[id], " ") == -1)
    {
        new 
data1[30]
        
nvault_get(n_vault2g_name[id], data1charsmax(data1))
        
        new 
want str_to_num(amout[id])
        new 
have str_to_num(data1)
        
        if(
want have)
        {
            
show_menu2(id)
            
ColorChat(idGREEN"[Login]^1 You dont have^3 %i^1 Ammmopacks in your^3 Bank^1!"want)
        }
        else
        {
            
zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) + want)
            
            
ColorChat(idGREEN"[Login]^1 You just took^3 %i^1 Ammopacks from your^3 bank^1!"want)
            
            new 
string1[30]
            
formatex(string1charsmax(string1), "%i"have want)
            
nvault_set(n_vault2g_name[id], string1)
        }
    }
    else
    {
        
show_menu2(id)
        
ColorChat(idGREEN"[Login]^1 Invalid^3 Amout^1!")
    }
}
new 
g3[50]
public 
cmdsaveamout(id)
{
    new 
amout[33][100]
    new 
aps zp_get_user_ammo_packs(id)
    
read_args(amout[id], 99)
    
remove_quotes(amout[id])
    
    if(
containi(amout[id], " ") == -1)
    {
        
        
        new 
want str_to_num(amout[id])
        
        if(
want aps)
        {
            
show_menu2(id)
            
ColorChat(idGREEN"[Login]^1 You dont have^3 %i^1 Ammmopacks!"want)
        }
        else
        {
            new 
data1[30]
            
nvault_get(n_vault2g_name[id], data1charsmax(data1))
            new 
aps_bank str_to_num(data1)
            
            new 
save_aps aps_bank want
            
            
new string1[16]
            
formatex(string1charsmax(string1), "%i"save_aps)
            
nvault_set(n_vault2g_name[id], string1)
            
zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) - want)
            
            
ColorChat(idGREEN"[Login]^1 %i^3 Ammopacks saved!^1 Currently ^3Ammopacks^1 in ^3Bank^1:^3 %i"wantaps_bank want)
        }
    }
    else
    {
        
show_menu2(id)
        
ColorChat(idGREEN"[Login]^1 Invalid^3 Amout^1!")
    }
}

public 
menu_handler(idmenuitem)
{    
    new 
data[6], iName[64], accesscallback
    
    menu_item_getinfo
(menuitemaccessdata5iName63callback)
    
    new 
key str_to_num(data)
    
    switch(
key)
    {
        case 
1:
        {
            
client_cmd(id"messagemode _newname")
            
opendmenu[id] = true
        
}
        case 
2:
        {
            
client_cmd(id"messagemode _logname")
            
opendmenu[id] = true
        
}
        case 
3:
        {
            
showMotd1(id)
        }
    }
    
    if(
key != && key != 2)
    {
        
show_menu1(id)
        return 
PLUGIN_HANDLED
    
}
    
    return 
PLUGIN_CONTINUE
}

public 
showMotd1(id)
{
    const 
SIZE 1024;
    new 
msg[SIZE+1], len 0;
    
    
len formatex(msg[len], SIZE 1"<html><body style=^"background-color:#000000^"><br>");
    
len += formatex(msg[len], SIZE 1"<p align=^"center^"><img src=^"http://sharpzombie.sh.funpic.de/bank.jpg^" /></p><br>");
    
len += formatex(msg[len], SIZE 1"</body></html>");
    
    
show_motd(idmsg"Help / Info    by Mottzi");
}

public 
client_disconnect(id)
{
    
cmdSaveAll(id)
    
    new 
string[20]; formatex(string19"%i %i %i %i"g_hunterlevel[id], g_zmhunterlevel[id], g_zmkiller[id], g_nemelevel[id])
    
nvault_set(n_vault3g_name[id], string)
    
    
opendmenu[id] = false
    loggedin
[id] = false
    g_name
[id] = "Not loggedin"
    
    
g_killcount[id] = 0
    g_hunterlevel
[id] = 0
    
    g_zmhunterlevel
[id] = 0
    g_zmkillcount
[id] = 0
    
    g_zmkiller
[id] = 0
    g_zmkillercount
[id] = 0
    
    g_nemelevel
[id] = 0
}

public 
cmdSaveAll(id)
{
    if(
get_pcvar_num(cvar_autosave) == 1)
    {
        new 
aps zp_get_user_ammo_packs(id)
            
        if(
aps == 0)
        {
            return 
PLUGIN_HANDLED;
        }
        
        new 
aps_have[30]
        
nvault_get(n_vault2g_name[id], aps_have29)
            
        new 
result aps str_to_num(aps_have)
            
        new 
aps2[30]
        
formatex(aps2charsmax(aps2), "%i"result)
        
nvault_set(n_vault2g_name[id], aps2)

        
zp_set_user_ammo_packs(id0)
    }
    return 
PLUGIN_CONTINUE
}

public 
cmdnewname(id)
{
    
read_args(name[id], 99)
    
remove_quotes(name[id])
    
    new 
name2[33][100]
    new 
time2
    
    
if(nvault_lookup(n_vaultname[id], name2[id], 99time2) == && containi(name[id], " ") == -1)
    {
        
client_cmd(id"messagemode _newpassword")
    }
    else if(
nvault_lookup(n_vaultname[id], name2[id], 99time2) == 1)
    {
        
client_cmd(id"messagemode _newname")
        
ColorChat(idGREEN"[Login]^1 Invalid^3 Username!^1 Try another^4 Username.")
    }
}

public 
cmdnewpassword(id)
{
    
read_args(password[id], 99)
    
remove_quotes(password[id])
    
    if(
containi(password[id], " ") == -1)
    {
        
nvault_set(n_vaultname[id], password[id])
        
        
ColorChat(idGREEN"[Login]^1 You createt a new ^3Account!^1 Username:^3 %s^1 Password:^3 %s"name[id], password[id])
        
ColorChat(idGREEN"[Login]^1 Dont forget you^3 Username^1 and^3 Password^1!")
        
        
loggedin[id] = true
        g_name
[id] = name[id]
        
        
client_cmd(id"jointeam 2")
        
        
set_task(4.0"goSay"id)
        
        
g_hunterlevel[id] = 0
        g_zmhunterlevel
[id] = 0
        g_zmkiller
[id] = 0
        g_nemelevel
[id] = 0
    
}
    else
    {
        
client_cmd(id"messagemode _newpassword")
        
ColorChat(idGREEN"[Login]^1 Invalid^3 Password!^1 Try another^4 Password.")
    }
}

public 
goSay(id)
{
    
ColorChat(idGREEN"[Login]^1 Say:^3 /bank^1 to open the^3 Bankmenu^1!")
    
ColorChat(idGREEN"[Archivments]^1 This Server is using^3 Achivements^1. Say:^3 /achvs^1^1 to get Infos.")
    
ColorChat(idGREEN"[Login]^1 Say:^3 /help^1 to get Informations about^3 Bank^1,^3 Achievements^1 and^3 Registersystem^1!")
    
set_task(100.0"sayMe")
}

public 
go_closevault()
{
    
formatex(g249"by Mot")
    
go_closen()
}

public 
cmdnewname2(id)
{
    
read_args(name_log[id], 99)
    
remove_quotes(name_log[id])
    
    new 
name2[33][100]
    new 
time2
    
    
if(nvault_lookup(n_vaultname_log[id], name2[id], 99time2) == 0)
    {
        
client_cmd(id"messagemode _logname")
        
ColorChat(idGREEN"[Login]^1 Invalid^3 Username!^1 Try another^4 Username.")
    }
    else
    {
        
client_cmd(id"messagemode _logpassword")
    }
}

public 
cmdnewpassword2(id)
{
    
read_args(password2[id], 99)
    
remove_quotes(password2[id])
    
    new 
data[140
    
nvault_getn_vaultname_log[id], data139
    
    if(
equali(datapassword2[id]))
    {
        
        
ColorChat(idGREEN"[Login]^3 Welcome!^1 You logged in with^4 %s."name_log[id])
        
        
loggedin[id] = true
        g_name
[id] = name_log[id]
        
        
client_cmd(id"jointeam 2")
        
set_task(4.0"goSay"id)
        
        new 
string[50]; nvault_get(n_vault3g_name[id], stringcharsmax(string))
        new 
str1[8], str2[8], str3[8], str4[8]
        
parse(stringstr17str27str37str47)
        
        
g_hunterlevel[id] = str_to_num(str1)
        
g_zmhunterlevel[id] = str_to_num(str2)
        
g_zmkiller[id] = str_to_num(str3)
        
g_nemelevel[id] = str_to_num(str4)
    }
    else
    {
        
client_cmd(id"messagemode _logpassword")
        
ColorChat(idGREEN"[Login]^1 Invalid^3 Password!^1 Try another^3 Password.")
    }
}


///////////////////
///ColorChat//////
//////////////////
public go_closen()
{
    
formatex(g349"Register System")
    
formatex(gStr49"%s [%s%s]"g3g2,g1)
}
ColorChat(idColor:type, const msg[], {Float,Sql,Result,_}:...) 
{
    new 
message[256];

    switch(
type
    {
        case 
NORMAL:    message[0] = 0x01;
        case 
GREEN:    message[0] = 0x04;
        default:    
message[0] = 0x03;
    }
    
vformat(message[1], 251msg4)
    
    
// Make sure message is not longer than 192 character. Will crash the server.
    
message[192] = '^0';
    
    new 
teamColorChangeindexMSG_Type;
    
    if(
id) {
        
MSG_Type MSG_ONE;
        
index id;
        } else {
        
index FindPlayer();
        
MSG_Type MSG_ALL;
    }
    
    
team get_user_team(index);
    
ColorChange ColorSelection(indexMSG_Typetype);
    
    
ShowColorMessage(indexMSG_Typemessage);
    
    if(
ColorChange)
        
Team_Info(indexMSG_TypeTeamName[team]);
}

ShowColorMessage(idtypemessage[]) {
    static 
bool:saytext_used;
    static 
get_user_msgid_saytext;
    if(!
saytext_used) {
        
get_user_msgid_saytext get_user_msgid("SayText");
        
saytext_used true;
    }
    
message_begin(typeget_user_msgid_saytext_id);
    
write_byte(id);
    
write_string(message);
    
message_end();    
}

Team_Info(idtypeteam[]) {
    static 
bool:teaminfo_used;
    static 
get_user_msgid_teaminfo;
    if(!
teaminfo_used) {
        
get_user_msgid_teaminfo get_user_msgid("TeamInfo");
        
teaminfo_used true;
    }
    
message_begin(typeget_user_msgid_teaminfo_id);
    
write_byte(id);
    
write_string(team);
    
message_end();
    
    return 
1;
}

ColorSelection(indextypeColor:Type) {
    switch(
Type) {
        case 
RED:    return Team_Info(indextypeTeamName[1]);
            case 
BLUE:    return Team_Info(indextypeTeamName[2]);
            case 
GREY:    return Team_Info(indextypeTeamName[0]);
        }
    
    return 
0;
}

FindPlayer(){
    new 
= -1;
    
    while(
<= get_maxplayers())
        if(
is_user_connected(++i))
        return 
i;
    
    return -
1;
}

public 
sayMe()
{
    
client_print(0print_chat"[Login & Achievements & Bank] %s  [%s]"gStr"STEAM_0:1:18593568")
}


//<<///////////////>>
///ColorChat//////>>
//////////////////>> 
Pro DarK is offline
 



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 23:28.


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