They are all described with an example.
Correct Definition
PHP Code:
if(cs_get_user_team(id) == CS_TEAM_T) //this may be error
if(cs_get_user_team(id) == CsTeams:CS_TEAM_T) //the best way to be sure
Correct Numerical Data Types
not only
PHP Code:
set_user_gravity(id, 0.8) //this may be error
set_user_gravity(id, Float:0.8) //the best way to be sure
but also
PHP Code:
new p_Gravity[MAX_PLAYERS] = 0.8 //this may be error
new p_Gravity[MAX_PLAYERS] = float:0.8 //the best way to be sure ("float" for defination, "Float" for function - upper case)
Clean Cvar Usage
PHP Code:
p_Money[id] = get_cvar_num("max_money") //this may be error
correct way
PHP Code:
#define MAX_PLAYERS 33
new cvar_max_money
new p_Money[MAX_PLAYERS]
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
cvar_max_money = get_cvar_num("max_money")
}
public client_connect(id) {
p_Money[id] = cvar_max_money
}
Clean Algorithm
1:
PHP Code:
new p_Name[33]
get_user_name(id, p_Name, 33)
to
PHP Code:
#define MAX_PLAYERS 33
new p_Name[MAX_PLAYERS]
get_user_name(id, p_Name, charsmax(p_Name))
2:
PHP Code:
set_user_health(id, get_user_health(id) + 50)
set_user_armor(id, get_user_armor(id) + 50)
p_UsrXP[id] = p_UserXP[id] + 50
to
PHP Code:
new i_Val = 50
set_user_health(id, get_user_health(id) + i_Val)
set_user_armor(id, get_user_armor(id) + i_Val)
p_UsrXP[id] += i_Val
That's just me.
You can add what you know.