A little review
PHP Code:
if((g_bGiveRemove = !g_bGiveRemove))
{
g_bGiveRemove = true
menu_destroy(menu);
Playerlist( id )
return PLUGIN_HANDLED
}
else
{
g_bGiveRemove = false
menu_destroy(menu);
Playerlist( id )
return PLUGIN_HANDLED
}
- >
PHP Code:
// will give the oposite, if is false, will set it to true, if is true, will set it to false
b_bGiveRemove = !b_GiveRemove
Playerlist( id )
// keep the same style, if you use PlayerList( id ) do the same everywhere
menu_destroy( menu );
return PLUGIN_HANDLED;
Same as here or everywhere:
PHP Code:
g_iName[id] = key
Add ';" , you should keep the same arrangement style, user pragma semicolon 1 better to be sure.
Here:
PHP Code:
if( str_to_num(iAmount) >= 9999999 )
{
ColorChat(id, GREY, "^4[%s]^1 You cant^3 %s^1 that much points", TAG, g_bGiveRemove ? "remove" : "give");
return PLUGIN_HANDLED;
}
if(!is_user_connected(g_iName[id]))
{
ColorChat(id, GREY, "^4[%s]^1 User^3 %s^1 isnt connected", TAG, szName[1]);
return PLUGIN_HANDLED
}
if( g_iLogadmin == 1 )
{
new message[200], Time[64];
get_time("%c", Time, charsmax(Time));
format ( message, charsmax(message), "[%s] %s %s %s %i points", Time, szName[0], g_bGiveRemove ? "took away" : "gave", szName[1], str_to_num(iAmount));
write_file ( "addons/amxmodx/logs/levelmod.txt", message )
}
ColorChat(0, GREY, "^4[%s]^3 %s^1 %s^3 %s^4 %i^1 points", TAG, szName[0], g_bGiveRemove ? "took away" : "gave", szName[1], str_to_num(iAmount));
set_hudmessage(255, 0, 0, -1.0, 0.1, 0, 1.0, 7.0, 0.1, 1.0)
show_hudmessage( 0, "[%s] %s %s %s %i points", TAG, szName[0], g_bGiveRemove ? "took away" : "gave", szName[1], str_to_num(iAmount));
Better a make a new variabile and do like that new iAmount = str_to_num( szAmountArg ), insteand of calling str_to_num everywhere.
- Add ML man <3
Here:
PHP Code:
if( g_iPoints[id] >= g_szLevels[g_iLevel[id]+1] && g_szLevels[g_iLevel[id]+1] != 0)
{
g_iLevel[id]++;
if( g_iPoints[id] >= g_szLevels[g_iLevel[id]+1] && g_szLevels[g_iLevel[id]+1] != 0)
{
CheckLevel(id)
return PLUGIN_HANDLED
}
Why do you make the same checks lot of times in the same function ?
You could not just add CheckLevel(id) at the end of the function and force index to be checked in all the cases ?
Again your style, look here:
PHP Code:
if(is_user_alive(id))
in hamitem deploy function and now in the Message_Win public:
PHP Code:
if( g_iWin == 0 )
Realy different styles, keep the same style everywhere.
Here:
PHP Code:
format(szAuthId, charsmax(szAuthId), "%s%s", szAuthId, SPECIAL_CHAR)
You DO NOT NEED a special Char for saving in nvault, the classic vault.inc requires a special char because all plugins saves keys and data in the vault.ini, but nvault create private files so you do not special chars.
Here
PHP Code:
/* ************ EDIT STARTS HERE ************ */
// Tag for messages in the plugin
#define TAG "LevelMod"
//What admin rank you should have to give points
#define ADMIN_LEVEL ADMIN_KICK
//Max levels
#define MaxLevels 100
//Top number
#define TopNumber 15
//Max players
#define MAX_PLAYERS 32
//iChat tag support //1 to enable
#define iChat_Tags 0
/* ************ EDIT ENDS HERE ************** */
I may be wrong but i believe you could use constants here insteand of define#.
Another idea: insteand of lot of cvars variables, use enum to delcare them.
Here:
PHP Code:
register_event( "DeathMsg", "Event_DeathMsg", "a" );
You included hamsandwich no? Why not using Ham_Kill.
__________________