AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Want Help please... (https://forums.alliedmods.net/showthread.php?t=241497)

DaDoO2810VB 06-04-2014 11:49

Want Help please...
 
Code:

#include <amxmodx>
#include <amxmisc>
#define PLUGIN "Menu_Shop"
#define VERSION "1.0"
#define AUTHOR "MaaQ"

public plugin_init() {
 register_plugin(PLUGIN, VERSION, AUTHOR)
 
 register_clmd("say /shop", "abrir_menu")
}
public abrir_menu(id)
{
 new menu = menu_create("Menu :", "menu_handler")
 menu_additem(menu, "HE [ 3000$ ]", "1")
 menu_additem(menu, "FLASH [ 1500$ ]", "2")
 menu_additem(menu, "SMOKE [ 1000$ ]", "3")
 menu_additem(menu, "DEAGLE [ 10000$ ]", "4")
 menu_additem(menu, "MAC 10 [ 16000$ ]", "5")
 menu_additem(menu, "+50 HP [ 3000$ ]", "6")
 menu_additem(menu, "+100 ARMURE [ 2500$ ]", "6")
 
 menu_setprop(menu, MPROP_EXITNAME, "Quitter")
 menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
 
 menu_display(id, menu, 0)
}
public menu_handler(id, menu, item)
{
 if(item == MENU_EXIT)
 {
  menu_destroy(menu)
  return PLUGIN_HANDLED
 }
 new data[6], iName[64]
 new access, callback
 new money = cs_get_user_money( id )
 menu_item_getinfo(menu, item, access, data,5, iName, 63, callback)
 
 new key = str_to_num(data)
 switch(key)
 {
  case 1:
  {
  if(cs_get_user_money(id) >= 3000)
  {
    cs_set_user_money(id, money - 3000)
    give_item(id, "weapon_hegrenade")
    cs_set_user_bpammo(id, CSW_HEGRENADE, 1)
    client_print(id, print_chat, "Tu as acheter une HE")
  }
  }
 }
  case 2:
  {
  if(cs_get_user_money(id) >= 1500)
  {
    cs_set_user_money(id, money - 1500)
    give_item(id, "weapon_flashbang")
    cs_set_user_bpammo(id, CSW_FLASHBANG, 1)
    client_print(id, print_chat, "Tu as acheter une FLASH")
  }
  }
 }
  case 3:
  {
  if(cs_get_user_money(id) >= 1000)
  {
    cs_set_user_money(id, money - 1000)
    give_item(id, "weapon_smokegrenade")
    cs_set_user_bpammo(id, CSW_SMOKEGRENADE, 1)
    client_print(id, print_chat, "Tu as acheter une SMOKE")
  }
  }
 }
  case 4:
  {
  if(cs_get_user_money(id) >= 10000)
  {
    cs_set_user_money(id, money - 10000)
    give_item(id, "weapon_deagle")
    cs_set_user_bpammo(id, DEAGLE, 7)
    client_print(id, print_chat, "Tu as acheter un DEAGLE")
  }
  }
 }
  case 5:
  {
  if(cs_get_user_money(id) >= 16000)
  {
    cs_set_user_money(id, money - 16000)
    give_item(id, "weapon_mac10")
    cs_set_user_bpammo(id, MAC 10, 30)
    client_print(id, print_chat, "Tu as acheter un MAC 10")
  }
  }
 }
  case 6:
  {
  if(cs_get_user_money(id) >= 3000)
  {
    cs_set_user_money(id, money - 3000)
    set_user_health(id, get_user_health(id) + 50)
    client_print(id, print_chat, "Tu as acheter 50 HP")
  }
  }
 }
  case 7:
  {
  if(cs_get_user_money(id) >= 2500)
  {
    cs_set_user_money(id, money - 2500)
    cs_set_user_armor(id, get_user_armor(id) + 100)
    client_print(id, print_chat, "Tu as acheter 100 ARMURE")
  }
  }
 }
 return PLUGIN_HANDLED
}

Hello, i want to my plugin is just for terrorist can you help me please ?

Backstabnoob 06-04-2014 13:02

Re: Want Help please...
 
Add this:
PHP Code:

if( get_user_teamid ) != )
{
    
client_printidprint_chat"This menu is only for Terrorists." )
    return 
PLUGIN_HANDLED


Above this:
PHP Code:

new menu menu_create("Menu :""menu_handler"


DaDoO2810VB 06-04-2014 13:26

Re: Want Help please...
 
This is good ?

Quote:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Menu_Shop"
#define VERSION "1.0"
#define AUTHOR "MaaQ"


public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)

register_clmd("say /shop", "abrir_menu")
}

public abrir_menu(id)
{
if' get_user_team( id ) != 1 )
{
print_chat, "Ce menu est accessible uniquement pour les terroristes." )
return PLUGIN_HANDLED
}

new menu = menu_create("Menu :", "menu_handler")
menu_additem(menu, "HE [ 3000$ ]", "1")
menu_additem(menu, "FLASH [ 1500$ ]", "2")
menu_additem(menu, "SMOKE [ 1000$ ]", "3")
menu_additem(menu, "DEAGLE [ 10000$ ]", "4")
menu_additem(menu, "MAC 10 [ 16000$ ]", "5")
menu_additem(menu, "+50 HP [ 3000$ ]", "6")
menu_additem(menu, "+100 ARMURE [ 2500$ ]", "6")

menu_setprop(menu, MPROP_EXITNAME, "Quitter")
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)

menu_display(id, menu, 0)
}

public menu_handler(id, menu, item)
{
if(item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new data[6], iName[64]
new access, callback
new money = cs_get_user_money( id )
menu_item_getinfo(menu, item, access, data,5, iName, 63, callback)

new key = str_to_num(data)
switch(key)
{
case 1:
{
if(cs_get_user_money(id) >= 3000)
{
cs_set_user_money(id, money - 3000)
give_item(id, "weapon_hegrenade")
cs_set_user_bpammo(id, CSW_HEGRENADE, 1)
client_print(id, print_chat, "Tu as acheter une HE")
}
}
}
case 2:
{
if(cs_get_user_money(id) >= 1500)
{
cs_set_user_money(id, money - 1500)
give_item(id, "weapon_flashbang")
cs_set_user_bpammo(id, CSW_FLASHBANG, 1)
client_print(id, print_chat, "Tu as acheter une FLASH")
}
}
}
case 3:
{
if(cs_get_user_money(id) >= 1000)
{
cs_set_user_money(id, money - 1000)
give_item(id, "weapon_smokegrenade")
cs_set_user_bpammo(id, CSW_SMOKEGRENADE, 1)
client_print(id, print_chat, "Tu as acheter une SMOKE")
}
}
}
case 4:
{
if(cs_get_user_money(id) >= 10000)
{
cs_set_user_money(id, money - 10000)
give_item(id, "weapon_deagle")
cs_set_user_bpammo(id, DEAGLE, 7)
client_print(id, print_chat, "Tu as acheter un DEAGLE")
}
}
}
case 5:
{
if(cs_get_user_money(id) >= 16000)
{
cs_set_user_money(id, money - 16000)
give_item(id, "weapon_mac10")
cs_set_user_bpammo(id, MAC 10, 30)
client_print(id, print_chat, "Tu as acheter un MAC 10")
}
}
}
case 6:
{
if(cs_get_user_money(id) >= 3000)
{
cs_set_user_money(id, money - 3000)
set_user_health(id, get_user_health(id) + 50)
client_print(id, print_chat, "Tu as acheter 50 HP")
}
}
}
case 7:
{
if(cs_get_user_money(id) >= 2500)
{
cs_set_user_money(id, money - 2500)
cs_set_user_armor(id, get_user_armor(id) + 100)
client_print(id, print_chat, "Tu as acheter 100 ARMURE")
}
}
}
return PLUGIN_HANDLED
}

Backstabnoob 06-04-2014 13:31

Re: Want Help please...
 
yes, except it's if(, not if'

DaDoO2810VB 06-04-2014 13:33

Re: Want Help please...
 
I have a problem when compiling :

http://img11.hostingpics.net/pics/148126Sanstitre1.jpg

WildCard65 06-04-2014 13:34

Re: Want Help please...
 
update to amxx 1.8.2

DaDoO2810VB 06-04-2014 13:36

Re: Want Help please...
 
that's for amxx or amx my menu ? i'm not a good coder :/

WildCard65 06-04-2014 13:37

Re: Want Help please...
 
Your trying to compile it with AMXX 1.8.1 when the latest and supported version is AMXX 1.8.2

DaDoO2810VB 06-04-2014 13:37

Re: Want Help please...
 
amxx 1.8.2 compiler ?

WildCard65 06-04-2014 13:38

Re: Want Help please...
 
Quote:

Originally Posted by DaDoO2810VB (Post 2146780)
amxx 1.8.2 compiler ?

No, you'll need to get a fresh AMXX install(with updated sources/includes that comes with it for plugins for AMXX) and try compiling on the fresh AMXX install(of 1.8.2)


All times are GMT -4. The time now is 09:40.

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