Raised This Month: $ Target: $400
 0% 

LevelMod 8.0 with knifeskins. [ML Support]


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 12-22-2016 , 12:55   Re: LevelMod 7.0 with Knifeskins & Points
Reply With Quote #30

A little review

PHP Code:
        if((g_bGiveRemove = !g_bGiveRemove)) 
        {
            
g_bGiveRemove true
            
            menu_destroy
(menu);
            
Playerlistid 
            return 
PLUGIN_HANDLED
        
}
        else 
        {
            
g_bGiveRemove false
            
            menu_destroy
(menu);
            
Playerlistid 
            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_destroymenu );
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(idGREY"^4[%s]^1 You cant^3 %s^1 that much points"TAGg_bGiveRemove "remove" "give");
        return 
PLUGIN_HANDLED;
    }
    if(!
is_user_connected(g_iName[id]))
    {
        
ColorChat(idGREY"^4[%s]^1 User^3 %s^1 isnt connected"TAGszName[1]);
        return 
PLUGIN_HANDLED
    
}
    
    if( 
g_iLogadmin == )
    {
        new 
message[200], Time[64];
        
get_time("%c"Timecharsmax(Time)); 
        
format messagecharsmax(message), "[%s] %s %s %s %i points"TimeszName[0], g_bGiveRemove "took away" "gave"szName[1], str_to_num(iAmount));
        
write_file "addons/amxmodx/logs/levelmod.txt"message )
    }
    
    
ColorChat(0GREY"^4[%s]^3 %s^1 %s^3 %s^4 %i^1 points"TAGszName[0], g_bGiveRemove "took away" "gave"szName[1], str_to_num(iAmount));
    
    
set_hudmessage(25500, -1.00.101.07.00.11.0)
    
show_hudmessage0"[%s] %s %s %s %i points"TAGszName[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 == 
Realy different styles, keep the same style everywhere.


Here:
PHP Code:
format(szAuthIdcharsmax(szAuthId), "%s%s"szAuthIdSPECIAL_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.
__________________
Project: Among Us

Last edited by Craxor; 12-22-2016 at 17:11.
Craxor is offline
Send a message via ICQ to Craxor
 



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 18:09.


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