From 25 errors to 5 errors fix rest your self or someone else might do
PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <nvault>
#include <hamsandwich>
#include <fakemeta>
/* Admin level for access menu */
#define ADMIN_ACCESS_CMD ADMIN_IMMUNITY
#define PLUGIN "Dr Shop for SG"
#define VERSION "1.0"
#define AUTHOR "Teckins"
// fixed whats directly under this forgot a few on end.
new gDrShopOn, gHealthCost, gArmorCost,gSpeedCost, gGravityCost, gSpeedCvar, gGravityCvar, gHealthPointCvar, gArmorPointCvar, gAdvertiseCvar, gKillerPointsCvar, gSuiciderPointsCvar, gSavePlayerPoints;
new HasHealth[ 33 ];
new HasArmor[ 33 ];
new HasSpeed[ 33 ];
new HasGravity[ 33 ];
new gName[ 32 char ];
new gSteamID[ 32 ];
new vKey[ 64 ];
new vData[ 64 ];
new gKillerPoints[ 33 ];
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_cvar( "drshop_version", VERSION, FCVAR_SERVER | FCVAR_SPONLY );
register_logevent( "logevent_round_start", 2, "1=Round_Start" );
register_event( "DeathMsg", "Hook_Deathmessage", "a" );
register_event( "CurWeapon", "HookCurWeapon", "be", "1=1" );
register_concmd( "amx_set_points", "cmdSetPoints", ADMIN_ACCESS_CMD, "<name/@all> <points> - sets points to a player" );
register_concmd( "amx_reset_points", "cmdResetPoints", ADMIN_ACCESS_CMD, "<name/@all> - resets player/players points" );
register_clcmd( "say /shop", "DeathrunShop" );
register_clcmd( "say_team /shop", "DeathrunShop" );
register_clcmd( "say /mypoints", "ShowPoints" );
register_clcmd( "say_team /mypoints", "ShowPoints" );
gDrShopOn = register_cvar( "amx_shop", "1" );
gHealthCost = register_cvar( "deathrun_health_cost", "30" );
gArmorCost = register_cvar( "deathrun_armor_cost", "15" );
gSpeedCost = register_cvar( "deathrun_speed_cost", "39" );
gGravityCost = register_cvar( "deathrun_gravity_cost", "41" );
gGravityCvar = register_cvar( "deathrun_gravity_power", "0.7" );
gAdvertiseCvar = register_cvar( "deathrun_advertise_message", "1" );
gHealthPointCvar = register_cvar( "deathrun_health_points", "255" );
gArmorPointCvar = register_cvar( "deathrun_armor_points", "400" );
gKillerPointsCvar = register_cvar( "deathrun_killer_bonuspoints", "5" );
gSuiciderPointsCvar = register_cvar( "deathrun_suicider_loose_points", "3" );
gSavePlayerPoints = register_cvar( "amx_save_points", "1" );
register_dictionary( "DeathrunShopLang.txt" );
} // You forgot this.
public plugin_cfg()
new iCfgDir[ 32 ], iFile[ 192 ];
get_configsdir( iCfgDir, charsmax( iCfgDir) );
formatex( iFile, charsmax( iFile ), "%s/DeathrunShop_Cfg.cfg", iCfgDir );
if( !file_exists( iFile ) )
server_print( "[DrShop] %L", LANG_SERVER, "DRSHOP_SVPRINT", iFile );
write_file( iFile, " ", -1 );
server_print( "[DrShop] %L", LANG_SERVER, "DRSHOP_SVPRINT_DONE", iFile );
server_cmd( "exec %s", iFile );
server_cmd( "sv_maxspeed 99999999.0" );
}
public client_connect( id )
{
HasHealth[ id ] = false;
HasArmor[ id] = false;
HasSpeed[ id ] = false;
HasGravity[ id ] = false;
load_client_points( id );
public client_disconnect( id )
{
HasHealth[ id ] = false;
HasArmor[ id] = false;
HasSpeed[ id ] = false;
HasGravity[ id ] = false;
if( get_pcvar_num( gSavePlayerPoints ) != 0 && !is_user_bot( id ) )
save_client_points( id );
public client_putinserver( id )
{
if( get_pcvar_num( gAdvertiseCvar ) != 0 )
{
/* --| Need to set task, 7 default because need to wait for player choosing a team or something */
set_task( get_pcvar_float( gAdvertiseTimeCvar ), "ShowPlayerInfo", id );
}
if( get_pcvar_num( gDrShopOn ) != 1 )
{
client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_DISABLED" );
return PLUGIN_HANDLED;
}
/* --| If player is dead, cant buy items :) */
if( !is_user_alive( id ) )
{
client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_ONLY_ALIVE" );
return PLUGIN_HANDLED;
}
/* --| Menu */
new szText[ 555 char ];
formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_MENU_TITLE", VERSION, gKillerPoints[ id ] );
new menu = menu_create( szText, "shop_handler" );
* --| Menu item 1 */
formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_ITEM_4", get_pcvar_num( gHealthPointCvar ), get_pcvar_num( gHealthCost ) );
menu_additem( menu, szText, "4", 0 );
/* --| Menu item 2 */
formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_ITEM_5", get_pcvar_num( gArmorPointCvar ), get_pcvar_num( gArmorCost ) );
menu_additem( menu, szText, "5", 0 );
/* --| Menu item 3 */
formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_ITEM_6", get_pcvar_num( gSpeedCost ) );
menu_additem( menu, szText, "6", 0 );
/* --| Menu item 4 */
formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_ITEM_7", get_pcvar_num( gGravityCost ) );
menu_additem( menu, szText, "7", 0 );
menu_setprop( menu, MPROP_EXIT, MEXIT_ALL );
/* --| Show the menu, with current page 0 */
menu_display( id, menu, 0 );
return PLUGIN_CONTINUE;
public shop_handler( id, menu, item )
{
/* --| If key is 0, let's close the menu */
if( item == MENU_EXIT )
{
menu_destroy( menu );
return PLUGIN_HANDLED;
}
/* --| Getting the menu information */
new data[ 6 ], iName[ 64 ], access, callback;
menu_item_getinfo( menu, item, access, data, charsmax( data ), iName, charsmax( iName ), callback );
/* --| Get menu keys */
new key = str_to_num( data );
/* --| Here we find the player points */
new points = gKillerPoints[ id ];
switch( key )
{
/* --| Menu item 1 */
case 1:
{
/* --| If already has item, show a damn print and return */
if( HasHealth[ id ] )
{
allready_have( id );
return PLUGIN_HANDLED;
}
/* --| If player does not have enough points, show a print and return */
if( points < get_pcvar_num( gHealthCost ) )
{
dont_have( id );
return PLUGIN_HANDLED;
}
/* --| Let's give the item, and do some stuff */
set_user_health( id, get_user_health( id ) + get_pcvar_num( gHealthPointCvar ) );
client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_HEALTH_ITEM", get_pcvar_num( gHealthPointCvar ) );
HasHealth[ id ] = true;
gKillerPoints[ id ] -= get_pcvar_num( gHealthCost );
emit_sound( id, CHAN_ITEM, HEALTH_SOUND, VOL_NORM , ATTN_NORM , 0 , PITCH_NORM );
menu_display( id, menu, 0 );
}
/* --| Menu item 2 */
case 2:
{
/* --| If already has item, show a damn print and return */
if( HasArmor[ id ] )
{
allready_have( id );
return PLUGIN_HANDLED;
}
/* --| If player does not have enough points, show a print and return */
if( points < get_pcvar_num( gArmorCost ) )
{
dont_have( id );
return PLUGIN_HANDLED;
}
/* --| Let's give the item, and do some stuff */
set_user_armor( id, get_user_armor( id ) + get_pcvar_num( gArmorPointCvar ) );
client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_ARMOR_ITEM", get_pcvar_num( gArmorPointCvar ) );
HasArmor[ id ] = true;
gKillerPoints[ id ] -= get_pcvar_num( gArmorCost );
emit_sound( id, CHAN_ITEM, ARMOR_SOUND, VOL_NORM , ATTN_NORM , 0 , PITCH_NORM );
menu_display( id, menu, 0 );
}
/* --| Menu item 3 */
case 3:
{
/* --| If already has item, show a damn print and return */
if( HasSpeed[ id ] )
{
allready_have( id );
return PLUGIN_HANDLED;
}
/* --| If player does not have enough points, show a print and return */
if( points < get_pcvar_num( gSpeedCost ) )
{
dont_have( id );
return PLUGIN_HANDLED;
}
/* --| Let's give the item, and do some stuff */
set_user_maxspeed( id, get_pcvar_float( gSpeedCvar ) );
client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_SPEED_ITEM" );
HasSpeed[ id ] = true;
gKillerPoints[ id ] -= get_pcvar_num( gSpeedCost );
emit_sound( id, CHAN_ITEM, PICKUP_SND, VOL_NORM , ATTN_NORM , 0 , PITCH_NORM );
menu_display( id, menu, 0 );
}
/* --| Menu item 4 */
case 4:
{
/* --| If already has item, show a damn print and return */
if( HasGravity[ id ] )
{
allready_have( id );
return PLUGIN_HANDLED;
}
/* --| If player does not have enough points, show a print and return */
if( points < get_pcvar_num( gGravityCost ) )
{
dont_have( id );
return PLUGIN_HANDLED;
}
/* --| Let's give the item, and do some stuff */
set_user_gravity( id, get_pcvar_float( gGravityCvar ) );
client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_GRAVITY_ITEM" );
HasGravity[ id ] = true;
gKillerPoints[ id ] -= get_pcvar_num( gGravityCost );
emit_sound( id, CHAN_ITEM, PICKUP_SND, VOL_NORM , ATTN_NORM , 0 , PITCH_NORM );
menu_display( id, menu, 0 );
}
return PLUGIN_HANDLED;
}
/* --| Command for setting points | admin only ;/ */
public cmdSetPoints( id, level, cid )
{
/* --| If user doesn't have acces to command, return */
if( !cmd_access( id, level, cid, 2 ) || !get_pcvar_num( gDrShopOn ) )
{
return PLUGIN_HANDLED;
}
/* --| Need to read the first argument */
new argument[ 32 ];
read_argv( 1, argument, charsmax( argument ) );
/* --| Need to read second argument */
new give_points[ 5 ];
read_argv( 2, give_points, charsmax( give_points ) );
/* --| We are getting the gift from second argument */
new gift = str_to_num( give_points );
new iPlayer[ 32 ], iNum, all;
get_players( iPlayer, iNum, "c" );
/* --| Lets see if argument 1 is @all */
if( equal( argument, "@all" ) )
{
for( new i; i < iNum; i++ )
{
/* --| Find the index :) */
all = iPlayer[ i ];
/* --| Set points to all */
gKillerPoints[ all ] = gKillerPoints[ all ] + gift;
/* --| Show a print in chat */
get_user_name( id, gName, charsmax( gName ) );
client_print( 0, print_chat, "[DrShop] %L", LANG_PLAYER, "DRSHOP_SHOW_ALLCMD", gName, gift );
}
}
else
{
/* --| Now, we find the target */
new player = cmd_target( id, argument, 10 );
/* --| If is not a valid target, return */
if( !player )
{
return PLUGIN_HANDLED;
}
/* --| Get admin, and target name */
new TargetName[ 32 char ];
get_user_name( player, TargetName, charsmax( TargetName ) );
get_user_name( id, gName, charsmax( gName ) );
/* --| Setting target points */
gKillerPoints[ player ] = gKillerPoints[ player ] + gift;
client_print( 0, print_chat, "[DrShop] %L", LANG_PLAYER, "DRSHOP_SHOW_CMD", gName, gift, TargetName );
}
return PLUGIN_HANDLED;
}
/* --| Command for reseting points | admin only ;/ */
public cmdResetPoints( id, level, cid )
{
/* --| If user doesn't have acces to command, return */
if( !cmd_access( id, level, cid, 2 ) || !get_pcvar_num( gDrShopOn ) )
{
return PLUGIN_HANDLED;
}
/* --| Need to read the first argument */
new argument[ 32 ];
read_argv( 1, argument, charsmax( argument ) );
new iPlayer[ 32 ], iNum, all;
get_players( iPlayer, iNum, "c" );
/* --| Lets see if argument 1 is @all */
if( equal( argument, "@all" ) )
{
for( new i; i < iNum; i++ )
{
/* --| Find the index :) */
all = iPlayer[ i ];
/* --| Set points to all */
gKillerPoints[ all ] = 0;
/* --| Show a print in chat */
get_user_name( id, gName, charsmax( gName ) );
client_print( 0, print_chat, "[DrShop] %L", LANG_PLAYER, "DRSHOP_SHOWRESET_ALLCMD", gName );
}
}
else
{
/* --| Now, we find the target */
new player = cmd_target( id, argument, 10 );
/* --| If is not a valid target, return */
if( !player )
{
return PLUGIN_HANDLED;
}
/* --| Get admin, and target name */
new TargetName[ 32 char ];
get_user_name( player, TargetName, charsmax( TargetName ) );
get_user_name( id, gName, charsmax( gName ) );
/* --| Setting target points */
gKillerPoints[ player ] = 0;
client_print( 0, print_chat, "[DrShop] %L", LANG_PLAYER, "DRSHOP_SHOWRESET_CMD", gName, TargetName );
}
return PLUGIN_HANDLED;
}
/* --| We need to find if player has performed a jump, and set some velocity */
public bacon_playerJumping( id )
{
/* --| If plugin is on, and user has jetpack item */
if( get_pcvar_num( gDrShopOn ) != 0 && HasJet[ id ] )
{
/* --| Get user origins from feet */
new iOrigin[ 3 ];
get_user_origin( id, iOrigin, 0 );
/* --| Modify origin a bit */
iOrigin[ 2 ] -= 20;
/* --| Get player velocity */
new Float:fVelocity[ 3 ];
pev( id, pev_velocity, fVelocity );
/* --| Modify velocity a bit */
fVelocity[ 2 ] += 93;
/* --| Set the player velocity and add a flame effect, jetpack style */
set_pev( id, pev_velocity, fVelocity );
create_flame( iOrigin );
}
}
/* --| We need to check is player has changed his weapon */
public HookCurWeapon( id )
{
/* --| If plugin is on, and user has speed item, let's set the speed again */
if( get_pcvar_num( gDrShopOn ) != 0 && HasSpeed[ id ] )
{
set_user_maxspeed( id, get_pcvar_float( gSpeedCvar ) );
}
}
/* --| Command for show points */
public ShowPoints( id )
{
/* --| Set a hud message */
set_hudmessage( 255, 42, 212, 0.03, 0.86, 2, 6.0, 5.0 );
/* --| We show player points on hud */
show_hudmessage( id, "[DrShop] %L", id, "DRSHOP_POINTS_INFO", gKillerPoints[ id ] );
/* --| We show player points on chat */
client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_POINTS_INFO", gKillerPoints[ id ] );
return PLUGIN_CONTINUE;
}
/* --| Here we show player hud information about this god damn shop */
public ShowPlayerInfo( id )
{
/* --| Set a hud message */
set_hudmessage( 0, 0, 255, -1.0, 0.82, 0, 6.0, 12.0 );
/* --| Now we show the info message in hud channel */
show_hudmessage( id, "%L", id, "DRSHOP_HUD_INFO" );
}
/* --| If player has suicided by console */
public forward_kill( id )
{
/* --| Check if plugin is on, and user is alive */
if( get_pcvar_num( gDrShopOn ) == 1 && is_user_alive( id ) )
{
/* --| Set player points with suicide cvar */
client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_SHOW_LOOSER", get_pcvar_num( gSuiciderPointsCvar ) );
gKillerPoints[ id ] -= get_pcvar_num( gSuiciderPointsCvar );
}
}
/* --| Event for round start */
public logevent_round_start()
{
/* --| If plugin is on... */
if( get_pcvar_num( gDrShopOn ) == 1 )
{
/* --| I used this native because with get_maxplayers will recieve a damn error with invalid player id.. */
/* --| This is good because we can skip the damn bots */
new iPlayers[ 32 ], iNum, i, id;
get_players( iPlayers, iNum, "c" );
for( i = 0; i < iNum; i++ )
{
/* --| Find the index :) */
id = iPlayers[ i ];
HasHealth[ id ] = false;
HasArmor[ id] = false;
HasSpeed[ id ] = false;
HasGravity[ id ] = false;
set_user_gravity( id, 1.0 );
public Hook_Deathmessage()
{
/* --| If plugin is on... */
if( get_pcvar_num( gDrShopOn ) == 1 )
{
/* --| Get the killer and attacker */
new killer = read_data( 1 );
new victim = read_data( 2 );
/* --| If player has died with world / trigger_hurt */
if( killer == victim )
{
return PLUGIN_HANDLED;
}
/* --| Setting killer points when killed a enemy */
gKillerPoints[ killer ] += get_pcvar_num( gKillerPointsCvar );
HasHealth[ victim ] = false;
HasArmor[ victim ] = false;
HasSpeed[ victim ] = false;
HasGravity[ victim ] = false;
set_user_gravity( victim, 1.0 );
remove_task( victim );
}
return PLUGIN_CONTINUE;
}
stock allready_have( id )
{
client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_ALLREADY_HAVE" );
}
/* --| Display a message in chat if player don't have enough points */
stock dont_have( id )
{
client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_DONTHAVE_POINTS" );
}
/* --| Saving player points */
stock save_client_points( index )
{
/* --| Open the vault file */
gVault = nvault_open( "DeathrunShop_SavedPoints" );
/* --| If vault return -1, lets stop this shit */
if( gVault == INVALID_HANDLE )
{
set_fail_state( "[DrShop] nValut ERROR: =-> Invalid-Handle" );
}
/* --| Get the player steamid */
get_user_authid( index, gSteamID, charsmax( gSteamID ) );
/* --| Setting stuff on vault file, and close the file */
formatex( vKey, charsmax( vKey ), "%sPOINTS", gSteamID );
formatex( vData, charsmax( vData ), "%d", gKillerPoints[ index ] );
nvault_set( gVault, vKey, vData );
nvault_close( gVault );
}
/* --| Loading client points */
stock load_client_points( index )
{
/* --| Open the vault file */
gVault = nvault_open( "DeathrunShop_SavedPoints" );
/* --| If vault return -1, lets stop this shit */
if( gVault == INVALID_HANDLE )
{
set_fail_state( "[DrShop] nValut ERROR: =-> Invalid-Handle" );
}
/* --| Get the player steamid */
get_user_authid( index, gSteamID, charsmax( gSteamID ) );
/* --| Get the player points, then, close the nvault vile */
formatex( vKey, charsmax( vKey ), "%sPOINTS", gSteamID );
gKillerPoints[ index ] = nvault_get( gVault, vKey );
nvault_close( gVault );
set_pdata_int( index, m_iNvg, 0, m_iLinuxDiff );
}