Raised This Month: $ Target: $400
 0% 

[ReQ] Pls help me fast


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
bare380
Junior Member
Join Date: Jul 2012
Location: Iran
Old 01-13-2013 , 13:23   [ReQ] Pls help me fast
Reply With Quote #1

Hello Guys,
What's wrong with this plugin :
PHP Code:
/*
 * AMX Mod plugin
 *
 * Vip_Shop, v1.0
 *
 * (c) Copyright 2013 - Nevermore
 * This Plugin Is Created By Barbod Nevermore.
 *
 */
/*
 * Description:
 * This plugin make a shop for vips that can use admin say:) you can change access
 *
 * Commands:
 * /vipmenu
 * /vipshop
 * 
 *
 */
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fun>
#include <cstrike>
#include <colorchat>
new bool:gbConnected[33];
new 
bool:got_access[33];
 
new 
bought_respawn;
new 
respawn_cost;
new 
ak47_cost;
new 
deagle_cost;
new 
scout_cost;
new 
m4a1_cost
new awp_cost;
new 
hegren_cost
new frost_cost
 
public plugin_init()
{
    
register_plugin("Deathrun Vip Shop""2.0""Barbod Nevermore")
 
    
register_clcmd("say /vipshop""vip_shop");
    
register_clcmd("say /vs""vip_shop");
    
register_clcmd("say /vipmenu""vip_shop");
    
register_event("DeathMsg""event_death""a");
    
respawn_cost register_cvar("Vip_respawn_cost""16000");
    
ak47_cost register_cvar("Vip_ak47_cost""16000");
    
awp_cost register_cvar("Vip_awp_cost""16000");
    
m4a1_cost register_cvar("Vip_m4a1_cost""16000");
    
scout_cost register_cvar("Vip_scout_cost""16000");
    
hegren_cost register_cvar("Vip_hegrencost""4000");
    
frost_cost register_cvar("Vip_frostcost""4000");
    
deagle_cost register_cvar("Vip_deagle_cost""8000")
 
}
public 
vip_shop(id)
{
     new 
MainMenu menu_create("\rVIP Shop^n^nMain Menu""MainMenu_Handle");
 
  
menu_additem(MainMenu"\wWeapon Menu""\r1"0);
  
menu_additem(MainMenu"\wItem Menu""\r2"0);
 
        {
 
menu_setprop(MainMenuMPROP_EXITMEXIT_ALL);
 if ( 
got_access[id] )
 {
  
menu_display(idMainMenu0);
 }
}
public 
MainMenu_Handle(idmenuitem)
{
 if (
item == MENU_EXIT)
 {
  
menu_destroy(menu);
  return 
PLUGIN_HANDLED;
 }
 
 new 
data[6], iName[64];
 new 
accesscallback;
 
 
menu_item_getinfo(menuitemaccessdata,5iName63callback);
 new 
key str_to_num(data);
 
 switch(
key)
 {
  case 
1:
  {
   
weapon_Menu(id);
  }
  case 
2:
  {
   
item_Menu(id);
  }
 }
 return 
PLUGIN_CONTINUE;
}
public 
TaskRespawn(id)
{
 if ( 
cs_get_user_money(id) < get_pcvar_num(respawn_cost) )
 {
  
ColorChat(idGREEN"^x01 You dont have enough money to buy this item!");
  return 
PLUGIN_HANDLED;
 }
 if ( 
bought_respawn == )
 {
  
ColorChat(idGREEN"^x01 You have already bought respawn this round!");
  return 
PLUGIN_HANDLED;
 }
 if ( 
is_user_alive(id) )
 {
  
ColorChat(idGREEN"^x01 You cannot buy respawn while your alive!");
  return 
PLUGIN_HANDLED;
 }
 new 
name[32];
 
get_user_name(idname32);
 
cs_set_user_money(idcs_get_user_money(id) - get_pcvar_num(respawn_cost) );
 
ExecuteHamB(Ham_CS_RoundRespawnid);
 
ColorChat(idGREEN"You bought respawn!"name);
 
bought_respawn 1;
 
 return 
PLUGIN_HANDLED;
}
public 
weapon_Menu(id)
{
 new 
buy_ak47[60];
 new 
buy_deagle[60];
 new 
buy_awp[60];
 new 
buy_m4a1[60];
 new 
buy_scout[60]
 
 
formatex(buy_ak47sizeof(buy_ak47) - 1"\wAWP \r[Bullets: \w1\r]      \r[$\y%i\r]"get_pcvar_num(ak47_cost));
 
formatex(buy_deaglesizeof(buy_deagle) - 1"\wAWP \r[Bullets: \w1\r]      \r[$\y%i\r]"get_pcvar_num(deagle_cost));
 
formatex(buy_awpsizeof(buy_awp) - 1"\wAWP \r[Bullets: \w1\r]      \r[$\y%i\r]"get_pcvar_num(awp_cost));
 
formatex(buy_m4a1sizeof(buy_m4a1) - 1"\wAWP \r[Bullets: \w1\r]      \r[$\y%i\r]"get_pcvar_num(m4a1_cost));
 
formatex(buy_scoutsizeof(buy_scout) - 1"\wAWP \r[Bullets: \w1\r]      \r[$\y%i\r]"get_pcvar_num(scout_cost));
 new 
wep_Menu menu_create("\rVIP Shop^n^nWeapon Menu""wepMenu_Handle");
 
 
menu_additem(wep_Menubuy_ak47"\r1"0);
 
menu_additem(wep_Menubuy_deagle"\r2"0);
 
menu_additem(wep_Menubuy_awp"\r3"0);
 
menu_additem(wep_Menubuy_m4a1"\r4"0);
 
menu_additem(wep_Menubuy_scout"\r5"0);
 
menu_setprop(wep_MenuMPROP_EXITMEXIT_ALL);
 {
  
menu_display(idwep_Menu0);
 }
}
public 
wepMenu_Handle(idmenuitem)
{
 if (
item == MENU_EXIT)
 {
  
menu_destroy(menu);
  return 
PLUGIN_HANDLED;
 }
 
 new 
data[6], iName[64];
 new 
accesscallback;
 
 
menu_item_getinfo(menuitemaccessdata,5iName63callback);
 new 
key str_to_num(data);
 
 switch(
key)
 {
  case 
1:
  {
   if ( 
cs_get_user_money(id) < get_pcvar_num(awp_cost) )
   {
    
ColorChat(idGREEN"^x01 You dont have enough money to buy this item!");
    return 
PLUGIN_HANDLED;
   }
 
   if ( !
is_user_alive(id) )
   {
    
ColorChat(idGREEN"You need to be alive!");
    return 
PLUGIN_HANDLED;
   }
 
   if ( 
user_has_weapon(idCSW_AK47) )
   {
    
ColorChat(idGREEN"^x01 You already own this weapon!");
    return 
PLUGIN_HANDLED;
   }
 
   new 
name[32];
   
get_user_name(idname32)
   
cs_set_user_money(idcs_get_user_money(id) - get_pcvar_num(ak47_cost) );
   
cs_set_weapon_ammogive_item(id"weapon_ak47"), 1);
   
ColorChat(idGREEN"You bought AK47"nameget_pcvar_num(ak47_cost));
 
  }
  case 
2:
  {
   if ( 
cs_get_user_money(id) < get_pcvar_num(deagle_cost) )
   {
    
ColorChat(idGREEN"^x01 You dont have enough money to buy this item!");
    return 
PLUGIN_HANDLED;
   }
 
   if ( !
is_user_alive(id) )
   {
    
ColorChat(idGREEN"^x01 You need to be alive!");
    return 
PLUGIN_HANDLED;
   }
 
   if ( 
user_has_weapon(idCSW_DEAGLE) )
   {
    
ColorChat(idGREEN"^x01 You already own this weapon!");
    return 
PLUGIN_HANDLED;
   }
 
   new 
name[32];
   
get_user_name(idname32)
   
cs_set_user_money(idcs_get_user_money(id) - get_pcvar_num(deagle_cost));
   
cs_set_weapon_ammogive_item(id"weapon_deagle"), 1);
   
ColorChat(idGREEN"You bought Deagle");
  }
  case 
3:
  {
   if ( 
cs_get_user_money(id) < get_pcvar_num(awp_cost) )
   {
    
ColorChat(idGREEN"^x01 You dont have enough money to buy this item!");
    return 
PLUGIN_HANDLED;
   }
 
   if ( !
is_user_alive(id) )
   {
    
ColorChat(idGREEN"^x01 You need to be alive!");
    return 
PLUGIN_HANDLED;
   }
 
   if ( 
user_has_weapon(idCSW_M4A1) )
   {
    
ColorChat(idGREEN"^x01 You already own this weapon!");
    return 
PLUGIN_HANDLED;
   }
   new 
name[32];
   
get_user_name(idname32);
   
cs_set_user_money(idcs_get_user_money(id) - get_pcvar_num(awp_cost));
   
cs_set_weapon_ammogive_item(id"weapon_awp"), 1);
   
ColorChat(idGREEN"You bought AWP!"nameget_pcvar_num(awp_cost));
  }
  case 
4:
  {
   if ( 
cs_get_user_money(id) < get_pcvar_num(m4a1_cost) )
   {
    
ColorChat(idGREEN"^x01 You dont have enough money to buy this item!");
    return 
PLUGIN_HANDLED;
   }
 
   if ( !
is_user_alive(id) )
   {
    
ColorChat(idGREEN"^x01 You need to be alive!");
    return 
PLUGIN_HANDLED;
   }
 
   if ( 
user_has_weapon(idCSW_M4A1) )
   {
    
ColorChat(idGREEN"^x01 You already own this weapon!");
    return 
PLUGIN_HANDLED;
   }
   new 
name[32];
   
get_user_name(idname32);
   
cs_set_user_money(idcs_get_user_money(id) - get_pcvar_num(m4a1_cost));
   
cs_set_weapon_ammogive_item(id"weapon_m4a1"), 1);
   
ColorChat(idGREEN"You bought M4"nameget_pcvar_num(m4a1_cost));
  }
  case 
5:
  {
   if ( 
cs_get_user_money(id) < get_pcvar_num(scout_cost) )
   {
    
ColorChat(idGREEN"^x01 You dont have enough money to buy this item!");
    return 
PLUGIN_HANDLED;
   }
 
   if ( !
is_user_alive(id) )
   {
    
ColorChat(idGREEN"^x01 You need to be alive!");
    return 
PLUGIN_HANDLED;
   }
 
   if ( 
user_has_weapon(idCSW_SCOUT) )
   {
    
ColorChat(idGREEN"^x01 You already own this weapon!");
    return 
PLUGIN_HANDLED;
   }
   new 
name[32];
   
get_user_name(idname32);
   
cs_set_user_money(idcs_get_user_money(id) - get_pcvar_num(scout_cost));
   
cs_set_weapon_ammogive_item(id"weapon_scout"), 1);
   
ColorChat(idGREEN"You bought Scout"nameget_pcvar_num(scout_cost));
  }
 }
 return 
PLUGIN_CONTINUE;
}
public 
item_Menu(id)
{
 new 
buy_respawn[60];
 new 
buy_hegren[60];
 new 
buy_frost[60]
 
 
formatex(buy_respawnsizeof(buy_respawn) - 1"\wRespawn \r[$\y%i\r]"get_pcvar_num(respawn_cost));
 
formatex(buy_hegrensizeof(buy_hegren) - 1"\wHeGrenade       \r[$\y%i\r]"get_pcvar_num(hegren_cost));
 
formatex(buy_frostsizeof(buy_frost) - 1"\wFrostGrenade      \r[$\y%i\r]"get_pcvar_num(frost_cost));
 
 new 
ite_Menu menu_create("\rVIP Shop^n^nItem Menu""ItemMenu_Handle");
 
 
menu_additem(ite_Menubuy_respawn"\r1"0);
 
menu_additem(ite_Menubuy_hegren"\r2"0);
 
menu_additem(ite_Menubuy_frost"\r3"0);
 
menu_setprop(ite_MenuMPROP_EXITMEXIT_ALL);
 {
  
menu_display(idite_Menu0);
 }
}
public 
ItemMenu_Handle(idmenuitem)
{
 if (
item == MENU_EXIT)
 {
  
menu_destroy(menu);
  return 
PLUGIN_HANDLED;
 }
 
 new 
data[6], iName[64];
 new 
accesscallback;
 
 
menu_item_getinfo(menuitemaccessdata,5iName63callback);
 new 
key str_to_num(data);
 
 switch(
key)
 {
  case 
1:
  {
   
set_task(0.2"TaskRespawn"id);
  }
  case 
2:
  {
   if ( 
cs_get_user_money(id) < get_pcvar_num(hegren_cost) )
   {
    
ColorChat(idGREEN"^x01 You dont have enough money to buy`x04 He Grenade^x01!");
    return 
PLUGIN_HANDLED;
   }
 
   if ( !
is_user_alive(id) )
   {
    
ColorChat(idGREEN"^x01 You need to be^x04 alive^x01!");
    return 
PLUGIN_HANDLED;
   }
 
   if ( 
user_has_weapon(idCSW_HEGRENADE) )
   {
    
ColorChat(idGREEN"^x01 You already own the^x04 He Grenade^x01!");
    return 
PLUGIN_HANDLED;
   }
   new 
name[32];
   
get_user_name(idname32);
   
cs_set_user_money(idcs_get_user_money(id) - get_pcvar_num(hegren_cost));
   
cs_set_weapon_ammogive_item(id"weapon_hegren"), 0);
   
cs_set_user_bpammo(idCSW_HEGRENADE, (cs_get_user_bpammo(idCSW_HEGRENADE) + 1));
   
ColorChat(idGREEN"You bought HE!"nameget_pcvar_num(hegren_cost));
  }
  case 
3:
  {
   if ( 
cs_get_user_money(id) < get_pcvar_num(frost_cost) )
   {
    
ColorChat(idGREEN"^x01 You dont have enough money to buy`x04 Frost Grenade^x01!");
    return 
PLUGIN_HANDLED;
   }
 
   if ( !
is_user_alive(id) )
   {
    
ColorChat(idGREEN"^x01 You need to be ^x04alive^x01!");
    return 
PLUGIN_HANDLED;
   }
 
   if ( 
user_has_weapon(idCSW_FLASHBANG) )
   {
    
ColorChat(idGREEN"^x01 You already own the^x04 Frost Grenade^x01!");
    return 
PLUGIN_HANDLED;
   }
   new 
name[32];
   
get_user_name(idname32);
   
cs_set_user_money(idcs_get_user_money(id) - get_pcvar_num(frost_cost));
   
cs_set_weapon_ammogive_item(id"weapon_sgren"), 0);
   
cs_set_user_bpammo(idCSW_FLASHBANG, (cs_get_user_bpammo(idCSW_FLASHBANG) + 1));
   
ColorChat(idGREEN"You bought Frost grenade!"nameget_pcvar_num(frost_cost));
  }
 }
 return 
PLUGIN_CONTINUE;
}
public 
client_authorized(id)
{
 
gbConnected[id] = true;
 
 if ( 
access(idADMIN_LEVEL_A) )
 {
  
got_access[id] = true;
 }
}
public 
client_disconnect(id)
{
 
gbConnected[id] = false;
 if ( 
got_access[id] )
 {
  
got_access[id] = false;
 }
}
public 
FwdPlayerSpawn(id)
{
 if( !
gbConnected[id] )
  return 
HAM_IGNORED;
 
 
bought_respawn 0;
 return 
HAM_HANDLED;

bare380 is offline
Send a message via Yahoo to bare380
 



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 02:48.


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