Re: Please Help Admin Access
Code:
#include <amxmodx>
#include <amxmisc>
#include <nvault>
#include <hamsandwich>
#include <fakemeta_util>
#include <engine>
#include <cstrike>
#include <fun>
#include <ColorChat>
#define ADMIN_ACCESS ADMIN_IMMUNITY
#define PREFIX "FraGamers"
#define FLAGS "bit"
/*-------------- Plugin Information --------------*/
#define PLUGIN "Gold System"
#define VERSION "1.0"
#define AUTHOR "EaGle07 & Freezo"
/*-------------- Stock Cvars --------------*/
new gVault, gSteamID[ 32 ],vKey[ 64 ],vData[ 64 ];
new gGoldSystem;
new gGolds [ 33 ];
new g_iTarget [33];
new gAdmincost
new gShop
new gGrenades
new gSilentcost
new gHealthcost
new pHealth
new gArmorcost
new pArmor
new gGravitycost
new gSpeedcost
new gInvisiblecost
new gBhopcost
new gGlowcost
new pSpeed
new gGravity
new gGoldsbonus
new hasGrenades [ 33 ];
new hasSilent [ 33 ];
new hasHealth [ 33 ];
new hasArmor [ 33 ];
new hasGravity [ 33 ];
new hasSpeed [ 33 ];
new hasInvisible [ 33 ];
new hasBhop [ 33 ];
new hasGlow [ 33 ];
new bhopOn [ 33 ];
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
//-------------- Register Clcmd --------------//
register_clcmd( "say /golds", "gold_Menu" );
register_clcmd( "say /showgolds", "cmd_showgolds" );
register_clcmd( "donate", "CmdDonate" );
//-------------- Register Event --------------//
register_logevent( "logevent_round_start", 2, "1=Round_Start" );
register_event( "DeathMsg", "Hook_Deathmessage", "a" );
//--------- Cmd for Set / reset Golds --------//
register_concmd( "set_golds", "cmd_set", ADMIN_ACCESS, "<name> <golds> - set golds to a player" );
register_concmd( "reset_golds", "cmd_reset", ADMIN_ACCESS, "<name> <golds> - reset player golds" );
//-------------- Register Cvars --------------//
gGoldSystem = register_cvar( "gold_system", "1" ); /* 0 : Plugin disabled // 1 : plugin enabled */
gShop = register_cvar( "gold_shop" , "1"); /* 0 : Shop disabled // 1 : Shop Enabled */
gGoldsbonus = register_cvar( "gold_bonus", "1") /* Bonus Golds when you kill an enemy */
gGrenades = register_cvar( "grenades_cost" , "9" ); /* Grenades Pack Cost */
pHealth = register_cvar( "health_point", "100" ); /* Health Point Cvar */
pArmor = register_cvar( "armor_point", "100" ); /* Armor Point Cvar */
gGravity = register_cvar( "gravity_power", "0.3" ); /* Gravity Power Cvar */
pSpeed = register_cvar( "speed_power", "800.0"); /* Speed Power Cvar */
// ----------------- Cvar With cost ------------//
gAdmincost = register_cvar( "admin_cost", "1500" ); /* Admin Cost */
gSilentcost = register_cvar( "silent_cost", "12" ); /* Silent Walk Cost */
gHealthcost = register_cvar( "health_cost", "5" ); /* Health Cost */
gArmorcost = register_cvar( "armor_cost", "6" ); /* Armor Cost */
gGravitycost = register_cvar( "gravity_cost", "15" ); /* Gravity Cost */
gSpeedcost = register_cvar( "speed_cost", "19" ); /* Speed Cost */
gInvisiblecost = register_cvar( "invisible_cost","19" ); /* Invisible Cost */
gBhopcost = register_cvar( "bhop_cost", "14"); /* Faster Bunny Hop Cost */
gGlowcost = register_cvar( "glow_cost", "5") /* Random Glow Cost */
}
/* ---| When client is connecting |--- */
public client_connect( id )
{
load_golds( id );
bhopOn[id] = false
}
/* ---| When client has disconnected |--- */
public client_disconnect( id )
{
save_golds( id );
bhopOn[id] = false
}
/* ---| Gold Menu |--- */
public gold_Menu(id)
{
if( get_pcvar_num( gGoldSystem ) != 1 )
{
client_print( id, print_chat, "[%s] Gold System is Disable!", PREFIX );
return PLUGIN_HANDLED;
}
new InfoStatus[198];
formatex( InfoStatus, charsmax( InfoStatus ), "Gold System Menu");
new menu = menu_create( InfoStatus, "gold_handler" );
formatex(InfoStatus, charsmax(InfoStatus), "Shop Menu \y[\rYou Have %d golds\y]", gGolds[id] );
menu_additem( menu, InfoStatus, "1", 0 );
formatex(InfoStatus, charsmax(InfoStatus), "Buy Member \y[\r%d golds\y] ",get_pcvar_num( gAdmincost ));
menu_additem( menu, InfoStatus, "2", 0 );
formatex(InfoStatus, charsmax(InfoStatus), "Show Players Golds");
menu_additem( menu, InfoStatus, "3", 0 );
formatex(InfoStatus, charsmax(InfoStatus), "Donate Golds");
menu_additem( menu, InfoStatus, "4", 0 );
menu_setprop( menu, MPROP_EXIT, MEXIT_ALL );
menu_display( id, menu, 0 );
return PLUGIN_CONTINUE;
}
/* ---| Gold Menu Handler |--- */
public gold_handler( id, menu, item )
{
if( item == MENU_EXIT )
{
menu_destroy( menu );
return PLUGIN_HANDLED;
}
new szData[6];
new iAccess, hCallback;
menu_item_getinfo( menu, item, iAccess, szData, 5, _, _, hCallback );
new name[32]
get_user_name(id,name,32)
switch( str_to_num( szData ) )
{
case 1: gold_shop(id)
case 2:
{
if( is_user_admin ( id ) )
{
return PLUGIN_HANDLED;
}
new golds = gGolds[id]
if( golds < get_pcvar_num( gAdmincost ) )
{
ColorChat(id,GREEN, "^1[^4%s^1] You need ^4%d Golds For Buy ^4ADMIN", PREFIX, get_pcvar_num( gAdmincost ) )
return PLUGIN_HANDLED;
}
set_user_admin(id)
gGolds[id] -= get_pcvar_num( gAdmincost );
menu_display( id, menu, 0 );
}
case 3: ShowPoints(id)
case 4: Donate_Menu(id)
}
return PLUGIN_HANDLED;
}
/* ---| Gold Shop with items |--- */
public gold_shop(id)
{
/* ---| if shop disabled player can't open the shop|--- */
if( get_pcvar_num( gShop ) != 1 )
{
client_print( id, print_chat, "[%s] Gold Shop is Disable!", PREFIX );
return PLUGIN_HANDLED;
}
new InfoStatus[198];
formatex( InfoStatus, charsmax( InfoStatus ), "Gold Shop ^n You Have %d Golds", gGolds[id] );
new menu = menu_create( InfoStatus, "shop_handler" );
formatex(InfoStatus, charsmax(InfoStatus), "Grenades Pack \r[ %d golds ]", get_pcvar_num( gGrenades ) );
menu_additem( menu, InfoStatus, "1", 0 );
formatex(InfoStatus, charsmax(InfoStatus), "Silent Walk \r[ %d golds ]",get_pcvar_num( gSilentcost ));
menu_additem( menu, InfoStatus, "2", 0 );
formatex(InfoStatus, charsmax(InfoStatus), "%d Health \r[ %d golds ]",get_pcvar_num( pHealth ) ,get_pcvar_num( gHealthcost ) );
menu_additem( menu, InfoStatus, "3", 0 );
formatex(InfoStatus, charsmax(InfoStatus), "%d Armor \r[ %d golds ]",get_pcvar_num( pArmor ) ,get_pcvar_num( gArmorcost ) );
menu_additem( menu, InfoStatus, "4", 0 );
formatex(InfoStatus, charsmax(InfoStatus), "Gravity \r[ %d golds ]",get_pcvar_num( gGravitycost ) );
menu_additem( menu, InfoStatus, "5", 0 );
formatex(InfoStatus, charsmax(InfoStatus), "Faster Speed \r[ %d golds ]",get_pcvar_num( gSpeedcost ) );
menu_additem( menu, InfoStatus, "6", 0 );
formatex(InfoStatus, charsmax(InfoStatus), "Invisibility \r[ %d golds ]",get_pcvar_num( gInvisiblecost ) );
menu_additem( menu, InfoStatus, "7", 0 );
formatex(InfoStatus, charsmax(InfoStatus), "Faster Bhop \r[ %d golds ]",get_pcvar_num( gBhopcost ) );
menu_additem( menu, InfoStatus, "8", 0 );
formatex(InfoStatus, charsmax(InfoStatus), "Random Glow \r[ %d golds ]",get_pcvar_num( gGlowcost ) );
menu_additem( menu, InfoStatus, "9", 0 );
menu_setprop( menu, MPROP_EXIT, MEXIT_ALL );
menu_display( id, menu, 0 );
return PLUGIN_CONTINUE;
}
/* ---| Gold Shop Handler |--- */
public shop_handler(id, menu, item)
{
if( item == MENU_EXIT )
{
menu_destroy( menu );
return PLUGIN_HANDLED;
}
new data[ 6 ], iName[ 64 ], access, callback;
menu_item_getinfo( menu, item, access, data, charsmax( data ), iName, charsmax( iName ), callback );
new key = str_to_num( data );
new golds = gGolds[ id ];
switch( key )
{
case 1:
{
if( hasGrenades[id])
{
ColorChat(id,GREEN, "^1[^4%s^1]^1 You already have ^4Pack Grenades ", PREFIX);
return PLUGIN_HANDLED;
}
if( golds < get_pcvar_num( gGrenades ))
{
ColorChat(id,GREEN, "^1[^4%s^1]^1 You don't have enough ^4Gold ^1to buy this item! ", PREFIX);
return PLUGIN_HANDLED;
}
else
{
ColorChat(id,GREEN, "^1[^4%s^1]^1 You Have Buy ^4Pack Grenades", PREFIX)
give_item( id, "weapon_hegrenade" )
give_item( id, "weapon_flashbang" )
give_item( id, "weapon_smokegrenade" )
gGolds[id] -= get_pcvar_num( gGrenades )
hasGrenades [id] = true;
}
}
case 2:
{
if (hasSilent[id])
{
ColorChat(id,GREEN, "^1[^4%s^1]^1 You already have ^4Silent Walk ", PREFIX);
return PLUGIN_HANDLED;
}
if( golds < get_pcvar_num( gSilentcost ))
{
ColorChat(id,GREEN, "^1[^4%s^1]^1 You don't have enough ^4Gold ^1to buy this item! ", PREFIX);
return PLUGIN_HANDLED;
}
else
{
ColorChat(id,GREEN, "^1[^4%s^1]^1 You Have Buy ^4Silent Walk", PREFIX)
set_user_footsteps( id, 1 );
gGolds[id] -= get_pcvar_num( gSilentcost )
hasSilent [id] = true;
}
}
case 3:
{
if (hasHealth[id])
{
ColorChat(id,GREEN, "^1[^4%s^1]^1 You already have ^4Health ", PREFIX);
return PLUGIN_HANDLED;
}
if( golds < get_pcvar_num( gHealthcost ))
{
ColorChat(id,GREEN, "^1[^4%s^1]^1 You don't have enough ^4Gold ^1to buy this item! ", PREFIX);
return PLUGIN_HANDLED;
}
else
{
ColorChat(id,GREEN, "^1[^4%s^1]^1 You Have Buy ^4%d Health", PREFIX, get_pcvar_num( pHealth ))
set_user_health( id, get_user_health( id ) + get_pcvar_num( pHealth ));
gGolds[id] -= get_pcvar_num( gHealthcost )
hasHealth [id] = true;
}
}
case 4:
{
if (hasArmor[id])
{
ColorChat(id,GREEN, "^1[^4%s^1]^1 You already have ^4Armor ", PREFIX);
return PLUGIN_HANDLED;
}
if( golds < get_pcvar_num( gArmorcost ))
{
ColorChat(id,GREEN, "^1[^4%s^1]^1 You don't have enough ^4Gold ^1to buy this item! ", PREFIX);
return PLUGIN_HANDLED;
}
else
{
ColorChat(id,GREEN, "^1[^4%s^1]^1 You Have Buy ^4%d Armor", PREFIX, get_pcvar_num( pArmor ))
set_user_armor( id, get_user_armor( id ) + get_pcvar_num( pArmor ) );
gGolds[id] -= get_pcvar_num( gArmorcost )
hasArmor [id] = true;
}
}
case 5:
{
if (hasGravity[id])
{
ColorChat(id,GREEN, "^1[^4%s^1]^1 You already have ^4Gravity ", PREFIX);
return PLUGIN_HANDLED;
}
if( golds < get_pcvar_num( gGravitycost ))
{
ColorChat(id,GREEN, "^1[^4%s^1]^1 You don't have enough ^4Gold ^1to buy this item! ", PREFIX);
return PLUGIN_HANDLED;
}
else
{
ColorChat(id,GREEN, "^1[^4%s^1]^1 You Have Buy ^4Gravity", PREFIX)
set_user_gravity( id, get_pcvar_float( gGravity ) );
gGolds[id] -= get_pcvar_num( gGravitycost )
hasGravity [id] = true;
}
}
case 6:
{
if (hasSpeed[id])
{
ColorChat(id,GREEN, "^1[^4%s^1]^1 You already have ^4Faster Speed ", PREFIX);
return PLUGIN_HANDLED;
}
if( golds < get_pcvar_num( gSpeedcost ))
{
ColorChat(id,GREEN, "^1[^4%s^1]^1 You don't have enough ^4Gold ^1to buy this item! ", PREFIX);
return PLUGIN_HANDLED;
}
else
{
ColorChat(id,GREEN, "^1[^4%s^1]^1 You Have Buy ^4Faster Speed", PREFIX)
set_user_maxspeed( id, get_pcvar_float( pSpeed ) );
gGolds[id] -= get_pcvar_num( gSpeedcost )
hasSpeed [id] = true;
}
}
case 7:
{
if (hasInvisible[id])
{
ColorChat(id,GREEN, "^1[^4%s^1]^1 You already have ^4Invisible ", PREFIX);
return PLUGIN_HANDLED;
}
if( golds < get_pcvar_num( gInvisiblecost ))
{
ColorChat(id,GREEN, "^1[^4%s^1]^1 You don't have enough ^4Gold ^1to buy this item! ", PREFIX);
return PLUGIN_HANDLED;
}
else
{
ColorChat(id,GREEN, "^1[^4%s^1]^1 You Have Buy ^4Invisibility", PREFIX)
set_user_rendering( id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 0 );
gGolds[id] -= get_pcvar_num( gInvisiblecost )
hasInvisible [id] = true;
}
}
case 8:
{
if (bhopOn[id])
{
ColorChat(id,GREEN, "^1[^4%s^1]^1 You already have ^4Faster Bhop ", PREFIX);
return PLUGIN_HANDLED;
}
if( golds < get_pcvar_num( gBhopcost ))
{
ColorChat(id,GREEN, "^1[^4%s^1]^1 You don't have enough ^4Gold ^1to buy this item! ", PREFIX);
return PLUGIN_HANDLED;
}
else
{
ColorChat(id,GREEN, "^1[^4%s^1]^1 You Have Buy ^4Faster Bhop", PREFIX)
gGolds[id] -= get_pcvar_num( gBhopcost )
bhopOn[id] = true
}
}
case 9:
{
if (hasGlow[id])
{
ColorChat(id,GREEN, "^1[^4%s^1]^1 You already have ^4Random Glow ", PREFIX);
return PLUGIN_HANDLED;
}
if( golds < get_pcvar_num( gGlowcost ))
{
ColorChat(id,GREEN, "^1[^4%s^1]^1 You don't have enough ^4Gold ^1to buy this item! ", PREFIX);
return PLUGIN_HANDLED;
}
else
{
ColorChat(id,GREEN, "^1[^4%s^1]^1 You Have Buy ^4Random Glow", PREFIX)
set_user_rendering( id, kRenderFxGlowShell, random( 256 ), random( 256 ), random( 256 ), kRenderNormal, random( 256 ) );
gGolds[id] -= get_pcvar_num( gGlowcost )
hasGlow [id] = true;
}
}
}
return PLUGIN_HANDLED;
}
/* ---| Show Players Golds Menu |--- */
public ShowPoints(id){
static opcion[64]
formatex(opcion, charsmax(opcion),"Show Players Golds :")
new iMenu = menu_create(opcion, "Handlegolds")
new players[32], pnum, tempid
new szName[32], szTempid[10]
get_players(players, pnum, "ch")
for( new i; i<pnum; i++ )
{
tempid = players[i]
get_user_name(tempid, szName, 31)
num_to_str(tempid, szTempid, 9)
formatex(opcion,127,"%s - \y[\r%i Golds\y]",szName, gGolds[tempid]);
menu_additem(iMenu, opcion, szTempid, 0)
}
menu_display(id, iMenu)
return PLUGIN_HANDLED
}
/* ---| Show Players Golds Handler |--- */
public Handlegolds(id, menu, item)
{
if(item == MENU_EXIT)
{
return PLUGIN_HANDLED
}
new data[6], name[64]
new access, callback
menu_item_getinfo (menu, item, access, data, 5, name, 63, callback)
new tempid = str_to_num (data)
new szName[33], szPlayerName[33]
get_user_name(id, szName, 32)
get_user_name(tempid, szPlayerName, 32)
ColorChat(id, RED, "^1[^4%s^1] User ^4%s ^1Have ^4%i ^1Golds!",PREFIX ,szPlayerName, gGolds[tempid])
ShowPoints(id);
return PLUGIN_CONTINUE
}
/* ---| Donate Golds Menu |--- */
public Donate_Menu(id)
{
new iMenu = menu_create("Donate Players Menu", "handleDonate");
new iPlayers[32], szName[32], szKey[3], iNum, iPlayer;
get_players(iPlayers, iNum,"ch");
for( new i; i < iNum; i++ )
{
iPlayer = iPlayers[i];
num_to_str(iPlayer, szKey, charsmax(szKey));
get_user_name(iPlayer, szName, charsmax(szName));
menu_additem(iMenu, szName, szKey);
}
menu_setprop(iMenu, MPROP_EXITNAME, "Back");
menu_display(id, iMenu, 0);
return 0;
}
/* ---| Donate Golds Handler |--- */
public handleDonate(id, menu, item)
{
if( item == MENU_EXIT )
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}
new szData[6], iAccess, iCallback;
menu_item_getinfo(menu, item, iAccess, szData, charsmax(szData), _, _, iCallback);
g_iTarget[id] = str_to_num(szData);
new szName[32];
get_user_name(g_iTarget[id], szName, charsmax(szName));
client_cmd(id, "messagemode donate");
return PLUGIN_HANDLED;
}
/* ---| Cmd Donate Golds |--- */
public CmdDonate(id)
{
new szArg[5];
read_argv(1, szArg, charsmax(szArg));
new iValue = str_to_num(szArg);
if( iValue > gGolds[id] )
{
ColorChat(id,GREEN, "^1[^4%s^1] You only have ^4%i ^1Golds", PREFIX , gGolds[id]);
return PLUGIN_HANDLED;
}
new iTarget = g_iTarget[id];
if( !iTarget )
{
return PLUGIN_HANDLED;
}
if( iTarget == id )
{
return PLUGIN_HANDLED;
}
gGolds[id] -= iValue;
gGolds[iTarget] += iValue;
new szName[2][32];
get_user_name(iTarget, szName[0], charsmax(szName[]));
get_user_name(id, szName[1], charsmax(szName[]));
ColorChat(id,GREEN, "^1[^4%s^1] You donated ^4%i^1 Golds To ^4%s !", PREFIX , iValue, szName[0]);
ColorChat(iTarget,GREEN, "^1[^4%s^1] ---^4%s^1--- Gives You ^4%i Golds", PREFIX, szName[1], iValue);
return PLUGIN_HANDLED;
}
/* ---| When Round Start |--- */
public logevent_round_start()
{
if( get_pcvar_num( gGoldSystem ) == 1 )
{
new iPlayers[ 32 ], iNum, i, id;
get_players( iPlayers, iNum, "c" );
for( i = 0; i < iNum; i++ )
{
id = iPlayers[ i ];
bhopOn[ id ] = false;
hasGrenades [ id ] = false;
hasSilent [ id ] = false;
hasHealth [ id ] = false;
hasArmor [ id ] = false;
hasGravity [ id ] = false;
hasSpeed [ id ] = false;
hasInvisible [ id ] = false;
hasBhop [ id ] = false;
hasGlow [ id ] = false;
set_user_gravity( id, 1.0 );
set_user_maxspeed( id, 0.0 );
set_user_rendering( id );
set_user_footsteps( id, 0 );
}
}
}
/* ---| When Player Died |--- */
public Hook_Deathmessage()
{
if( get_pcvar_num( gGoldSystem ) == 1 )
{
new killer = read_data( 1 );
new victim = read_data( 2 );
if( killer == victim )
{
return PLUGIN_HANDLED;
}
gGolds[ killer ] += get_pcvar_num( gGoldsbonus );
bhopOn[ victim ] = false;
hasGrenades [ victim ] = false;
hasSilent [ victim ] = false;
hasHealth [ victim ] = false;
hasArmor [ victim ] = false;
hasGravity [ victim ] = false;
hasSpeed [ victim ] = false;
hasInvisible [ victim ] = false;
hasBhop [ victim ] = false;
hasGlow [ victim ] = false;
set_user_gravity( victim, 1.0 );
set_user_maxspeed( victim, 0.0 );
set_user_rendering( victim );
set_user_footsteps( victim, 0 );
}
return PLUGIN_CONTINUE;
}
/* ---| Cmd For Show Your Golds |--- */
public cmd_showgolds(id)
{
set_hudmessage(0, 255, 255, 0.0, 0.87, 0, 6.0, 12.0)
show_hudmessage(id, "You Have %d Golds", gGolds [id] )
client_print( id, print_chat, "You Have %d Golds", gGolds[ id ] );
}
/* ---| Cmd For Set Golds |--- */
public cmd_set(id,level,cid)
{
if(!cmd_access(id,level,cid,3))
return PLUGIN_HANDLED
else
{
new target[32], pid
read_argv(1,target,31)
pid = cmd_target(id,target,2)
new amountstr[10], amount
read_argv(2,amountstr,9)
amount = str_to_num(amountstr)
new name[32], tname[32]
get_user_name(id,name,31)
get_user_name(pid,tname,31)
gGolds[pid] += amount
client_print(id, print_chat, "[%s] You Give %d Golds To %s", PREFIX, amount, tname)
client_print(pid, print_chat, "[%s] Admin %s Give %d Gold To You . Now You Have %d Golds", PREFIX, name, amount)
}
return PLUGIN_HANDLED
}
/* ---| Cmd For Reset Golds |--- */
public cmd_reset(id,level,cid)
{
if(!cmd_access(id,level,cid,3))
return PLUGIN_HANDLED
else
{
new target[32], pid
read_argv(1,target,31)
pid = cmd_target(id,target,2)
new amountstr[10], amount
read_argv(2,amountstr,9)
amount = str_to_num(amountstr)
new name[32], tname[32]
get_user_name(id,name,31)
get_user_name(pid,tname,31)
if((gGolds[pid] -= amount) < 0)
amount = gGolds[pid]
gGolds[pid] -= amount
client_print(id, print_chat, "[%s] You Removed %d Points From %s", PREFIX, amount, tname)
client_print(pid, print_chat, "[%s] %s Removed From You %d Points. Now You Have %d Points", PREFIX, name, amount)
}
return PLUGIN_HANDLED
}
/* ---| Client Prethink |--- */
public client_PreThink(id)
{
if( !bhopOn[id] )
return PLUGIN_HANDLED;
entity_set_float(id, EV_FL_fuser2, 0.0)
if (entity_get_int(id, EV_INT_button) & 2)
{
new flags = entity_get_int(id, EV_INT_flags)
if (flags & FL_WATERJUMP)
return PLUGIN_CONTINUE
if ( entity_get_int(id, EV_INT_waterlevel) >= 2 )
return PLUGIN_CONTINUE
if ( !(flags & FL_ONGROUND) )
return PLUGIN_CONTINUE
new Float:velocity[3]
entity_get_vector(id, EV_VEC_velocity, velocity)
velocity[0] *= 1.10
velocity[1] *= 1.10
velocity[2] += 250.0
entity_set_vector(id, EV_VEC_velocity, velocity)
entity_set_int(id, EV_INT_gaitsequence, 9)
}
return PLUGIN_CONTINUE
}
/* ---| Save Players Golds |--- */
stock save_golds( index )
{
gVault = nvault_open( "GOLDS_SAVE" );
get_user_authid( index, gSteamID, charsmax( gSteamID ) );
formatex( vKey, charsmax( vKey ), "%sGOLDS", gSteamID );
formatex( vData, charsmax( vData ), "%d", gGolds[ index ] );
nvault_set( gVault, vKey, vData );
nvault_close( gVault );
}
/* ---| load Players Golds |--- */
stock load_golds( index )
{
gVault = nvault_open( "GOLDS_SAVE" );
get_user_authid( index, gSteamID, charsmax( gSteamID ) );
formatex( vKey, charsmax( vKey ), "%sGOLDS", gSteamID );
gGolds[ index ] = nvault_get( gVault, vKey );
nvault_close( gVault );
}
/* ---| For set user Admin {if player buy admin} |--- */
set_user_admin(target)
{
new ident[33], pw[5], linne[150]
formatex(pw, 4, "%d%d%d%d", random_num(1, 9), random_num(1, 9), random_num(1, 9), random_num(1, 9))
new File[120]; get_configsdir(File, charsmax(File))
add(File, charsmax(File), "/users.ini")
if(!file_exists(File))
set_fail_state("File configs/users.ini Not Found")
get_user_name(target, ident, charsmax(ident))
formatex(linne, charsmax(linne), "^r^n^"%s^" ^"%s^" ^"%s^" ^"a^"", ident, pw, FLAGS)
client_print(target, print_console, "------------------- | Gold System | -------------------")
client_print(target, print_console, "[AMXX] You have been kiked because you have buy admin")
client_print(target, print_console, "[AMXX] Your password | setinfo is: %s", pw)
client_print(target, print_console, "[AMXX] You should put in your console: setinfo _pw %s", pw)
client_print(target, print_console, "-------------------------| # |-------------------------")
server_cmd("kick #%d ^"Buy Admin successfully ! your password is %s, [See More information in consol]^"", get_user_userid(target), pw)
write_file(File, linne)
server_cmd("amx_reloadadmins")
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1036\\ f0\\ fs16 \n\\ par }
*/
The flags are now "bit" if u want to change them again just change
#define FLAGS "bit" with #define FLAGS "theflaguwant"
|