View Single Post
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 03-15-2017 , 12:16   Re: Some simple solutions
#7

Here you are not coding in c++, keep that in mind. Most of what you say is wrong.

I'm going to answer now only on what Klippy did not.
Quote:
You can try this will not make a difference.
What about you trying it?

PHP Code:
#include <amxmodx>

new Array1[5] = {12, ...}
new 
Array2[5] = 12

public plugin_init()
{
    new 
i;
    for(
0sizeof Array1i++)
    {
        
server_print("Array1[%i] = %i | Array2[%i] = %i"iArray1[i], iArray2[i])
    }

Output:
PHP Code:

Array1
[0] = 12 Array2[0] = 12
Array1
[1] = 12 Array2[1] = 0
Array1
[2] = 12 Array2[2] = 0
Array1
[3] = 12 Array2[3] = 0
Array1
[4] = 12 Array2[4] = 
Quote:
The fact that this change in client isn't healthy will lead to mistakes.
For this reason, these are done with "cfg" before the game.
Lol, that's the entire purpose of a cvar. The cvar is to let server admins to change plugin behaviour on the fly, without needing to recompile or change/restart map.
If something is prone to error and could produce a crash or something just don't expose that value by cvars or enforce proper filtering on it to prevent bad values.

Quote:

MAX_PLAYERS 33 and and without + 1 ([MAX_PLAYERS])
Indexing a string array that should store a player name by a constant used to size arrays for players is confusing. Use 32, make your own define if you are using amxx < 182 or use the proper constant as Klippy said.

Edit:
Quote:
I'm not talking about client name. Client ID I'm talking about
Klippy and I are talking about this:
PHP Code:
#define MAX_PLAYERS 33 
new p_Name[MAX_PLAYERS
get_user_name(idp_Namecharsmax(p_Name)) 
Here you are not using p_Name as an array to store data for each player, it's going to save a player name. Let's say the player name is "ABCDEFGHIJ", then:
PHP Code:
p_Name[0] = 'A'
p_Name[1] = 'B'
p_Name[2] = 'C'
p_Name[3] = 'D'
..and so on 
__________________

Last edited by HamletEagle; 03-15-2017 at 12:20.
HamletEagle is offline