View Single Post
Author Message
GoldNux
Senior Member
Join Date: Mar 2018
Old 03-18-2018 , 19:24   Function on player spawn, how to set index?
Reply With Quote #1

This plugin is meant to give you a weapon when you respawn, but it gives you a new weapon any time someone respawns. How do I make it so it only does it for the person spawning?

Thanks!

Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #include <hamsandwich> #include <fun> #define PLUGIN "gn_impulser" #define VERSION "0.1" #define AUTHOR "GoldNux" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1)     register_cvar("gn_impulse", "0") } public fwHamPlayerSpawnPost(id) {     if (is_user_alive(id))     {         if (!get_cvar_num("gn_impulse"))         {             return PLUGIN_CONTINUE         }         new players[32]         new playercount         get_players(players, playercount)         new i         for (i=0; i<playercount; i++)         {             giveWeapons(players[i])         }     }     return PLUGIN_CONTINUE } public giveWeapons(id) {     if (cs_get_user_team(id) == CS_TEAM_T)     {           cs_set_user_armor(id, 100, CS_ARMOR_VESTHELM)         give_item(id, "weapon_ak47")         cs_set_user_bpammo(id, CSW_SCOUT, 90)         give_item(id, "weapon_hegrenade")         client_cmd(id, "lastinv")     }     if (cs_get_user_team(id) == CS_TEAM_CT)     {         cs_set_user_armor(id, 100, CS_ARMOR_VESTHELM)         give_item(id, "weapon_m4a1")         cs_set_user_bpammo(id, CSW_AUG, 90)         cs_set_user_defuse(id, 1)         give_item(id, "weapon_hegrenade")         client_cmd(id, "lastinv")     } }
__________________
Try my version of de_dust2, I think it's great and you should check it out!
https://gamebanana.com/mods/83731
GoldNux is offline