Raised This Month: $70 Target: $400
 17% 

Money System [Bank | Donate | Give | Take | Time presents]


Post New Thread Reply   
 
Thread Tools Display Modes
Supremache
BANNED
Join Date: Sep 2019
Location: Egypt
Old 09-14-2020 , 20:51   Re: Money System [Bank | Donate | Give | Take | Time presents]
Reply With Quote #21

Quote:
Originally Posted by Bugsy View Post
Right now the plugin is pretty much useless since only one player can use it at a time due to your steam ID logic. At your skill level you need to thoroughly test a plugin and be confident it works before posting it for others to use.

Just use #define MAX_PLAYERS 32 , there is no need to first check if its defined doing it this way.
Code:
#if !defined MAX_PLAYERS     const MAX_PLAYERS = 32; #endif
Global variables meant for each player to have a slot in the array should be sized using MAX_PLAYERS + 1. Currently, each time a player connects, his steam id overwrites the last player that connected.
Code:
new szPlayerAuthid[32], szPlayerName[32], //This should be defined as : new szPlayerAuthid[ MAX_PLAYERS + 1 ][32] //Then get_user_authid( id, szPlayerAuthid[ id ] , charsmax(szPlayerAuthid[]))
Why are you getting the same players auth id twice?
Code:
public client_authorized(id) {     get_user_name( id, szPlayerName, charsmax(szPlayerName))
    get_user_authid( id, szPlayerAuthid, charsmax(szPlayerAuthid))
    get_user_authid(id, szAuthID, charsmax(szAuthID));
A disconnected player cannot execute a menu, no need to check if connected
Code:
public BankHandler(id, iBankMenu, iItem) {     if(is_user_connected(id) && iItem != MENU_EXIT)     {
You caring about the less details, and i will do all you said but please can you check it again if there's another thing need to get changes because i will go to my university and i cant do anything.
Supremache is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 09-14-2020 , 21:22   Re: Money System [Bank | Donate | Give | Take | Time presents]
Reply With Quote #22

I'm not caring about small details. At least make it use each players steam ID instead of only the latest connected players steam ID. The functionality is totally broken until you fix this.

Think about it like this:

Player 1 connects, his steam ID is saved to var1
I do transactions and it saves to my steam ID
Player 2 connects, his steam ID is saved to var1 (over-writing Player 1's steam ID)
When I do transactions, it is saved to Player 2's steam ID
When player 2 does transactions, it is saved to Player 2's steam ID

You need each players money to be saved under their own steam ID. This is huge.

Get it?
__________________

Last edited by Bugsy; 09-14-2020 at 21:23.
Bugsy is offline
Supremache
BANNED
Join Date: Sep 2019
Location: Egypt
Old 09-14-2020 , 21:31   Re: Money System [Bank | Donate | Give | Take | Time presents]
Reply With Quote #23

Quote:
Originally Posted by Bugsy View Post
I'm not caring about small details. At least make it use each players steam ID instead of only the latest connected players steam ID. The functionality is totally broken until you fix this.

Think about it like this:

Player 1 connects, his steam ID is saved to var1
I do transactions and it saves to my steam ID
Player 2 connects, his steam ID is saved to var1 (over-writing Player 1's steam ID)
When I do transactions, it is saved to Player 2's steam ID
When player 2 does transactions, it is saved to Player 2's steam ID

You need each players money to be saved under their own steam ID. This is huge.

Get it?
Ya, I think i get it
Thanks.
Supremache is offline
Supremache
BANNED
Join Date: Sep 2019
Location: Egypt
Old 09-16-2020 , 15:32   Re: Money System [Bank | Donate | Give | Take | Time presents]
Reply With Quote #24

New Updates: v1.5, Edited Some codes.
Supremache is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 10-11-2020 , 05:00   Re: Money System [Bank | Donate | Give | Take | Time presents]
Reply With Quote #25

PHP Code:
num_to_str(tempidszTempid9
Use charsmax() instead, hardcoding isn't allowed.

PHP Code:
public ResetBankMenu_Hundler(idiResetBank,item)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(iResetBank)
        return 
PLUGIN_HANDLED
    
}
    new 
access,callback,data[6],iname[64]
    
    
menu_item_getinfo(iResetBank,item,access,data,5,iname,63,callback)
    
    new 
tempid str_to_num(data)
    
    
ResetBankMenu_Caller(idtempid)
    
    
menu_destroy(iResetBank)
    return 
PLUGIN_HANDLED

The first check isn't required since you already destroy the menu at the end of your function, and yet again, use charsmax() instead of hardcoding your array sizes.

PHP Code:
new iPlayers[MAX_PLAYERS], iNum 
PHP Code:
new players[32], tempidpnum
new szTempid[10]
get_players(playerspnum"ch"
Try creating arrays using the same name and method to improve the readability. Also, try to figure out yourself what you're doing wrong here... Keep using the MAX_PLAYERS define.

PHP Code:
new szInput[32
Array size could be decreased since it's very rare you'll ever get that much cash.

PHP Code:
new args[129], arg_cmd[6], cTarget[32], cMoney[10]
    
read_args(args128)
remove_quotes(args)
parse(argsarg_cmd5cTarget31cMoney9
Again, don't hardcode... It seems like you've just been copy/pasting the entire code.

PHP Code:
stock ColorChat(index, const Msg[], {FloatSqlResult,_}:...) 
{
    if (!
is_user_connected(index))
        return; 
    
    new 
Buffer[512], Buffer2[512], Prefix[32]
    
get_pcvar_string(g_pCvarPrefixPrefixcharsmax(Prefix))
    
formatex(Buffer2charsmax(Buffer2), "^x04%s ^x01%s"PrefixMsg);
    
vformat(Buffercharsmax(Buffer), Buffer23);
    
    
replace_all(Buffercharsmax(Buffer), "!g""^x04"); // Green Color
    
replace_all(Buffercharsmax(Buffer), "!n""^x01"); // Default Color
    
replace_all(Buffercharsmax(Buffer), "!t""^x03"); // Team Color
    
    
message_begin(MSG_ONE_UNRELIABLEg_iMsgSayText_index);
    
write_byte(index);
    
write_string(Buffer);
    
message_end();    
}

// color chat without prefix
stock ShowColorMessage(const id, const input[], any:...) 
{
    new 
count 1players[32];
    static 
Msg[191];
    
vformat(Msgcharsmax(Msg), input3);
    
    
replace_all(Msgcharsmax(Msg), "!g""^4"); // verde
    
replace_all(Msgcharsmax(Msg), "!n""^1"); // galben/alb/negru
    
replace_all(Msgcharsmax(Msg), "!t""^3"); // rosu/albastru/gri
    
replace_all(Msgcharsmax(Msg), "!t2""^0"); // rosu2/albastru2/gri2
    
    
if (idplayers[0] = id; else get_players(playerscount"ch");
    {
        for (new 
0counti++)
        {
            if (
is_user_connected(players[i]))
            {
                
message_begin(MSG_ONE_UNRELIABLEg_iMsgSayText_players[i]);
                
write_byte(players[i]);
                
write_string(Msg);
                
message_end();
            }
        }
    }

And yea, this doesn't make sense at all tbh... Just use OciXCrom's colorchat, or either just use the colorchat.inc for easier use. There's no need for you to create 2 stocks to seperate prefixes or not.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Supremache
BANNED
Join Date: Sep 2019
Location: Egypt
Old 10-11-2020 , 06:44   Re: Money System [Bank | Donate | Give | Take | Time presents]
Reply With Quote #26

Well, thanks for examples i will fix it
Supremache is offline
Supremache
BANNED
Join Date: Sep 2019
Location: Egypt
Old 10-17-2020 , 11:34   Re: Money System [Bank | Donate | Give | Take | Time presents]
Reply With Quote #27

New Updates: v1.6
Supremache is offline
Mohamed null
BANNED
Join Date: Sep 2020
Location: Algeria
Old 10-18-2020 , 15:28   Re: Money System [Bank | Donate | Give | Take | Time presents]
Reply With Quote #28

Great Plugin bro KEEP IT UP
Mohamed null is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 10-18-2020 , 22:27   Re: Money System [Bank | Donate | Give | Take | Time presents]
Reply With Quote #29

oh shit kkkkk
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
iceeedr is offline
Send a message via Skype™ to iceeedr
Reply


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


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