New Member
|
09-22-2020
, 15:53
Some helps at this script
|
#1
|
Hello im new to forum and need some helps at this scripts
i wanted to add goldenak at this gold system and make just vips acces this gold system
i tried to add goldenak but i failed
heres goldenak script
Code:
#include <amxmodx>
#include <fakemeta>
#include <fun>
#include <hamsandwich>
#include <cstrike>
#include <amxmisc>
#define is_valid_player(%1) (1 <= %1 <= 32)
new AK_V_MODEL[64] = "models/AVI/v_tron_ak47.mdl"
new AK_P_MODEL[64] = "models/AVI/p_tron_ak47.mdl"
/* Pcvars */
new cvar_dmgmultiplier, cvar_goldbullets, cvar_custommodel, cvar_uclip, cvar_cost
new bool:g_HasAk[33]
new g_hasZoom[ 33 ]
new bullets[ 33 ]
// Sprite
new m_spriteTexture
const Wep_ak47 = ((1<<CSW_AK47))
public plugin_init()
{
/* CVARS */
cvar_dmgmultiplier = register_cvar("goldenak_dmg_multiplier", "2")
cvar_custommodel = register_cvar("goldenak_custom_model", "1")
cvar_goldbullets = register_cvar("goldenak_gold_bullets", "1")
cvar_uclip = register_cvar("goldenak_unlimited_clip", "1")
cvar_cost = register_cvar("goldenak_cost", "10000")
// Register The Buy Cmd
register_clcmd("goldenshop_goldenak", "CmdBuyAk")
register_clcmd("goldenshop_goldenak", "CmdBuyAk")
register_concmd("amx_goldenak", "CmdGiveAk", ADMIN_LEVEL_A, "<name>")
// Register The Plugin
register_plugin("Golden Ak 47", "1.0", "cSPlugins")
// Death Msg
register_event("DeathMsg", "Death", "a")
// Weapon Pick Up
register_event("WeapPickup","checkModel","b","1=19")
// Current Weapon Event
register_event("CurWeapon","checkWeapon","be","1=1")
register_event("CurWeapon", "make_tracer", "be", "1=1", "3>0")
// Ham TakeDamage
RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
register_forward( FM_CmdStart, "fw_CmdStart" )
RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1)
}
public client_connect(id)
{
g_HasAk[id] = false
}
public client_disconnect(id)
{
g_HasAk[id] = false
}
public Death()
{
g_HasAk[read_data(2)] = false
}
public fwHamPlayerSpawnPost(id)
{
g_HasAk[id] = false
}
public plugin_precache()
{
precache_model(AK_V_MODEL)
precache_model(AK_P_MODEL)
m_spriteTexture = precache_model("sprites/dot.spr")
precache_sound("weapons/zoom.wav")
}
public checkModel(id)
{
if ( !g_HasAk[id] )
return PLUGIN_HANDLED
new szWeapID = read_data(2)
if ( szWeapID == CSW_AK47 && g_HasAk[id] == true && get_pcvar_num(cvar_custommodel) )
{
set_pev(id, pev_viewmodel2, AK_V_MODEL)
set_pev(id, pev_weaponmodel2, AK_P_MODEL)
}
return PLUGIN_HANDLED
}
public checkWeapon(id)
{
new plrClip, plrAmmo, plrWeap[32]
new plrWeapId
plrWeapId = get_user_weapon(id, plrClip , plrAmmo)
if (plrWeapId == CSW_AK47 && g_HasAk[id])
{
checkModel(id)
}
else
{
return PLUGIN_CONTINUE
}
if (plrClip == 0 && get_pcvar_num(cvar_uclip))
{
// If the user is out of ammo..
get_weaponname(plrWeapId, plrWeap, 31)
// Get the name of their weapon
give_item(id, plrWeap)
engclient_cmd(id, plrWeap)
engclient_cmd(id, plrWeap)
engclient_cmd(id, plrWeap)
}
return PLUGIN_HANDLED
}
public fw_TakeDamage(victim, inflictor, attacker, Float:damage)
{
if ( is_valid_player( attacker ) && get_user_weapon(attacker) == CSW_AK47 && g_HasAk[attacker] )
{
SetHamParamFloat(4, damage * get_pcvar_float( cvar_dmgmultiplier ) )
}
}
public fw_CmdStart( id, uc_handle, seed )
{
if( !is_user_alive( id ) )
return PLUGIN_HANDLED
if( ( get_uc( uc_handle, UC_Buttons ) & IN_ATTACK2 ) && !( pev( id, pev_oldbuttons ) & IN_ATTACK2 ) )
{
new szClip, szAmmo
new szWeapID = get_user_weapon( id, szClip, szAmmo )
if( szWeapID == CSW_AK47 && g_HasAk[id] == true && !g_hasZoom[id] == true)
{
g_hasZoom[id] = true
cs_set_user_zoom( id, CS_SET_AUGSG552_ZOOM, 0 )
emit_sound( id, CHAN_ITEM, "weapons/zoom.wav", 0.20, 2.40, 0, 100 )
}
else if ( szWeapID == CSW_AK47 && g_HasAk[id] == true && g_hasZoom[id])
{
g_hasZoom[ id ] = false
cs_set_user_zoom( id, CS_RESET_ZOOM, 0 )
}
}
return PLUGIN_HANDLED
}
public make_tracer(id)
{
if (get_pcvar_num(cvar_goldbullets))
{
new clip,ammo
new wpnid = get_user_weapon(id,clip,ammo)
new pteam[16]
get_user_team(id, pteam, 15)
if ((bullets[id] > clip) && (wpnid == CSW_AK47) && g_HasAk[id])
{
new vec1[3], vec2[3]
get_user_origin(id, vec1, 1) // origin; your camera point.
get_user_origin(id, vec2, 4) // termina; where your bullet goes (4 is cs-only)
//BEAMENTPOINTS
message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
write_byte (0) //TE_BEAMENTPOINTS 0
write_coord(vec1[0])
write_coord(vec1[1])
write_coord(vec1[2])
write_coord(vec2[0])
write_coord(vec2[1])
write_coord(vec2[2])
write_short( m_spriteTexture )
write_byte(1) // framestart
write_byte(5) // framerate
write_byte(2) // life
write_byte(10) // width
write_byte(0) // noise
write_byte( 133 ) // r, g, b
write_byte( 211 ) // r, g, b
write_byte( 210 ) // r, g, b
write_byte(200) // brightness
write_byte(150) // speed
message_end()
}
bullets[id] = clip
}
}
public CmdBuyAk(id)
{
if ( !is_user_alive(id) )
{
client_print(id,print_chat, "^4[BB 6.8] To buy golden Ak 47 You need to be alive!")
return PLUGIN_HANDLED
}
new money = cs_get_user_money(id)
if (money >= get_pcvar_num(cvar_cost))
{
cs_set_user_money(id, money - get_pcvar_num(cvar_cost))
give_item(id, "weapon_ak47")
g_HasAk[id] = true
}
else
{
client_print(id, print_chat, "^4[BB 6.8] You dont hav enough money to buy Golden Ak 47. Cost $%d ", get_pcvar_num(cvar_cost))
}
return PLUGIN_HANDLED
}
public CmdGiveAk(id,level,cid)
{
if (!cmd_access(id,level,cid,2))
return PLUGIN_HANDLED;
new arg[32];
read_argv(1,arg,31);
new player = cmd_target(id,arg,7);
if (!player)
return PLUGIN_HANDLED;
new name[32];
get_user_name(player,name,31);
give_item(player, "weapon_ak47")
g_HasAk[player] = true
return PLUGIN_HANDLED
}
stock drop_prim(id)
{
new weapons[32], num
get_user_weapons(id, weapons, num)
for (new i = 0; i < num; i++) {
if (Wep_ak47 & (1<<weapons[i]))
{
static wname[32]
get_weaponname(weapons[i], wname, sizeof wname - 1)
engclient_cmd(id, "drop", wname)
}
}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
i wanted to put it at this script
Code:
#include <amxmodx>
#include <amxmisc>
#include <nvault>
#include <hamsandwich>
#include <fakemeta_util>
#include <engine>
#include <cstrike>
#include <fun>
#include <ColorChat>
#define ADMIN_ACCESS ADMIN_LEVEL_H
#define PREFIX "AVI"
#define FLAG ADMIN_H
/*-------------- 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 gShop
new gGrenades
new gSilentcost
new gHealthcost
new pHealth
new gArmorcost
new pArmor
new gGravitycost
new gSpeedcost
new gInvisiblecost
new gBhopcost
new gGoldenakcost
new pSpeed
new gGravity
new gGoldsbonus
new syncObj
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" );
set_task(1.0,"JailbreakVIPPacks", .flags = "b")
syncObj = CreateHudSyncObj()
//-------------- 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 ------------//
gSilentcost = register_cvar( "silent_cost", "12" ); /* Silent Walk Cost */
gHealthcost = register_cvar( "health_cost", "2" ); /* Health Cost */
gArmorcost = register_cvar( "armor_cost", "1" ); /* Armor Cost */
gGravitycost = register_cvar( "gravity_cost", "25" ); /* Gravity Cost */
gSpeedcost = register_cvar( "speed_cost", "25" ); /* Speed Cost */
gInvisiblecost = register_cvar( "invisible_cost","300" ); /* Invisible Cost */
gBhopcost = register_cvar( "bhop_cost", "39"); /* Faster Bunny Hop Cost */
gGoldenakcost = register_cvar( "goldenak_cost", "55"); /* Goldenak 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), "Show Players Golds");
menu_additem( menu, InfoStatus, "2", 0 );
formatex(InfoStatus, charsmax(InfoStatus), "Donate Golds");
menu_additem( menu, InfoStatus, "3", 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: ShowPoints(id)
case 3: 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), "goldenak \r[ %d golds ]",get_pcvar_num( gGoldenakcost ) );
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 ^4Goldenak ", PREFIX);
return PLUGIN_HANDLED;
}
if( golds < get_pcvar_num( gGoldenakcost ))
{
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 ^4goldenak", PREFIX)
client_cmd(id, "goldenshop_goldenak");
gGolds[id] -= get_pcvar_num( gGoldenakcost )
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 );
}
/* The MSG VIP JBPacks this showing jbpacks*/
public JailbreakVIPPacks(id)
{
new players[32],num, i,id
get_players(players,num,"a")
for(i=0;i<num;i++)
{
id = players[i]
if(get_user_flags(id) & ADMIN_LEVEL_H)
{
set_hudmessage(142, 239, 39, 0.85, 0.73, 0, 6.0, 12.0)
ShowSyncHudMsg(id, syncObj,"VIP Golds: %i", gGolds[id])
}
}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1036\\ f0\\ fs16 \n\\ par }
*/
Last edited by Brentio; 09-22-2020 at 15:56.
|
|