Weapon Switch saat di buy
|
|
Grade: Copral Xenion | Date: Monday, 27 July 15, 11:46 AM | Message # 1 |
Copral
Clan: Member
Experience: 27
Status: Offline
| Code /* Plugin generated by AMXX-Studio */
#include <amxmodx> #include <amxmisc> #include <fun> #include <cstrike>
#define PLUGIN "Little Shop" #define VERSION "1.0" #define AUTHOR "HengkyK"
new Toko
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_clcmd("say /toko" , "toko") }
public toko(id) { new menu = menu_create("\rToko Senjata!:" , "menu_handler"); menu_additem( menu , "\wM4A1", "1" , 0); menu_additem( menu , "\wAK47" ,"2", 0); menu_additem (menu , "\wAWP " , "3",0 ) ; menu_setprop( menu , MPROP_EXIT , MEXIT_ALL); menu_display(id, menu , 0); }
public menu_handler( id , menu , item) { new Uang = cs_get_user_money(id) switch(item) { case 0: { if( Uang > 3250) { client_print(id , print_chat , "Kamu telah membeli M4A1") cs_set_user_money(id , Uang - 3250); give_item(id , "weapon_m4a1"); give_item(id, "ammo_556nato"); give_item(id, "ammo_556nato"); give_item(id, "ammo_556nato "); } else { client_print(id , print_chat , "Maaf uang anda tidak mencukupi!"); } } case 1: { if( Uang > 2750) { client_print(id , print_chat , "Kamu telah membeli AK47"); cs_set_user_money(id , Uang - 2750); give_item(id , "weapon_ak47"); give_item(id , "ammo_762nato"); give_item(id , "ammo_762nato"); give_item(id , "ammo_762nato"); } else { client_print(id , print_chat , "Maaf uang anda tidak mencukupi!"); } } case 2: { if( Uang > 4750) { client_print(id , print_chat , "Kamu telah membeli AWP Sniper"); cs_set_user_money( id , Uang - 4750); give_item(id , "weapon_awp"); give_item(id , "ammo_338magnum"); give_item(id , "ammo_338magnum"); give_item(id , "ammo_338magnum"); } else { client_print(id , print_chat , "Maaf uang anda tidak mencukupi!"); } } } menu_destroy(menu) return PLUGIN_HANDLED }
Halo , jadi sini gw pengen tanya . bagaimana caranya agar saat beli weapon untuk yang ke dua kalinya langsung memiliki satu senjata?
Contohnya gini , pertama2 gw buy M4A1 , terus kedua gw buy AK47 . jadi nanti itu kedua langsung menyatu(gw memiliki 2 senjata) cara agar weapon M4A1 kedrop dan digantikan oleh AK47 gimana ya scriptnya? dan juga kalau ada yang perlu dikoreksi dari script saya diatas silahkan(saran) silahkan
Thanks Before
|
|
| |
Grade: Commander DavidJr | Date: Tuesday, 28 July 15, 3:44 PM | Message # 2 |
Commander
Clan: Executive
Experience: 2256
Status: Offline
| Quote Xenion ( ) bagaimana caranya agar saat beli weapon untuk yang ke dua kalinya langsung memiliki satu senjata? Quote Xenion ( ) Contohnya gini , pertama2 gw buy M4A1 , terus kedua gw buy AK47 . jadi nanti itu kedua langsung menyatu(gw memiliki 2 senjata) Gak ngerti, coba lebih rinci
Quote Xenion ( ) cara agar weapon M4A1 kedrop dan digantikan oleh AK47 gimana ya scriptnya? Di function buy ak47 nya, kasih command drop m4a1 aja Code engclient_cmd(id, "drop", "weapon_m4a1"); Quote Xenion ( ) dan juga kalau ada yang perlu dikoreksi dari script saya diatas silahkan(saran) silahkan Code give_item(id, "ammo_556nato"); give_item(id, "ammo_556nato"); give_item(id, "ammo_556nato"); Biar lebih simpel Code cs_set_user_bpammo(id, CSW_M4A1, 90);
posted via BlackBerry
Personal Site | CSF Website
|
|
| |
Grade: Copral Xenion | Date: Tuesday, 28 July 15, 4:02 PM | Message # 3 |
Copral
Clan: Member
Experience: 27
Status: Offline
| Quote DavidJr ( ) cs_set_user_bpammo(id, CSW_M4A1, 90); CSW_M4A1 itu khusus untuk ammo ?
engclient_cmd(id, "drop", "weapon_m4a1");
ntar dicoba ,
ThanksAdded (28 July 15, 4:02 PM) --------------------------------------------- Oh iya 1 lagi bang
cara agar bisa di set cvar gimana ya ? misalnya bla bla bla harganya berapa , on/offnya
cuma bisa Toko = register_cvar( "amx_toko", "1" )
sampe coding dibawahnya gak ngerti lagi misalnya if(get_pcvar_num) bla bla bla
disitu udah gak paham :3
|
|
| |
Grade: Commander DavidJr | Date: Tuesday, 28 July 15, 4:10 PM | Message # 4 |
Commander
Clan: Executive
Experience: 2256
Status: Offline
| Quote Xenion ( ) CSW_M4A1 itu khusus untuk ammo ? CSW_* itu definisi CSWeapon, bisa CSW_AK47 dll.
Quote Xenion ( ) sampe coding dibawahnya gak ngerti lagimisalnya if(get_pcvar_num) bla bla bla
Di cache dulu aja untuk performa plugin
Code new iEnable = get_pcvar_num(Toko);
if (iEnable == 0) return; // Kalau tidak aktif, blokir
posted via BlackBerry
Personal Site | CSF Website
|
|
| |
Grade: Copral Xenion | Date: Wednesday, 29 July 15, 1:52 PM | Message # 5 |
Copral
Clan: Member
Experience: 27
Status: Offline
| Quote DavidJr ( ) Di cache dulu aja untuk performa plugin OH ok , thanks
Added (29 July 15, 1:52 PM) --------------------------------------------- Quote Xenion ( ) cs_set_user_bpammo(id, CSW_M4A1, 90); btw yang ini bisa pake cara lain kan ? contohnya siapa tau gw megang AWP
new Senjata = "get_user_weapon" cs_set_user_bpammo(id , Senjata , 90); dan yang engclient_cmd(id, "drop", "weapon_m4a1"); diganti jadi engclient_cmd(id, "drop" , Senjata);
bisa gak bang?
Message edited by Xenion - Wednesday, 29 July 15, 1:55 PM |
|
| |
Grade: Commander DavidJr | Date: Wednesday, 29 July 15, 4:08 PM | Message # 6 |
Commander
Clan: Executive
Experience: 2256
Status: Offline
| Quote Xenion ( ) dan yang engclient_cmd(id, "drop", "weapon_m4a1");diganti jadi engclient_cmd(id, "drop" , Senjata); Code new cWpn[32]; get_weaponname(Senjata, cWpn, sizeof (cWpn)-1);
engclient_cmd(id, "drop", cWpn);
posted via BlackBerry
Personal Site | CSF Website
|
|
| |
Grade: Copral Predo | Date: Wednesday, 29 July 15, 8:36 PM | Message # 7 |
Copral
Clan: Member
Experience: 16
Status: Offline
| numpang nimbrung.
brarti tar klo udh dapet senjata itu langsung ke drop dong?
|
|
| |
Grade: Copral Xenion | Date: Thursday, 30 July 15, 3:18 AM | Message # 8 |
Copral
Clan: Member
Experience: 27
Status: Offline
| Quote engclient_cmd(id, "drop" , cWpn) Oh ok , ntar saya coba . thanksAdded (30 July 15, 3:18 AM) --------------------------------------------- Code public menu_handler( id , menu , item) { new Uang = cs_get_user_money(id) new Senjata = get_user_weapon(id) switch(item) { case 0: { if( Uang > 3250) { new cWpn [32]; get_weaponname(Senjata , cWpn , sizeof (cWpn)-1); engclient_cmd(id, "drop", "Senjata"); give_item ( id , "weapon_m4a1" ) client_print(id , print_chat , "Kamu telah membeli M4A1"); cs_set_user_money(id , Uang - 3250); cs_set_user_bpammo(id , Senjata ,90); } else { client_print(id , print_chat , "Maaf uang anda tidak mencukupi!"); } } Apa peletakan kode sudah benar ? soalnya pas gw test ternyata engga work , weaponnya gak kedrop pas beli m4a1
dan
Cvarnya sudah ditest dan work , terus kalau misalnya gw mau nambahin print gitu dibawah if (iEnable == 0) bisa gak? contoh , client_print ( id , print_chat , "Maaf sekarang menu ini telah dimatikan" )
Thanks Before
|
|
| |
Grade: Commander DavidJr | Date: Thursday, 30 July 15, 10:20 AM | Message # 9 |
Commander
Clan: Executive
Experience: 2256
Status: Offline
| Quote Predo ( ) numpang nimbrung.brarti tar klo udh dapet senjata itu langsung ke drop dong? Cuma drop weapon yg diinginkan saja
Quote Xenion ( ) new cWpn [32]; get_weaponname(Senjata , cWpn , sizeof (cWpn)-1); engclient_cmd(id, "drop", "Senjata"); Quote DavidJr ( ) new cWpn[32];get_weaponname(Senjata, cWpn, sizeof (cWpn)-1);
engclient_cmd(id, "drop", cWpn); Quote Xenion ( ) mau nambahin print gitu dibawah if (iEnable == 0) bisa gak? Yes
posted via BlackBerry
Personal Site | CSF Website
|
|
| |
Grade: Copral Xenion | Date: Thursday, 30 July 15, 2:27 PM | Message # 10 |
Copral
Clan: Member
Experience: 27
Status: Offline
| Quote DavidJr ( ) engclient_cmd(id, "drop", cWpn); cara mengidentifikasi kalau player tersebut benar benar sedang memegang senjata gimana ya ? contoh pas gw megang Knife , terus beli M4A1 , otomatis ada tulisan This Weapon cannot be dropped.
apakah menambahkan kode sperti ini?
else if ( cWpn = CSW_Knife ) { (ga tau lagi :3) }
|
|
| |
Grade: Commander DavidJr | Date: Friday, 31 July 15, 11:51 AM | Message # 11 |
Commander
Clan: Executive
Experience: 2256
Status: Offline
| Quote Xenion ( ) cara mengidentifikasi kalau player tersebut benar benar sedang memegang senjata gimana ya ? Code new iWpn = get_user_weapon(id);
if (iWpn == CSW_KNIFE) // weapon knife
posted via BlackBerry
Personal Site | CSF Website
|
|
| |
Grade: Copral Xenion | Date: Friday, 31 July 15, 2:54 PM | Message # 12 |
Copral
Clan: Member
Experience: 27
Status: Offline
| Quote DavidJr ( ) if (iWpn == CSW_KNIFE) // weapon knife oh gitu , terus script agar kalau dia megang pisau terus beli m4a1 biasanya ada tulisan ini "This weapon cannot dropped" , cara ngilanginnya gimana? ( jadi engclient_cmd(id , "drop" , cWpn) gak bakalan work kalo itu knife )
Thanks before
|
|
| |
Grade: Commander DavidJr | Date: Friday, 31 July 15, 10:06 PM | Message # 13 |
Commander
Clan: Executive
Experience: 2256
Status: Offline
| Code if (iWpn == CSW_KNIFE) return;
or
Code if (iWpn != CSW_KNIFE) engclient_cmd(id, "drop", cWpn);
posted via BlackBerry
Personal Site | CSF Website
|
|
| |
Grade: Copral Xenion | Date: Saturday, 01 August 15, 5:30 AM | Message # 14 |
Copral
Clan: Member
Experience: 27
Status: Offline
| Quote DavidJr ( ) if (iWpn != CSW_KNIFE) engclient_cmd(id, "drop", cWpn); sip deh bang,
ngomong-ngomong , ! itu artinya tidak ya?
Contohnya kadang sering nemuiin script !is_user_alive , !is_user_admin , dll
Thanks udah bantu
|
|
| |
Grade: Commander DavidJr | Date: Sunday, 02 August 15, 9:25 AM | Message # 15 |
Commander
Clan: Executive
Experience: 2256
Status: Offline
| Quote Xenion ( ) sip deh bang,ngomong-ngomong , ! itu artinya tidak ya?
Contohnya kadang sering nemuiin script !is_user_alive , !is_user_admin , dll
Thanks udah bantu Code if (iWpn != CSW_KNIFE) // Jika iWpn tidak sama dengan CSW_KNIFE
Code if (!is_user_alive(id)) // Jika nilai is_user_alive = 0 / false
posted via BlackBerry
Personal Site | CSF Website
|
|
| |