Abhinash Posted April 30, 2016 Share Posted April 30, 2016 This thread is to help any people to make any extra item for Survivor. In this tutorial, the Survivor will get second weapon which is the extra item that you want. So, the Survivor will have two weapon which are the weapon that have been set by default and the weapon from extra item. A. The idea: This tutorial will help people to learn how to script a code by themselves. B. The steps: 1. Firstly, just open the .sma file of the extra item that you want to give it for the Survivor. For example, I will use zp_extra_sawnoff.sma file. 2. Then, just add below line. I recommend you to add it after the public plugin_init() section: public zp_round_started() { for(new id = 1; id <=g_MaxPlayers; id++) { if(zp_get_user_survivor(id)) { set_task(1.0, "task_give", id) } } } public task_give(id) { if(zp_get_user_survivor(id) && is_user_alive(id)) { g_HasAk[id] = true give_item(id, "weapon_ak47") client_print(id, print_center, "*** You got a Golden AK, enjoy killing the zombies ***") } }3. So, the only thing that you have to change is this: g_HasAk[id] = true give_item(id, "weapon_ak47") client_print(id, print_center, "*** You got a Golden AK, enjoy killing the zombies ***")4. "g_HasAk[id] = true" must be change with the specific bool of the extra item that you want to add for the Survivor. Usually, the bool is located at the public zp_extra_item_selected(id, itemid) section: public zp_extra_item_selected(id, itemid) { // Item is the Sawn-Off if(itemid == g_SawnOff) { if(!get_pcvar_num(cvar_enable)) { zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + g_SawnOff_Cost) client_print(id, print_chat, "[ZP] The Sawn-Off Shotgun is Disabled") return; } // Already has an M3 if(g_sawnoff_shotgun[id] && user_has_weapon(id, CSW_M3)) { zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + g_SawnOff_Cost) client_print(id, print_chat, "[ZP] You already have a Sawn-Off Shotgun") return; } // Bool g_sawnoff_shotgun[id] = true <--- This is the bool // Weapon ham_give_weapon(id, "weapon_m3") // Message client_print(id, print_chat, "[ZP] You now have a Sawn-Off Shotgun") } }5. Then just copy this part from zp_extra_item_selected(id, itemid) section: g_sawnoff_shotgun[id] = true <--- This is the bool // Weapon ham_give_weapon(id, "weapon_m3") // Message client_print(id, print_chat, "[ZP] You now have a Sawn-Off Shotgun") 6. Then change it with this line in the public task_give(id) section that we have just add: g_HasAk[id] = true give_item(id, "weapon_ak47") client_print(id, print_center, "*** You got a Golden AK, enjoy killing humans ***")7. Then, you can change this line: " *** You got a Golden AK, enjoy killing the zombies ***"-->" *** You got a Sawn-Off Shotgun, enjoy killing the zombies ***"8. After that you have to register the "get_maxplayers": 8.1 You have to register new variable (add the new variable before public plugin_init() section: new g_MaxPlayers ---> new g_MaxPlayers <---- Please add here public plugin_init() { register_plugin("[ZP] Extra Item: Sawn-Off Shotgun", VERSION, "Line94") 8.2 Then you have add this line in the public plugin_init() section: g_MaxPlayers = get_maxplayers()Replce with -- public plugin_init() { register_plugin("[ZP] Extra Item: Sawn-Off Shotgun", VERSION, "meTaLiCroSS") g_MaxPlayers = get_maxplayers() <---- Please add here }9. Then, it done. Just compile the .sma file. Then you will get Sawn-Off Shotgun as secondary weapon for Survivor. C. How to make the extra item only for Survivor? First of all, you must do all the above steps. Then, just follow this steps: 1. Just find this in the .sma file: zp_register_extra_item2. Then, delete all the line in the section. For example in zp_extra_sawnoff.sma file: g_SawnOff = zp_register_extra_item("Sawn-Off Shotgun", g_SawnOff_Cost, ZP_TEAM_HUMAN)3. After, the line is deleted, the Sawn-off Shotgun will not be displayed in the extra item menu. So, the player cannot buy the Sawn-off Shotgun and the weapon will be available for Survivor only. D. How to remove the default Survivor weapon? If you want to remove the default Survivor weapon, just follow this steps: 1. Just add this line in the "public task_give(id)" section: strip_user_weapons(id)---> public task_give(id) { if(zp_get_user_survivor(id) && is_user_alive(id)) { g_sawnoff_shotgun[id] = true strip_user_weapons(id) <----- Please add here give_item(id, "weapon_m3") client_print(id, print_center, "*** You got a sawnoff shotgun, enjoy killing the zombies ***") } }2. Then compile it locally. 3. After that, when there is Survivor round, the default weapon will be automatically removed. The Survivor will have Sawn-off Shotgun only. Link to comment Share on other sites More sharing options...
Abhinash Posted April 30, 2016 Author Share Posted April 30, 2016 Please reply in English if you have any question . Link to comment Share on other sites More sharing options...
Sp1dey Posted May 2, 2016 Share Posted May 2, 2016 Is good . Link to comment Share on other sites More sharing options...
LauReNNTziu Posted May 2, 2016 Share Posted May 2, 2016 Gg man , made Zombie Outstading ? Link to comment Share on other sites More sharing options...
sinnoptic Posted May 4, 2016 Share Posted May 4, 2016 Subiect inchis pentru a evita post-hunt . Link to comment Share on other sites More sharing options...
Recommended Posts