Visad turejau problema del deathrun shop point. Issiaiskinau, kad matyt ju neuzdeda del nVault modulio kaltes.
Stai mano module.ini
Code: Select all
;mysql;sqlite funenginefakemeta;geoip;sockets;regexnvaultcstrikecsxhamsandwich
Code: Select all
;mysql;sqlite funenginefakemeta;geoip;sockets;regexnvaultcstrikecsxhamsandwich
Code: Select all
L 03/16/2013 - 14:12:30: Start of error session.L 03/16/2013 - 14:12:30: Info (map "deathrun_temple") (file "addons/amxmodx/logs/error_20130316.log")L 03/16/2013 - 14:12:30: [FUN] Invalid player 2L 03/16/2013 - 14:12:30: [AMXX] Displaying debug trace (plugin "DRShop.amxx")L 03/16/2013 - 14:12:30: [AMXX] Run time error 10: native error (native "set_user_rendering")L 03/16/2013 - 14:12:30: [AMXX] [0] DRShop.sma::fwClientSpawn (line 1163)
Code: Select all
#include < amxmodx >#include < amxmisc >#include < cstrike >#include < fun >#include < hamsandwich >#include < engine >#include < nvault > /* Defines and Pragma */#define MaxPowers 4 #define MaxFun 2 #define MaxWeapons 8 #define MaxGrenades 3 #pragma semicolon 1 #define CmdAccess ADMIN_RCON /* Cvars */enum _:Cvars{ OnOff, Prefix, Savetype, kill, suicide, tkill, Godmode, Speed, Gravity, Stealth, Glow, NoSteps, Grenade, Flash, Smoke, m4a1, ak47, awp, dgl, famas, galil, m3, mp5}new pCvar[ Cvars ]; /* Arrays and Variables */new g_Points[ 33 ], Val[ 33 ], Cost[ 33 ],Float:PowerTime[ 33 ], bool:g_Godmode[ 33 ], bool:g_Speed[ 33 ],bool:g_Gravity[ 33 ], bool:g_Stealth[ 33 ], Float:MaxSpeed[ 33 ], Ammo[ 33 ], g_Vault; new g_Plugin[ 3 ][ ] = { "Deathrun Shop", "1.0", "Rejack" }; new g_PowersNames[ MaxPowers ][ ] ={ "Godmode", "Speed", "Gravity", "Stealth"}; new g_PowersCost[ ] ={ Godmode, Speed, Gravity, Stealth}; new g_FunNames[ MaxFun ][ ] ={ "Fun Glow", "No Footsteps"}; new g_FunCvars[ MaxFun ] ={ Glow, NoSteps}; new g_GrenadesNames[ MaxGrenades ][ ] ={ "HEGrenade", "Flashbang", "Smokegrenade"}; new g_GrenadesCvars[ MaxGrenades ] ={ Grenade, Flash, Smoke}; new g_GrenadesClass[ MaxGrenades ][ ] ={ "weapon_hegrenade", "weapon_flashbang", "weapon_smokegrenade"}; new g_GrenadesIDs[ MaxGrenades ] ={ CSW_HEGRENADE, CSW_FLASHBANG, CSW_SMOKEGRENADE}; new g_WeaponsNames[ MaxWeapons ][ ] ={ "M4A1", "AK47", "AWP", "Deagle", "Famas", "Galil", "M3", "MP5"}; new g_WeaponsMax[ MaxWeapons ] ={ 30, 30, 10, 7, 25, 35, 8, 30}; new g_WeaponsClass[ MaxWeapons ][ ] ={ "weapon_m4a1", "weapon_ak47", "weapon_awp", "weapon_deagle", "weapon_famas", "weapon_galil", "weapon_m3", "weapon_mp5navy"}; new g_WeaponsIDs[ MaxWeapons ] ={ CSW_M4A1, CSW_AK47, CSW_AWP, CSW_DEAGLE, CSW_FAMAS, CSW_GALIL, CSW_M3, CSW_MP5NAVY}; new g_WeaponsCvars[ MaxWeapons ] ={ m4a1, ak47, awp, dgl, famas, galil, m3, mp5}; public plugin_init(){ register_plugin( g_Plugin[ 0 ], g_Plugin[ 1 ], g_Plugin[ 2 ] ); register_clcmd( "say", "CmdSay" ); register_clcmd( "drshop_add_points", "CmdAddPoints" ); register_clcmd( "drshop_remove_points", "CmdRemovePoints" ); RegisterHam( Ham_Spawn, "player", "fwClientSpawn", 1 ); register_event( "DeathMsg", "evDeathMsg", "a" ); register_event( "CurWeapon", "evCurWeapon", "be", "1=1" ); pCvar[ OnOff ] = register_cvar( "drshop_enabled", "1" ); pCvar[ Prefix ] = register_cvar( "drshop_prefix", "Deathrun" ); pCvar[ Savetype ] = register_cvar( "drshop_save", "2" ); pCvar[ kill ] = register_cvar( "drshop_kill", "3" ); pCvar[ suicide ] = register_cvar( "drshop_suicide", "1" ); pCvar[ tkill ] = register_cvar( "drshop_killt", "6" ); pCvar[ Godmode ] = register_cvar( "drshop_godmode", "3" ); pCvar[ Speed ] = register_cvar( "drshop_speed", "2" ); pCvar[ Gravity ] = register_cvar( "drshop_gravity", "3" ); pCvar[ Stealth ] = register_cvar( "drshop_stealth", "3" ); pCvar[ Glow ] = register_cvar( "drshop_glow", "2" ); pCvar[ NoSteps ] = register_cvar( "drshop_nosteps", "1" ); pCvar[ Grenade ] = register_cvar( "drshop_grenade", "4" ); pCvar[ Flash ] = register_cvar( "drshop_flash", "3" ); pCvar[ Smoke ] = register_cvar( "drshop_smoke", "2" ); pCvar[ m4a1 ] = register_cvar( "drshop_m4a1", "3" ); pCvar[ ak47 ] = register_cvar( "drshop_ak47", "3" ); pCvar[ awp ] = register_cvar( "drshop_awp", "4" ); pCvar[ dgl ] = register_cvar( "drshop_deagle", "2" ); pCvar[ famas ] = register_cvar( "drshop_famas", "2" ); pCvar[ galil ] = register_cvar( "drshop_galil", "2" ); pCvar[ m3 ] = register_cvar( "drshop_m3", "1" ); pCvar[ mp5 ] = register_cvar( "drshop_mp5", "1" ); g_Vault = nvault_open( "DeathrunShop" );} public plugin_end( ) nvault_close( g_Vault ); public plugin_natives( ){ register_library( "DeathrunNatives" ); register_native( "get_user_points", "GetPoints"); register_native( "set_user_points", "SetPoints");} public GetPoints( plugin, params ) return g_Points[ get_param( 1 ) ]; public SetPoints( plugin, params ){ new client = get_param( 1 ); g_Points[ client ] = max( 0, get_param( 2 ) ); Save( client ); return g_Points[ client ];}public CmdHandle( client ){ if ( get_pcvar_num( pCvar[ OnOff ] ) == 0 ) return PLUGIN_HANDLED; if ( !is_user_alive( client ) ) return ColorPrint( client, "^3 Dead players^1 canno't use the shop." ); new szItem[ 128 ]; formatex( szItem, charsmax( szItem ), "Deathrun Shop^n^n\wYou have\y %d\w Points^n", g_Points[ client ] ); new Menu = menu_create( szItem, "SubHandle" ); menu_additem( Menu, "\dPlayers Points Menu", "0" ); switch ( cs_get_user_team( client ) ) { case CS_TEAM_T: menu_additem( Menu, "Open \rTerrorists\w Shop", "1", 0 ); case CS_TEAM_CT: menu_additem( Menu, "Open \rCounter-Terrorists\w Shop", "1", 0 ); } menu_setprop( Menu, MPROP_NUMBER_COLOR, "\y" ); menu_setprop( Menu, MPROP_EXITNAME, "Exit Shop" ); menu_display( client, Menu, 0 ); return PLUGIN_HANDLED;} public SubHandle( client, Menu, Item ){ if ( get_pcvar_num( pCvar[ OnOff ] ) == 0 ) return PLUGIN_HANDLED; if ( !is_user_alive( client ) ) return ColorPrint( client, "^3 Dead players^1 canno't use the shop." ); if ( Item == MENU_EXIT ) { menu_destroy( Menu ); return PLUGIN_HANDLED; } switch ( cs_get_user_team( client ) ) { case CS_TEAM_T: { switch ( Item ) { case 0: CmdPlayers( client ); case 1: CmdShop( client ); } } case CS_TEAM_CT: { switch ( Item ) { case 0: CmdPlayers( client ); case 1: CmdShop( client ); } } } menu_destroy( Menu ); return PLUGIN_HANDLED;} public CmdShop( client ){ if ( get_pcvar_num( pCvar[ OnOff ] ) == 0 ) return PLUGIN_HANDLED; if ( !is_user_alive( client ) ) return ColorPrint( client, "^3Dead players^1 canno't use the shop." ); new szItem[ 128 ]; switch ( cs_get_user_team( client ) ) { case CS_TEAM_T: { formatex( szItem, charsmax( szItem ), "Deathrun Shop (\rTerrorists\y)^n\wYou have\y %d\w Points^n", g_Points[ client ] ); new Menu = menu_create( szItem, "SubShop" ); menu_additem( Menu, "Powers Shop", "0", 0 ); menu_additem( Menu, "Fun Shop", "1", 0 ); menu_setprop( Menu, MPROP_NUMBER_COLOR, "\y" ); menu_setprop( Menu, MPROP_EXITNAME, "Exit Shop" ); menu_display( client, Menu, 0 ); } case CS_TEAM_CT: { formatex( szItem, charsmax( szItem ), "Deathrun Shop (\rCounter-Terrorists\y)^n\wYou have\y %d\w Points^n", g_Points[ client ] ); new Menu = menu_create( szItem, "SubShop" ); menu_additem( Menu, "Powers Shop", "0", 0 ); menu_additem( Menu, "Fun Shop", "1", 0 ); menu_additem( Menu, "Grenades Shop", "2", 0 ); menu_additem( Menu, "Weapons Shop", "3", 0 ); menu_setprop( Menu, MPROP_NUMBER_COLOR, "\y" ); menu_setprop( Menu, MPROP_EXITNAME, "Exit Shop" ); menu_display( client, Menu, 0 ); } } return PLUGIN_HANDLED;} public SubShop( client, Menu, Item ){ if ( get_pcvar_num( pCvar[ OnOff ] ) == 0 ) return PLUGIN_HANDLED; if ( !is_user_alive( client ) ) return ColorPrint( client, "^3Dead players^1 canno't use the shop." ); if ( Item == MENU_EXIT ) { menu_destroy( Menu ); return PLUGIN_HANDLED; } switch ( Item ) { case 0: CmdPowers( client ); case 1: CmdFun( client ); case 2: CmdGrenades( client ); case 3: CmdWeapons( client ); } menu_destroy( Menu ); return PLUGIN_HANDLED;} public CmdPowers( client ){ if ( get_pcvar_num( pCvar[ OnOff ] ) == 0 ) return PLUGIN_HANDLED; if ( !is_user_alive( client ) ) return ColorPrint( client, "^3Dead players^1 canno't use the shop." ); new szItem[ 128 ]; switch ( cs_get_user_team( client ) ) { case CS_TEAM_T: formatex( szItem, charsmax( szItem ), "Deathrun Shop (\rTerrorists\y)^nPowers Shop^n^n\wYou have\y %d\w Points^n", g_Points[ client ] ); case CS_TEAM_CT: formatex( szItem, charsmax( szItem ), "Deathrun Shop (\rCounter-Terrorists\y)^nPowers Shop^n^n\wYou have\y %d\w Points^n", g_Points[ client ] ); } new Menu = menu_create( szItem, "SubPowers" ); formatex( szItem, charsmax( szItem ), "Choose a Power:\r %s", g_PowersNames[ Val[ client ] ] ); menu_additem( Menu, szItem, "0", 0 ); formatex( szItem, charsmax( szItem ), "Choose Time:\r %.1f", PowerTime[ client ] ); menu_additem( Menu, szItem, "1", 0 ); new frPowers = floatround( PowerTime[ client ] ); Cost[ client ] = get_pcvar_num( pCvar[ g_PowersCost[ Val[ client ] ] ] ) * frPowers; formatex( szItem, charsmax( szItem ), "Purchase \y(\d %d Points \y)", Cost[ client ] ); menu_additem( Menu, szItem, "2", 0 ); menu_setprop( Menu, MPROP_NUMBER_COLOR, "\y" ); menu_setprop( Menu, MPROP_EXITNAME, "Exit Shop" ); menu_display( client, Menu, 0 ); return PLUGIN_HANDLED;} public SubPowers( client, Menu, Item ){ if ( get_pcvar_num( pCvar[ OnOff ] ) == 0 ) return PLUGIN_HANDLED; if ( !is_user_alive( client ) ) return ColorPrint( client, "^3Dead players^1 canno't use the shop." ); if ( Item == MENU_EXIT ) { menu_destroy( Menu ); Cost[ client ] = 0; PowerTime[ client ] = 0.0; Val[ client ] = 0; return PLUGIN_HANDLED; } switch ( Item ) { case 0: { if ( Val[ client ] == MaxPowers - 1 ) { Val[ client ] = 0; CmdPowers( client ); return PLUGIN_HANDLED; } Val[ client ] += 1; CmdPowers( client ); } case 1: { if ( PowerTime[ client ] == 10.0 ) { PowerTime[ client ] = 0.0; CmdPowers( client ); return PLUGIN_HANDLED; } PowerTime[ client ] += 1.0; CmdPowers( client ); } case 2: { if ( PowerTime[ client ] == 0.0 ) return ColorPrint( client, "Time must be greather than^4 0.0^3 seconds^1." ); if ( g_Points[ client ] < Cost[ client ] ) { ColorPrint( client, "Your missing^4 %d^3 Points^1.", Cost[ client ] - g_Points[ client ] ); CmdPowers( client ); return PLUGIN_HANDLED; } switch ( Val[ client ] ) { case 0: { if ( g_Godmode[ client ] ) return ColorPrint( client, "You're already using this^3 power^1." ); set_user_godmode( client, 1 ); g_Godmode[ client ] = true; set_task( PowerTime[ client ], "RemoveGodmode", client ); } case 1: { if ( g_Speed[ client ] ) return ColorPrint( client, "You're already using this^3 power^1." ); MaxSpeed[ client ] = get_user_maxspeed( client ); set_user_maxspeed( client, MaxSpeed[ client ] * 2 ); g_Speed[ client ] = true; set_task( PowerTime[ client ], "RemoveSpeed", client ); } case 2: { if ( g_Gravity[ client ] ) return ColorPrint( client, "You're already using this^3 power^1." ); set_user_gravity( client, 0.6 ); g_Gravity[ client ] = true; set_task( PowerTime[ client ], "RemoveGravity", client ); } case 3: { if ( g_Stealth[ client ] ) return ColorPrint( client, "You're already using this^3 power^1." ); set_user_rendering( client, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 0 ); g_Stealth[ client ] = true; set_task( PowerTime[ client ], "RemoveStealth", client ); } } g_Points[ client ] -= Cost[ client ]; Cost[ client ] = 0; PowerTime[ client ] = 0.0; Val[ client ] = 0; } } menu_destroy( Menu ); return PLUGIN_HANDLED;} /* Remove Powers */public RemoveGodmode( client ){ if ( g_Godmode[ client ] ) { set_user_godmode( client, 0 ); g_Godmode[ client ] = false; }} public RemoveSpeed( client ){ if ( g_Speed[ client ] ) { set_user_gravity( client, 1.0 ); g_Speed[ client ] = false; }} public RemoveGravity( client ){ if ( g_Gravity[ client ] ) { set_user_maxspeed( client, MaxSpeed[ client ] ); g_Gravity[ client ] = false; }} public RemoveStealth( client ){ if ( g_Stealth[ client ] ) { set_user_rendering( client, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 0 ); g_Stealth[ client ] = false; }} public CmdFun( client ){ if ( get_pcvar_num( pCvar[ OnOff ] ) == 0 ) return PLUGIN_HANDLED; if ( !is_user_alive( client ) ) return ColorPrint( client, "^3Dead players^1 canno't use the shop." ); new szItem[ 128 ]; switch ( cs_get_user_team( client ) ) { case CS_TEAM_T: formatex( szItem, charsmax( szItem ), "Deathrun Shop (\rTerrorists\y)^nFun Shop^n^n\wYou have\y %d\w Points^n", g_Points[ client ] ); case CS_TEAM_CT: formatex( szItem, charsmax( szItem ), "Deathrun Shop (\rCounter-Terrorists\y)^nFun Shop^n^n\wYou have\y %d\w Points^n", g_Points[ client ] ); } new Menu = menu_create( szItem, "SubFun" ); formatex( szItem, charsmax( szItem ), "Choose a Fun Item:\r %s", g_FunNames[ Val[ client ] ] ); menu_additem( Menu, szItem, "0", 0 ); formatex( szItem, charsmax( szItem ), "Purchase \y(\d %d Points \y)", get_pcvar_num( pCvar[ g_FunCvars[ Val[ client ] ] ] ) ); menu_additem( Menu, szItem, "1", 0 ); menu_setprop( Menu, MPROP_NUMBER_COLOR, "\y" ); menu_setprop( Menu, MPROP_EXITNAME, "Exit Shop" ); menu_display( client, Menu, 0 ); return PLUGIN_HANDLED;} public SubFun( client, Menu, Item ){ if ( get_pcvar_num( pCvar[ OnOff ] ) == 0 ) return PLUGIN_HANDLED; if ( !is_user_alive( client ) ) return ColorPrint( client, "^3Dead players^1 canno't use the shop." ); if ( Item == MENU_EXIT ) { menu_destroy( Menu ); Val[ client ] = 0; return PLUGIN_HANDLED; } switch ( Item ) { case 0: { if ( Val[ client ] == MaxFun - 1 ) { Val[ client ] = 0; CmdFun( client ); return PLUGIN_HANDLED; } Val[ client ] += 1; CmdFun( client ); } case 1: { if ( g_Points[ client ] < get_pcvar_num( pCvar[ g_FunCvars[ Val[ client ] ] ] ) ) { ColorPrint( client, "Your missing^4 %d^3 Points^1.", get_pcvar_num( pCvar[ g_FunCvars[ Val[ client ] ] ] ) - g_Points[ client ] ); CmdFun( client ); return PLUGIN_HANDLED; } g_Points[ client ] -= get_pcvar_num( pCvar[ g_FunCvars[ Val[ client ] ] ] ); new r = random_num( 50, 255 ); new g = random_num( 50, 255 ); new b = random_num( 50, 255 ); switch ( Val[ client ] ) { case 0: set_user_rendering( client, kRenderFxGlowShell, r, g, b, kRenderNormal, 16 ); case 1: set_user_footsteps( client, 0 ); } Val[ client ] = 0; } } menu_destroy( Menu ); return PLUGIN_HANDLED;}public CmdGrenades( client ){ if ( get_pcvar_num( pCvar[ OnOff ] ) == 0 ) return PLUGIN_HANDLED; if ( !is_user_alive( client ) ) return ColorPrint( client, "^3Dead players^1 canno't use the shop." ); if ( cs_get_user_team( client ) != CS_TEAM_CT ) return ColorPrint( client, "^3Terrorists^1 canno't use the^4 Grenades Shop^1." ); new szItem[ 128 ]; switch ( cs_get_user_team( client ) ) { case CS_TEAM_T: formatex( szItem, charsmax( szItem ), "Deathrun Shop (\rTerrorists\y)^nGrenades Shop^n^n\wYou have\y %d\w Points^n", g_Points[ client ] ); case CS_TEAM_CT: formatex( szItem, charsmax( szItem ), "Deathrun Shop (\rCounter-Terrorists\y)^nGrenades Shop^n^n\wYou have\y %d\w Points^n", g_Points[ client ] ); } new Menu = menu_create( szItem, "SubGrenades" ); formatex( szItem, charsmax( szItem ), "Choose a Grenade:\r %s", g_GrenadesNames[ Val[ client ] ] ); menu_additem( Menu, szItem, "0", 0 ); formatex( szItem, charsmax( szItem ), "Purchase \y(\d %d Points \y)", get_pcvar_num( pCvar[ g_GrenadesCvars[ Val[ client ] ] ] ) ); menu_additem( Menu, szItem, "1", 0 ); menu_setprop( Menu, MPROP_NUMBER_COLOR, "\y" ); menu_setprop( Menu, MPROP_EXITNAME, "Exit Shop" ); menu_display( client, Menu, 0 ); return PLUGIN_HANDLED;}public SubGrenades( client, Menu, Item ){ if ( get_pcvar_num( pCvar[ OnOff ] ) == 0 ) return PLUGIN_HANDLED; if ( !is_user_alive( client ) ) return ColorPrint( client, "^3Dead players^1 canno't use the shop." ); if ( cs_get_user_team( client ) != CS_TEAM_CT ) return ColorPrint( client, "^3Terrorists^1 canno't use the^4 Grenades Shop^1." ); if ( Item == MENU_EXIT ) { menu_destroy( Menu ); Val[ client ] = 0; return PLUGIN_HANDLED; } switch ( Item ) { case 0: { if ( Val[ client ] == MaxGrenades - 1 ) { Val[ client ] = 0; CmdGrenades( client ); return PLUGIN_HANDLED; } Val[ client ] += 1; CmdGrenades( client ); } case 1: { if ( user_has_weapon( client, g_GrenadesIDs[ Val[ client ] ] ) ) { CmdGrenades( client ); return ColorPrint( client, "You already own this item." ); } if ( g_Points[ client ] < get_pcvar_num( pCvar[ g_GrenadesCvars[ Val[ client ] ] ] ) ) { CmdGrenades( client ); return ColorPrint( client, "Your missing^4 %d^3 Points^1.", get_pcvar_num( pCvar[ g_GrenadesCvars[ Val[ client ] ] ] ) - g_Points[ client ] ); } g_Points[ client ] -= get_pcvar_num( pCvar[ g_GrenadesCvars[ Val[ client ] ] ] ); give_item( client, g_GrenadesClass[ Val[ client ] ] ); Val[ client ] = 0; } } menu_destroy( Menu ); return PLUGIN_HANDLED;} public CmdWeapons( client ){ if ( get_pcvar_num( pCvar[ OnOff ] ) == 0 ) return PLUGIN_HANDLED; if ( !is_user_alive( client ) ) return ColorPrint( client, "^3Dead players^1 canno't use the shop." ); if ( cs_get_user_team( client ) != CS_TEAM_CT ) return ColorPrint( client, "^3Terrorists^1 canno't use the^4 Weapons Shop^1." ); new szItem[ 128 ]; switch ( cs_get_user_team( client ) ) { case CS_TEAM_T: formatex( szItem, charsmax( szItem ), "Deathrun Shop (\rTerrorists\y)^nWeapons Shop^n^n\wYou have\y %d\w Points^n", g_Points[ client ] ); case CS_TEAM_CT: formatex( szItem, charsmax( szItem ), "Deathrun Shop (\rCounter-Terrorists\y)^nWeapons Shop^n^n\wYou have\y %d\w Points^n", g_Points[ client ] ); } new Menu = menu_create( szItem, "SubWeapons" ); formatex( szItem, charsmax( szItem ), "Choose a Weapon:\r %s", g_WeaponsNames[ Val[ client ] ] ); menu_additem( Menu, szItem, "0", 0 ); formatex( szItem, charsmax( szItem ), "Amount of Bullets:\r %d", Ammo[ client ] ); menu_additem( Menu, szItem, "0", 0 ); formatex( szItem, charsmax( szItem ), "Purchase \y(\d %d Points \y)", get_pcvar_num( pCvar[ g_GrenadesCvars[ Val[ client ] ] ] ) * Ammo[ client ] ); menu_additem( Menu, szItem, "1", 0 ); menu_setprop( Menu, MPROP_NUMBER_COLOR, "\y" ); menu_setprop( Menu, MPROP_EXITNAME, "Exit Shop" ); menu_display( client, Menu, 0 ); return PLUGIN_HANDLED;} public SubWeapons( client, Menu, Item ){ if ( get_pcvar_num( pCvar[ OnOff ] ) == 0 ) return PLUGIN_HANDLED; if ( !is_user_alive( client ) ) return ColorPrint( client, "^3Dead players^1 canno't use the shop." ); if ( cs_get_user_team( client ) != CS_TEAM_CT ) return ColorPrint( client, "^3Terrorists^1 canno't use the^4 Weapons Shop^1." ); if ( Item == MENU_EXIT ) { menu_destroy( Menu ); Val[ client ] = 0; Ammo[ client ] = 0; return PLUGIN_HANDLED; } switch ( Item ) { case 0: { if ( Val[ client ] == MaxWeapons - 1 ) { Val[ client ] = 0; CmdGrenades( client ); return PLUGIN_HANDLED; } Val[ client ] += 1; Ammo[ client ] = 0; CmdWeapons( client ); } case 1: { if ( Ammo[ client ] == g_WeaponsMax[ Val[ client ] ] ) { Ammo[ client ] = 0; CmdWeapons( client ); return PLUGIN_HANDLED; } Ammo[ client ] += 1; CmdWeapons( client ); } case 2: { if ( user_has_weapon( client, g_WeaponsIDs[ Val[ client ] ] ) ) { CmdWeapons( client ); return ColorPrint( client, "You already own this item." ); } if ( Ammo[ client ] == 0 ) { CmdWeapons( client ); return ColorPrint( client, "Ammo must be greather than^4 0^3 Bullets^1." ); } if ( g_Points[ client ] < get_pcvar_num( pCvar[ g_WeaponsCvars[ Val[ client ] ] ] ) * Ammo[ client ] ) { CmdWeapons( client ); return ColorPrint( client, "Your missing^4 %d^3 Points^1.", get_pcvar_num( pCvar[ g_WeaponsCvars[ Val[ client ] ] ] ) * Ammo[ client ] - g_Points[ client ] ); } g_Points[ client ] -= get_pcvar_num( pCvar[ g_WeaponsCvars[ Val[ client ] ] ] ); give_item( client, g_WeaponsClass[ Val[ client ] ] ); cs_set_user_bpammo( client, g_WeaponsIDs[ Val[ client ] ], 0 ); cs_set_weapon_ammo( find_ent_by_owner( -1, g_WeaponsClass[ Val[ client ] ], client ), Ammo[ client ] ); Val[ client ] = 0; Ammo[ client ] = 0; } } menu_destroy( Menu ); return PLUGIN_HANDLED;} public CmdPlayers( client ){ if ( get_pcvar_num( pCvar[ OnOff ] ) == 0 ) return PLUGIN_HANDLED; new szItem[ 128 ]; formatex( szItem, charsmax( szItem ), "Deathrun Shop^nPlayers Points^n^n\wYou have\y %d\w Points^n", g_Points[ client ] ); new Menu = menu_create( szItem, "SubPlayers" ); new szPlayers[ 32 ], PNum, szTempid[ 10 ], szName[ 32 ]; get_players( szPlayers, PNum, "c" ); for ( new i; i < PNum; i++ ) { new Clients = szPlayers[ i ]; num_to_str( Clients, szTempid, charsmax( szTempid ) ); get_user_name( Clients, szName, charsmax( szName ) ); formatex( szItem, charsmax( szItem ), "%s \y(\d %d Points \y)", szName, g_Points[ Clients ] ); menu_additem( Menu, szItem, szTempid, 0 ); } menu_setprop( Menu, MPROP_NUMBER_COLOR, "\y" ); menu_display( client, Menu ); return PLUGIN_HANDLED; } public SubPlayers( client, Menu, Item ){ if ( get_pcvar_num( pCvar[ OnOff ] ) == 0 ) return PLUGIN_HANDLED; if ( Item == MENU_EXIT ) { menu_destroy( Menu ); return PLUGIN_HANDLED; } CmdPlayers( client ); menu_destroy( Menu ); return PLUGIN_HANDLED;} /* Add and Remove points publics */ public CmdAddPoints( client ){ if ( !( get_user_flags( client ) & CmdAccess ) ) return console_print( client, "You have no access to this command." ); new g_Target[ 32 ], Amount[ 21 ]; read_argv( 1, g_Target, charsmax( g_Target ) ); read_argv( 2, Amount, charsmax( Amount ) ); new g_Player = cmd_target( client, g_Target, 8 ); if ( !g_Player ) return console_print( client, "Player was not found!" ); if ( !str_to_num( Amount ) ) return console_print( client, "You need to type only valid numbers!" ); static szName[ 32 ], szName2[ 32 ]; static szAuthid[ 32 ], szAuthid2[ 32 ]; get_user_name( client, szName, sizeof (szName) - 1 ); get_user_name( g_Player, szName2, sizeof (szName2) - 1 ); get_user_authid( client, szAuthid, sizeof (szAuthid) - 1); get_user_authid( g_Player, szAuthid2, sizeof (szAuthid2) - 1); new g_Amount = str_to_num( Amount ); if ( g_Amount <= 0 ) return console_print( client, "You must type a number that is bigger than 0" ); log_amx( "%s ( %s ) Added %d Points to %s ( %s )", szName, szAuthid, g_Amount, szName2, szAuthid2 ); switch ( get_cvar_num( "amx_show_activity" ) ) { case 1: ColorPrint( 0, "^3ADMIN:^3 Added^4 %d^3 Points^1 to^4 %s^1.", g_Amount, szName2 ); case 2: ColorPrint( 0, "^3ADMIN:^4 %s^3 Added^4 %d^3 Points^1 to^4 %s^1.", szName, g_Amount, szName2 ); } g_Points[ g_Player ] += g_Amount; if ( g_Points[ g_Player ] < 0 ) g_Points[ g_Player ] = 0; Save( client ); return PLUGIN_HANDLED;} public CmdRemovePoints( client ){ if ( !( get_user_flags( client ) & CmdAccess ) ) return console_print( client, "You have no access to this command." ); new g_Target[ 32 ], Amount[ 21 ]; read_argv( 1, g_Target, charsmax( g_Target ) ); read_argv( 2, Amount, charsmax( Amount ) ); new g_Player = cmd_target( client, g_Target, 8 ); if ( !g_Player ) return console_print( client, "Player was not found!" ); if ( !str_to_num( Amount ) ) return console_print( client, "You need to type only valid numbers!" ); static szName[ 32 ], szName2[ 32 ]; static szAuthid[ 32 ], szAuthid2[ 32 ]; get_user_name( client, szName, sizeof (szName) - 1 ); get_user_name( g_Player, szName2, sizeof (szName2) - 1 ); get_user_authid( client, szAuthid, sizeof (szAuthid) - 1); get_user_authid( g_Player, szAuthid2, sizeof (szAuthid2) - 1); new g_Amount = str_to_num( Amount ); if ( g_Amount <= 0 ) return console_print( client, "You must type a number that is bigger than 0" ); log_amx( "%s ( %s ) Removed %d Points to %s ( %s )", szName, szAuthid, g_Amount, szName2, szAuthid2 ); switch ( get_cvar_num( "amx_show_activity" ) ) { case 1: ColorPrint( 0, "^3ADMIN:^3 Removed^4 %d^3 Points^1 to^4 %s^1.", g_Amount, szName2 ); case 2: ColorPrint( 0, "^3ADMIN:^4 %s^3 Removed^4 %d^3 Points^1 to^4 %s^1.", szName, g_Amount, szName2 ); } g_Points[ g_Player ] -= g_Amount; if ( g_Points[ g_Player ] < 0 ) g_Points[ g_Player ] = 0; Save( client ); return PLUGIN_HANDLED;}/* Events and Forwards */public evCurWeapon( client ){ if ( get_pcvar_num( pCvar[ OnOff ] ) == 0 ) return PLUGIN_HANDLED; if ( g_Speed[ client ] ) set_user_maxspeed( client, MaxSpeed[ client ] * 2 ); if ( g_Gravity[ client ] ) set_user_gravity( client, 0.6 ); return PLUGIN_HANDLED;} public evDeathMsg( ){ if ( get_pcvar_num( pCvar[ OnOff ] ) == 0 ) return PLUGIN_HANDLED; new Killer = read_data( 1 ); new Victim = read_data( 2 ); if ( Killer == Victim ) return ColorPrint( Victim, "You lost^3 %d^4 Points^1 for committing a suicide.", get_pcvar_num( pCvar[ suicide ] ) ); if ( !is_user_alive( Killer ) || is_user_alive( Victim ) || !is_user_connected( Killer ) || !is_user_connected( Victim ) ) return PLUGIN_HANDLED; if ( cs_get_user_team( Killer ) == CS_TEAM_T || cs_get_user_team( Victim ) == CS_TEAM_CT ) { ColorPrint( Killer, "You recieved^3 %d^4 Points^1.", get_pcvar_num( pCvar[ tkill ] ) ); g_Points[ Killer ] += get_pcvar_num( pCvar[ tkill ] ); } if ( cs_get_user_team( Killer ) == CS_TEAM_CT || cs_get_user_team( Victim ) == CS_TEAM_T ) { if ( get_pcvar_num( pCvar[ kill ] ) == 0 ) { new szPlayers[ 32 ], PNum; get_players( szPlayers, PNum, "c" ); g_Points[ Killer ] += PNum; ColorPrint( Killer, "You recieved^3 %d^4 Points^1.", PNum ); } else { ColorPrint( Killer, "You recieved^3 %d^4 Points^1.", get_pcvar_num( pCvar[ kill ] ) ); g_Points[ Killer ] += get_pcvar_num( pCvar[ kill ] ); } } return PLUGIN_HANDLED;} public fwClientSpawn( client ){ if ( get_pcvar_num( pCvar[ OnOff ] ) == 0 ) return PLUGIN_HANDLED; show_menu( client, 0, "^n", 1 ); RemoveGodmode( client ); RemoveSpeed( client ); RemoveGravity( client ); set_user_rendering( client, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 0 ); set_user_footsteps( client, 1 ); return PLUGIN_HANDLED;} /* Save & Load & Client Stuff */ public Save( client ){ if ( get_pcvar_num( pCvar[ OnOff ] ) == 0 ) return PLUGIN_HANDLED; new szSave[ 35 ], szKey[ 40 ], szPoints[ 7 ]; switch ( get_pcvar_num( pCvar[ Savetype ] ) ) { case 0: get_user_name( client, szSave, charsmax( szSave ) ); case 1: get_user_ip( client, szSave, charsmax( szSave ) ); default: get_user_authid( client, szSave, charsmax( szSave ) ); } formatex( szKey, charsmax( szKey ), "%sCASH", szSave ); formatex( szPoints , charsmax( szPoints ) , "%d" , g_Points[ client ] ); nvault_set( g_Vault , szKey , szPoints ); return PLUGIN_HANDLED;} public Load( client ){ if ( get_pcvar_num( pCvar[ OnOff ] ) == 0 ) return PLUGIN_HANDLED; new szSave[ 35 ], szKey[ 40 ]; switch ( get_pcvar_num( pCvar[ Savetype ] ) ) { case 0: get_user_name( client, szSave, charsmax( szSave ) ); case 1: get_user_ip( client, szSave, charsmax( szSave ) ); default: get_user_authid( client, szSave, charsmax( szSave ) ); } formatex( szKey , charsmax( szKey ) , "%sCASH" , szSave ) ; new iPoints = nvault_get( g_Vault , szKey ); if ( iPoints ) { g_Points[ client ] = iPoints; nvault_remove( g_Vault , szKey ); } return PLUGIN_HANDLED;} public client_putinserver( client ){ if ( get_pcvar_num( pCvar[ OnOff ] ) == 0 ) return PLUGIN_HANDLED; Load( client ); if ( g_Points[ client ] > 10000 ) g_Points[ client ] = 10000; return PLUGIN_CONTINUE;} public client_disconnect( client ){ if ( get_pcvar_num( pCvar[ OnOff ] ) == 0 ) return PLUGIN_HANDLED; if ( g_Points[ client ] > 10000 ) g_Points[ client ] = 10000; Save( client ); return PLUGIN_CONTINUE;} public CmdSay( client ){ new szMsg[ 192 ], Arg[ 38 ], Arg2[ 38 ], Arg3[ 38 ], szName[ 2 ][ 32 ]; read_argv( 1, szMsg, charsmax( szMsg ) ); parse( szMsg, Arg, charsmax( Arg ), Arg2, charsmax( Arg2 ) , Arg3, charsmax( Arg3 ) ); get_user_name( client, szName[ 0 ], sizeof (szName[ ]) - 1 ); if ( equal( szMsg, "/shop" ) ) return CmdHandle( client ); if( equal( Arg, "/points" ) ) { if ( get_pcvar_num( pCvar[ OnOff ] ) == 0 ) return PLUGIN_HANDLED; new g_Target = cmd_target( client, Arg2, 8 ); get_user_name( g_Target, szName[ 1 ], sizeof (szName[ ]) - 1 ); if ( equali( szMsg, "/points" ) ) return ColorPrint( client, "^4%s^1 have^3 %d^4 Points^1.", szName[ 0 ], g_Points[ client ] ); if( !g_Target ) return ColorPrint( client, "Player ^3(^4%s^3)^1 was not found!", Arg2 ); return ColorPrint( client, "^4%s^1 have^3 %d^4 Points^1.", szName[ 1 ], g_Points[ g_Target ] ); } if( equal( Arg, "/gamble" ) ) { if ( get_pcvar_num( pCvar[ OnOff ] ) == 0 ) return PLUGIN_HANDLED; if( !is_str_num( Arg2 ) ) return ColorPrint( client, "Syntax: /^4gamble^1 <^4amount^1>" ); new g_Amount = str_to_num( Arg2 ); if ( g_Amount < 1 ) return ColorPrint( client, "The minimum amount to gamble on is^3 1^4 Points^1." ); if ( g_Amount > 50 ) return ColorPrint( client, "The maximum amount to gamble on is^3 50^4 Points^1." ); if ( g_Amount >= 10000 ) return ColorPrint( client, "You have the maximum amount of^4 Points^3 Allowed^1." ); if ( g_Amount > g_Points[ client ] ) return ColorPrint( client, "You don't have this amount of^4 Points^1." ); switch( random_num( 1, 100 ) ) { case 1..50: { ColorPrint( 0, "^4%s^1 just gambled on^3 %d^4 Points^1 and^4 Won!", szName[ 0 ], g_Amount ); g_Points[ client ] += g_Amount; } case 51..100: { ColorPrint( 0, "^4%s^1 just gambled on^3 %d^4 Points^1 and^4 Lost!", szName[ 0 ], g_Amount ); g_Points[ client ] -= g_Amount; } } Save( client ); return PLUGIN_HANDLED; } if( equal( Arg, "/send" ) ) { if ( get_pcvar_num( pCvar[ OnOff ] ) == 0 ) return PLUGIN_HANDLED; new g_Target = cmd_target( client, Arg2, 8 ); if ( equali( szMsg, "/send" ) ) return ColorPrint( client, "Syntax: /^4send^1 <^4name^1> <^4amount^1>" ); if( !g_Target ) return ColorPrint( client, "Player ^3(^4%s^3)^1 was not found!", Arg2 ); if ( client == g_Target ) return ColorPrint( client, "You canno't^4 send^3 points^1 to yourself!" ); if( !is_str_num( Arg3 ) ) return ColorPrint( client, "You must type^4 valid numbers^1." ); new g_Amount = str_to_num( Arg3 ); if( g_Amount < 1 ) return ColorPrint( client, "The minimum amount to send on is^3 1^4 Points^1." ); if ( g_Amount > g_Points[ client ] ) return ColorPrint( client, "You don't have this amount of^4 Points^1." ); get_user_name( g_Target, szName[ 1 ], sizeof (szName[ ]) - 1 ); ColorPrint( 0, "^4%s^1 sent^3 %d^4 Points^1 to^3 %s^1.", szName[ 0 ], g_Amount, szName[ 1 ] ); g_Points[ client ] -= g_Amount; g_Points[ g_Target ] += g_Amount; Save( client ); Save( g_Target ); return PLUGIN_HANDLED; } return PLUGIN_CONTINUE;}/* Stocks And Make File */stock ColorPrint( const client, const string[], any:... ){ new msg[ 191 ], players[ 32 ], count = 1, g_Prefix[ 10 ]; get_pcvar_string( pCvar[ Prefix ], g_Prefix, charsmax( g_Prefix ) ); static len; len = formatex( msg, charsmax( msg ), "^1[^4 %s ^1] ", g_Prefix ); vformat( msg[ len ], charsmax( msg ) - len, string, 3 ); if( client ) players[ 0 ] = client; else get_players( players,count,"ch" ); for ( new i = 0; i < count; i++ ) { if( is_user_connected( players[ i ] ) ) { message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, players[ i ] ); write_byte( players[ i ] ); write_string( msg ); message_end( ); } } return PLUGIN_HANDLED;}
Users browsing this forum: Amazon [Bot], Bing [Bot], Google [Bot] and 3 guests