Raised This Month: $51 Target: $400
 12% 

Suggestion / Subplugin Request [Req] ZP Bank for ZP Mod 5.0 and SteamCMD Platform


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
oldtype
Member
Join Date: Jul 2013
Old 10-01-2013 , 10:45   [Req] ZP Bank for ZP Mod 5.0 and SteamCMD Platform
Reply With Quote #1

Hello, i'm looking for Zombie Plague Bank, that works on the new beta platform 6132 and zombie plague 5.0 mod is anyone currently using such.. ? All the banks i tried are not working..
oldtype is offline
Catastrophe
Veteran Member
Join Date: Jul 2012
Location: somewhere between narnia
Old 10-01-2013 , 10:50   Re: [Req] ZP Bank for ZP Mod 5.0 and SteamCMD Platform
Reply With Quote #2

Next time search before posting
Atleast use google if nthing
__________________
You will find everything u need :-
Catastrophe is offline
oldtype
Member
Join Date: Jul 2013
Old 10-01-2013 , 10:55   Re: [Req] ZP Bank for ZP Mod 5.0 and SteamCMD Platform
Reply With Quote #3

Both banks are not working, the last posts in those bank systems are mine, saying that they don't work.

Can you or anyone else give me bank ? I don't rly need alot options on the bank. Just when player enters and leaves the server to auto save and auto withdraw and the bank to save by SteamID and to have ammo limit.

There are alot of topics like this before mine, but i saw the all, non has helped me..

Last edited by oldtype; 10-01-2013 at 10:58.
oldtype is offline
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 10-09-2013 , 02:00   Re: [Req] ZP Bank for ZP Mod 5.0 and SteamCMD Platform
Reply With Quote #4

Do you need SQL Saving? If yes, I can post one.
__________________
Kia is offline
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 10-09-2013 , 02:46   Re: [Req] ZP Bank for ZP Mod 5.0 and SteamCMD Platform
Reply With Quote #5

Can u post with SQL since i need one with this options..
wicho is offline
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 10-09-2013 , 10:17   Re: [Req] ZP Bank for ZP Mod 5.0 and SteamCMD Platform
Reply With Quote #6

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <sqlx>
#include <zombieplague>

#define PLUGIN "Zombie Prevolution : Save Ammo Packs"
#define VERSION "1.0.0"
#define AUTHOR "Kia"

// ===============================================================================
//     Editing begins here
// ===============================================================================

// Add SQL Data here

new Host[]        = ""
new User[]        = ""
new Pass[]        = ""
new Db[]       = ""

// ===============================================================================
//     and stops here. DO NOT MODIFY BELOW UNLESS YOU KNOW WHAT YOU'RE DOING
// ===============================================================================

// ===============================================================================
//     Variables
// ===============================================================================

/* Booleans */

new bool:g_authed[33]
new 
bool:g_sql_ready false
new bool:g_loaded[33]

/* Handler */

new Handle:g_SqlConnection
new Handle:g_SqlTuple

/* Strings */

new g_Error[512]

/* Integer */

new maxplayers;

// ===============================================================================
//     plugin_init
// ===============================================================================

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
/* SQL */
    
    
maxplayers get_maxplayers()
    
set_task(0.1"MySql_Init")
}

// ===============================================================================
//     client_putinserver - Called when a player joins the Server
// ===============================================================================

public client_putinserver(id)
{
    
g_authed[id] = true
    Load_MySql
(id)
}

// ===============================================================================
//     client_disconnect - Called when a player leaves the Server
// ===============================================================================

public client_disconnect(id)
{
    
Save_MySql(id)
}

// ===============================================================================
//     SQL
// ===============================================================================

public MySql_Init()
{
    
// we tell the API that this is the information we want to connect to,
    // just not yet. basically it's like storing it in global variables
    
g_SqlTuple SQL_MakeDbTuple(Host,User,Pass,Db)
    
    
// ok, we're ready to connect
    
new ErrorCode
    g_SqlConnection 
SQL_Connect(g_SqlTuple,ErrorCode,g_Error,charsmax(g_Error))
    if(
g_SqlConnection == Empty_Handle)
    {
        
// stop the plugin with an error message
        
set_fail_state(g_Error)
    }
    
    new 
Handle:Queries
    
// we must now prepare some random queries
    
Queries SQL_PrepareQuery(g_SqlConnection,"CREATE TABLE IF NOT EXISTS zpre_ap (steamid varchar(32), name varchar(64), ap INT(11))")
    
    if(!
SQL_Execute(Queries))
    {
        
// if there were any problems
        
SQL_QueryError(Queries,g_Error,charsmax(g_Error))
        
set_fail_state(g_Error)
    }
    
    
// close the handle
    
SQL_FreeHandle(Queries)
    
    
g_sql_ready true
    
for(new i=1i<=maxplayersi++)
    {
        if(
g_authed[i])
        {
            
Load_MySql(i)
        }
    }
}

public 
Load_MySql(id)
{
    if(
g_sql_ready)
    {
        if(
g_SqlTuple == Empty_Handle)
        {
            
set_fail_state(g_Error)
        }
        
        new 
szSteamId[32], szTemp[512]
        
get_user_authid(idszSteamIdcharsmax(szSteamId))
        
        new 
Data[1]
        
Data[0] = id
        
        
//we will now select from the table `furienmoney` where the steamid match
        
format(szTemp,charsmax(szTemp),"SELECT * FROM `zpre_ap` WHERE (`zpre_ap`.`steamid` = '%s')"szSteamId)
        
SQL_ThreadQuery(g_SqlTuple,"register_client",szTemp,Data,1)
    }
}

public 
register_client(FailState,Handle:Query,Error[],Errcode,Data[],DataSize)
{
    if(
FailState == TQUERY_CONNECT_FAILED)
    {
        
log_amx("Load - Could not connect to SQL database.  [%d] %s"ErrcodeError)
    }
    else if(
FailState == TQUERY_QUERY_FAILED)
    {
        
log_amx("Load Query failed. [%d] %s"ErrcodeError)
    }
    new 
id
    id 
Data[0]
    if(
SQL_NumResults(Query) < 1)
    {
        
//.if there are no results found
        
        
new szSteamId[32], szName[32], szQuotedName[64]
        
get_user_authid(idszSteamIdcharsmax(szSteamId)) // get user's steamid
        
get_user_name(idszName31// get user's name
        
SQL_QuoteString(g_SqlConnectionszQuotedName63szName)
        
        
//  if its still pending we can't do anything with it
        
if (equal(szSteamId,"ID_PENDING"))
        {
            return 
PLUGIN_HANDLED
        
}
        
        new 
szTemp[512]
        
        
// now we will insert the values into our table.
        
format(szTemp,charsmax(szTemp),"INSERT INTO `zpre_ap` ( `steamid` , `name` , `ap`) VALUES ('%s','%s','0');",szSteamIdszQuotedName)
        
SQL_ThreadQuery(g_SqlTuple,"IgnoreHandle",szTemp)
    }
    else
    {
        
// if there are results found
        
zp_set_user_ammo_packs(idSQL_ReadResult(Query2))
    }
    
g_loaded[id] = true
    
return PLUGIN_HANDLED
}

public 
Save_MySql(id)
{
    if(
g_loaded[id])
    {
        new 
szSteamId[32], szTemp[512], szName[32], szQuotedName[64]
        
get_user_authid(idszSteamIdcharsmax(szSteamId))
        
get_user_name(idszName31)
        
SQL_QuoteString(g_SqlConnectionszQuotedName63szName)
        
        
// Here we will update the user hes information in the database where the steamid matches.
        
format(szTemp,charsmax(szTemp),"UPDATE `zpre_ap` SET `name` = '%s', `ap` = '%i'WHERE `zpre_ap`.`steamid` = '%s';",szQuotedName,zp_get_user_ammo_packs(id),szSteamId)
        
SQL_ThreadQuery(g_SqlTuple,"IgnoreHandle",szTemp)
    }
}

public 
IgnoreHandle(FailState,Handle:Query,Error[],Errcode,Data[],DataSize)
{
    
SQL_FreeHandle(Query)
    
    return 
PLUGIN_HANDLED
}

public 
plugin_end()
{
    if(
g_SqlConnection != Empty_Handle)
    {
        
SQL_FreeHandle(g_SqlConnection//free connection handle here
    
}

__________________
Kia 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 11:33.


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