Raised This Month: $ Target: $400
 0% 

[HELP] If Mapname Then Give Wep + Ammo


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
GoldNux
Senior Member
Join Date: Mar 2018
Old 04-22-2018 , 06:03   [HELP] If Mapname Then Give Wep + Ammo
Reply With Quote #1

I'm trying to make a plugin that does the following:
Gives ammo to killer. (Not sure if it is correctly done)
Gives weapon + ammo when you spawn, weapon and ammo is different depending on mapname.
Is it correct to check mapname in plugin init?

Thank you very much.

I'm getting these errors:
Quote:
ERROR [28]: array index out of bounds (variable "mapname")
ERROR [30]: array index out of bounds (variable "weapon")
ERROR [31]: array index out of bounds (variable "ammo")

Also you can carry two primary weapons.
And if it is possible I would like to remove the weapons that are dropped to reduce CPU usage.
Code:
new mapname[31] new weapon[31] new ammo[31] public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1)     register_event("DeathMsg", "AmmoOnKill", "a")     register_cvar("gn_impulse", "0")     checkMapName() } public checkMapName() {     get_mapname(mapname,31)     if (mapname[31] == "aim_map_tmp")     {         weapon[31] = "weapon_tmp"         ammo[31] = "ammo_9mm"     }     else     {         weapon[31] = "weapon_ak47"         ammo[31] = "CSW_SCOUT"     } } public fwHamPlayerSpawnPost(id) {     if (!get_cvar_num("gn_impulse"))     {         if (mapname[31] == "aim_map_usp" && is_user_alive(id))         {             client_cmd(id, "lastinv")         }         else if (is_user_alive(id))         {             giveWeapons(id)         }     }     return PLUGIN_CONTINUE } public giveWeapons(id) {     cs_set_user_armor(id, 100, CS_ARMOR_KEVLAR)     give_item(id, weapon[31])     cs_set_user_bpammo(id, ammo[31], 90) } public AmmoOnKill() {     new killer = read_data( 1 ), szWp[5];     read_data(4, szWp, charsmax(szWp))     if (killer > 0 && killer != read_data(2) && equal(szWp, "usp", 3))     {         cs_set_weapon_ammo(find_ent_by_owner(-1,"weapon_usp",killer),12)     }     if (killer > 0 && killer != read_data(2) && equal(szWp, "ak47", 3))     {         cs_set_weapon_ammo(find_ent_by_owner(-1,"weapon_ak47",killer),30)     } }
__________________
Try my version of de_dust2, I think it's great and you should check it out!
https://gamebanana.com/mods/83731

Last edited by GoldNux; 04-22-2018 at 06:09.
GoldNux is offline
 



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 04:44.


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