/* Plugin generated by AMXX-Studio */ #include #include #include #define PLUGIN "Amx Dodge" #define VERSION "0.1.0" #define AUTHOR "PomanoB/fl0wer only W for DarkNill :D" #define TIME_INTERVAL 0.35 #define TIME_RESET 2.0 #define ADD_BUTTON(%1,%2) g_key[%1][0]=g_key[id][1];g_key[%1][1]=%2; #define RESET_BUTTON(%1) g_key[%1][0]=0;g_key[%1][1]=0; new bool:g_dodge[33]; new Float:g_time[33]; new g_key[33][2]; public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) } public client_PreThink(id) { if (!is_user_alive(id) || zp_get_user_zombie(id)) return PLUGIN_CONTINUE if (g_dodge[id]) return PLUGIN_CONTINUE new button=pev(id,pev_button) if (button==0) return PLUGIN_CONTINUE new oldbutton=pev(id,pev_oldbuttons); if ((button & IN_FORWARD) && !(oldbutton & IN_FORWARD)) { ADD_BUTTON(id,'w') } else return PLUGIN_CONTINUE; new Float:time_out=get_gametime(); if ( (!g_time[id]) || (time_out-g_time[id] >TIME_INTERVAL)) { g_time[id]=time_out RESET_BUTTON(id) return PLUGIN_CONTINUE; } g_time[id]=time_out; if (equali(g_key[id],"ww")) { g_dodge[id]=true RESET_BUTTON(id) g_time[id]=0.0; give_dodge(id,0); set_task(TIME_RESET,"reset_dodge",id) } return PLUGIN_CONTINUE; } public give_dodge(id,n) { new coord[3]; new aiming[3]; get_user_origin(id,coord) get_user_origin(id,aiming,3); new Float:orign[3]; new Float:len=floatabs(floatsqroot (float((aiming[0]-coord[0])*(aiming[0]-coord[0])+(aiming[1]-coord[1])*(aiming[1]-coord[1])+(aiming[2]-coord[2])*(aiming[2]-coord[2]))))/10; new i; new Float:temp; for (i=0;i<3;i++) { orign[i]=float(aiming[i]-coord[i])/len; } if (n==1) { orign[0]=-orign[0]; orign[1]=-orign[1]; } else if (n==2) { temp=orign[0]; orign[0]=orign[1]; orign[1]=-temp; } else if (n==3) { temp=orign[0]; orign[0]=-orign[1]; orign[1]=temp; } new Float:vel[3] vel[0] = orign[0]*60.0; vel[1] = orign[1]*60.0; vel[2] = 250.0; set_pev(id, pev_velocity, vel) } public reset_dodge(id) { g_dodge[id]=false; }