View Single Post
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 10-24-2019 , 17:50   Re: Spawn protection until player moves or shoots
Reply With Quote #3

Not Fully tested, but log seems to be ok

Code:
#include <amxmodx> #include <amxmisc> #include <hamsandwich> #include <engine> #include <fakemeta> #include <fun> new bool:CanTakeDmg[33] new gOldAngles[33][3] #define XO_WEAPON 4 #define m_pPlayer 41 public plugin_init() {     register_plugin("Test", AMXX_VERSION_STR, "Alliedmodders")     RegisterHam(Ham_Spawn, "player", "PlayerSpawn", 1)         new Ent = create_entity("info_target")     register_think("checking_players_ent", "afkCheck_entThink")     entity_set_string(Ent, EV_SZ_classname, "checking_players_ent")     entity_set_float(Ent, EV_FL_nextthink, get_gametime() + 0.1)         new szWeaponName[32]     new NOSHOT_BITSUM = (1<<CSW_KNIFE) | (1<<CSW_HEGRENADE) | (1<<CSW_FLASHBANG) | (1<<CSW_SMOKEGRENADE)     for(new iId = CSW_P228; iId <= CSW_P90; iId++)     {         if( ~NOSHOT_BITSUM & 1<<iId && get_weaponname(iId, szWeaponName, charsmax(szWeaponName)))         {             RegisterHam(Ham_Weapon_PrimaryAttack, szWeaponName, "WEAPON_PrimaryAttack_PRE", 0)         }     } } public WEAPON_PrimaryAttack_PRE( iWeapon ) {     static id         id = get_pdata_cbase(iWeapon, m_pPlayer, XO_WEAPON)         CanTakeDmg[id] = true } public PlayerSpawn(id) {     if(is_user_alive(id))     {         CanTakeDmg[id] = false         get_user_origin(id, gOldAngles[id])     } } public afkCheck_entThink(ent) {     checkPlayers()         entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.5) } public checkPlayers() {     new iPlayers[32], iNum, id     get_players(iPlayers, iNum, "a")     for(new i = 0; i < iNum; i++)     {         id = iPlayers[i]                 new NewAngle[3]         get_user_origin(id, NewAngle)                 if (NewAngle[0] != gOldAngles[id][0] && NewAngle[1] != gOldAngles[id][1] && NewAngle[2] != gOldAngles[id][2])         {             CanTakeDmg[id] = true                         set_pev(id, pev_takedamage, DAMAGE_AIM)                         set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 255)         }                 else                 {                         set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 70)                         set_pev(id, pev_takedamage, DAMAGE_NO)                 }     } }
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/

Last edited by iceeedr; 10-24-2019 at 22:41.
iceeedr is offline
Send a message via Skype™ to iceeedr