Thread: [INC] Bank
View Single Post
ShawnCZek
Member
Join Date: Mar 2017
Location: Czech Republic
Old 03-20-2018 , 10:48   Re: [INC] Bank
Reply With Quote #21

So I fixed some stuff and I also added function Bank_SetBalanceSteam what is useful if you want to optimize your plugin. And I did it.
The new function is described below (adding include soubor only as code).
PHP Code:
/*
    Include file for Bank.sp
    Provide simple functions to manage a player's bank.
    
    Created by Arkarr (Alliedmodders)
*/

#if defined _bank_included
 #endinput
#endif
#define _bank_included

/**
 * Create a new bank. Can't create bank with same name at once.
 *
 * @param bankName  The name of the bank
 * @return            True on sucess, false otherwise.
 */
native bool Bank_Create(const char[] bankName)

/**
 * Add or substract a certain ammount of credits of a player's balance.
 *
 * @param bank             The name of the bank
 * @param client        The client to add/substract to.
 * @param ammount       The ammount to add/substract.
 * @param forcecreate   Create the user if not found in the bank.
 * @return            True on sucess, false otherwise.
 */
native bool Bank_EditBalance(const char[] bankint clientint ammountbool forcecreate true)

/**
 * Get the balance of a client in a specific bank.
 *
 * @param bank             The name of the bank
 * @param client    The client to get the balance of.
 * @return            The ammount of credits. -1 if no account found.
 */
native int Bank_GetBalance(const char[] bankint client)

/**
 * Set the balance of a client in a specific bank.
 *
 * @param bank             The name of the bank
 * @param client        The client to set the balance of.
 * @param ammount       The ammount to set the balance of the player. That wasn't english.
 * @param forcecreate   Create the user if not found in the bank.
 * @return            True on sucess, false otherwise.
 */
native bool Bank_SetBalance(const char[] bankint clientint ammountbool forcecreate true)

/**
 * Set the balance of a client in a specific bank.
 *
 * @param bank             The name of the bank
 * @param steamID        The client to set the balance of.
 * @param ammount       The ammount to set the balance of the player. That wasn't english.
 * @param forcecreate   Create the user if not found in the bank.
 * @return            True on sucess, false otherwise.
 */
native bool Bank_SetBalanceSteam(const char[] bank, const char[] steamIDint ammountbool forcecreate true
To fix the error I just added a few simple deletes. And it worked perfectly. The problem is the program was storing data about user over and over again and the plugin had to be shut down.
Attached Files
File Type: sp Get Plugin or Get Source (Bank.sp - 105 views - 8.8 KB)
ShawnCZek is offline