Raised This Month: $53 Target: $400
 13% 

New CrediteSystem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hamzashadow
Junior Member
Join Date: Jul 2018
Old 01-10-2019 , 17:54   New CrediteSystem
Reply With Quote #1

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include < ColorChat >
#include <dhudmessage>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"

#define ADMIN_ACCESS ADMIN_IMMUNITY

new const g_szTag[] = "^1[^4BG^1]"

new Credite33 ];
new 
File128 ];

enum _:iCvars {
    
    
PointsPerHS,
    
Pointskiller,

}

new 
g_iCvariCvars ];

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event"DeathMsg""event_DeathMsg""a" );
    
    
g_iCvarPointsPerHS ] = register_cvar"credite_per_headshot""6" );
    
g_iCvarPointskiller ] = register_cvar"credite_killer""3" );
    
    new 
DataDir64 ];
    
get_datadirDataDir63 );
    
formatFile127"%s/CrediteSystem.dat"DataDir );
    
    
register_clcmd("say /credite""show_credite");
    
    
register_concmd"rs_credite""rs_credite"ADMIN_ACCESS"< name / @ALL >" );
    
register_concmd"give_credite" ,"ClCmdGiveCredite"ADMIN_ACCESS"< name / @ALL / @T / @CT > < Credite >" );
         
    
}


public 
plugin_natives( )
{
    
register_native"get_credite""native_get_user_credite");
    
register_native"set_credite""native_set_user_credite");
    
}

public 
native_get_user_crediteid )
{
    return 
Crediteid ];
}

public 
native_set_user_crediteidcredite )
{
    
Crediteid ] = credite;
}


public 
client_putinserver(id)
{
    
LoadUserCrediteid );
}

public 
client_disconnect(id)
{
    
SaveUserCrediteid );
}

public 
event_DeathMsg( ) {

    new 
iKiller read_data);
    new 
iVictim read_data);
    new 
iHeadshot read_data);

    
    if( !
is_user_connectediKiller ) || !is_user_connectediVictim ) ) {

        return;
    }
    
    if( 
iKiller == iVictim ) {

        return;
    }
    
    if( 
iHeadshot ) {

        
CrediteiKiller ] += get_pcvar_numg_iCvarPointsPerHS ] );
        
set_hudmessagerandom255 ), random255 ), random255 ), 0.40.416.07.0 );
        
show_hudmessageiKiller"+%i Credite"get_pcvar_numg_iCvarPointsPerHS ] ) );
    }

    else {

        
CrediteiKiller ]+= get_pcvar_numg_iCvarPointskiller ] );
        
set_hudmessagerandom255 ), random255 ), random255 ), 0.40.406.07.0 );
        
show_hudmessageiKiller"+%i Credite"get_pcvar_numg_iCvarPointskiller ] ) );
    }
    

}


public 
SaveUserCrediteid ) {

    new 
Name32 ];
    
get_user_nameidName31 );
    
    static 
Data1024 ];
    
formatexDatasizeofData ) - 1"^"%i^""Crediteid ] );

    
    new 
Save512 ];
    
formatSave511"^"%s^" %s"NameData );
    
    new 
Line128 ], LinieIsPlayer falseArg132 ];
    
    new 
FileOpen fopenFile"rt" );

    while( !
feofFileOpen ) ) {

        
fgetsFileOpenLine127 );
        
trimLine );
        
        
parseLineArg131 );
        
        if( 
equaliArg1Name ) ) {

            
write_fileFileSaveLinie );
            
IsPlayer true;
            break;
        }
        
        
Linie++;
    }

    
fcloseFileOpen );

    if( !
IsPlayer ) {

        
write_fileFileSave, -);
    }
}

public 
LoadUserCrediteid ) {

    new 
Name32 ];
    
get_user_nameidName31 );
    
    new 
Line128 ], IsPlayer falseArg132 ], Arg232 ]
    
    new 
FileOpen fopenFile"rt" );

    while( !
feofFileOpen ) ) {

        
fgetsFileOpenLine127 );
        
trimLine );
        
        
parseLineArg131Arg231 );
        
        if( 
equaliArg1Name ) ) {

            
Crediteid ] = str_to_numArg2 );
            
IsPlayer true;
            break;
        }
    }

    
fcloseFileOpen );
    
    if( !
IsPlayer ) {

        
Crediteid ] = 1;

    }
}

public 
show_credite(id)
{
    new 
menu menu_create("\r[Menu] \wShow Players Kill:""credite_handle");
    
    new 
name[32], pid[32], players[32], text[555 char],pnumtempid;
    
get_players(playerspnum"c");
    
    for(new 
iipnumi++)
    {
        
tempid players[i];
        
        
get_user_name(tempidnamecharsmax(name)); 
        
formatex(textcharsmax(text), "%s : \w( \y%i \rCredite\w )"nameCredite[tempid]);
        
num_to_str(get_user_userid(tempid), pid9);
        
menu_additem(menutextpid0);
    }
    
    
menu_display(idmenu);
    return 
PLUGIN_CONTINUE;
}

public 
credite_handle(idmenuitem)
{
    if(
item == MENU_EXIT) return PLUGIN_HANDLED;
    
    
show_credite(id);
    
    return 
PLUGIN_CONTINUE;
}

public 
ClCmdGiveCrediteid ) {

    if( !( 
get_user_flagsid ) & ADMIN_ACCESS ) ) {

        
client_cmdid"echo Nu ai acces la aceasta comanda!" );
        return 
1;
    }
    
    new 
szFirstArg32 ], szSecondArg10 ];
    
    
read_argv1szFirstArgsizeof szFirstArg ) -);
    
read_argv2szSecondArgsizeof szSecondArg ) -);
    
    if( 
equalszFirstArg"" ) || equalszSecondArg"" ) ) {

        
client_cmdid"echo give_credite < nume / @ALL / @T / @CT > < credite >" );
        return 
1;
    }
    
    new 
iPlayers32 ];
    new 
iPlayersNum;
    
    new 
iPoints str_to_numszSecondArg );
    if( 
iPoints <= ) {

        
client_cmdid"echo Valoare Punctelor trebuie sa fie mai mare decat 0!" );
        return 
1;
    }
    
    if( 
szFirstArg] == '@' ) {

        switch ( 
szFirstArg] ) {

            case 
'A': {

                if( 
equalszFirstArg"@ALL" ) ) {
                    
                    
get_playersiPlayersiPlayersNum"ch" );
                    for( new 
0iPlayersNum i++ )
                        
CrediteiPlayers] ] += iPoints;
                        
                        
ColorChat 0TEAM_COLOR"^x04^%s^x04 Owner^x04 %s^x01 Give^x04 %i Credite^x01 ALL Player"g_szTagget_nameid ), iPoints );
                                    
set_dhudmessage(02550, -1.00.400.015.01.01.0false)    
                                    
show_dhudmessage(0,"Owner %s Give %i Credite ALL Player"get_nameid ), iPoints )   
                             
                                        
                        
                }
            }
            
            case 
'T': {

                if( 
equalszFirstArg"@T" ) ) {
                    
                    
get_playersiPlayersiPlayersNum"ceh""TERRORIST" );
                    if( 
iPlayersNum == ) {

                        
client_cmdid"echo Nu se afla niciun jucator in aceasta echipa!" );
                        return 
1;
                    }

                    for( new 
0iPlayersNum i++ )
                        
CrediteiPlayers] ] += iPoints;
                        
                    
ColorChat 0TEAM_COLOR"^x04^%s^x01 Owner^x04 %s^x01 Give^x04 %i Credite^x01 Team^x04 TERO^x01!"g_szTagget_nameid ), iPoints );
                    return 
1;
                }
            }
            
            case 
'C': {

                if( 
equalszFirstArg"@CT" ) ) {
                    
                    
get_playersiPlayersiPlayersNum"ceh""CT" );
                    if( 
iPlayersNum == ) {

                        
client_cmdid"echo Nu se afla niciun jucator in aceasta echipa!" );
                        return 
1;
                    }

                    for( new 
0iPlayersNum i++ )
                        
CrediteiPlayers] ] += iPoints;
                        
                    
ColorChat 0TEAM_COLOR"^x04^%s^x01 Owner^x04 %s^x01 Give^x04 %i Credite^x01 Team^x04 CT^x01!"g_szTagget_nameid ), iPoints );
                    return 
1;
                }
            }
        }
    }
        
    new 
iPlayer cmd_targetidszFirstArg);
    if( !
iPlayer ) {

        
client_cmdid"echo Jucatorul %s nu a fost gasit!"szFirstArg );
        return 
1;
    }
    
    
CrediteiPlayer ] += iPoints;
    
    new 
szName32 ];
    
get_user_nameiPlayerszNamesizeof szName ) -);
    
    
ColorChat 0TEAM_COLOR"^x04%s^x01 Owner^x04 %s^x01 Give^x04 %i Credite^x01 lui^x04 %s^x01."g_szTagget_nameid ), iPointsszName );
    
set_dhudmessage(02550, -1.00.400.015.01.01.0false)    
    
show_dhudmessage(0,"Owner %s Give %i Credite Lui %s"get_nameid ), iPoints,szName )  
    
    return 
1;
}

public 
rs_crediteidlevelcid ) {

    if( !
cmd_accessidlevelcid) ) {

        return 
PLUGIN_HANDLED
    }
    
    new 
szArgument32 ];
       
read_argv1szArgumentcharsmaxszArgument ) );
    
    new 
iPlayer32 ], iPlayersNumall;
    
get_playersiPlayeriPlayersNum"c" );

    if( 
equalszArgument"@ALL" ) ) {

        for( new 
iiPlayersNumi++ ) {

            
all iPlayer];
            
            
Crediteall ] = 1;
            
            
ColorChat 0TEAM_COLOR"^x04%s^x01 Owner^x04 %s^x01 v-a resetat toatel^x04 Credite !!!"g_szTagget_nameid ) );
        }
    }
            
    else {

        new 
player cmd_targetidszArgument10 );

        if( !
player )  {

               return 
PLUGIN_HANDLED;
        }
    

        new 
TargetName32 char ];
        
get_user_nameplayerTargetNamecharsmaxTargetName ) );
    
        
Crediteplayer ] = 1;
        
ColorChat 0TEAM_COLOR"^x04%s^x01 Owner^x04 %s^x01 i-a resetat Credite lui^x04 %s^x01 !!!"g_szTagget_nameid ), TargetName );
    }

    return 
PLUGIN_HANDLED;
}

stock get_nameid ) {

    new 
szName32 ];
    
get_user_nameidszNamesizeof szName ) -);
    return 
szName;
}


stock ChatColor(const id, const input[], any:...)
{
    new 
count 1players[32]
    static 
msg[191]
    
vformat(msg190input3)
    
    
replace_all(msg190"!g""^4"// Green Color
    
replace_all(msg190"!y""^1"// Default Color
    
replace_all(msg190"!team""^3"// Team Color
    
replace_all(msg190"!team2""^0"// Team2 Color
    
    
if (idplayers[0] = id; else get_players(playerscount"ch")
    {
        for (new 
0counti++)
        {
            if (
is_user_connected(players[i]))
            {
                
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i])
                
write_byte(players[i]);
                
write_string(msg);
                
message_end();
            }
        }
    }


Last edited by hamzashadow; 01-10-2019 at 19:00. Reason: New CrediteSystem
hamzashadow is offline
Nutu_
Veteran Member
Join Date: Mar 2016
Location: Germany
Old 01-10-2019 , 18:16   Re: Problem Complie ( HELP )
Reply With Quote #2

and what's the problem?
__________________
a simple act of caring creates an endless ripple.
Nutu_ is offline
Old 01-10-2019, 18:37
hamzashadow
This message has been deleted by hamzashadow.
Old 01-10-2019, 18:39
hamzashadow
This message has been deleted by hamzashadow.
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 08:21.


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