- | Afiseaza codul
[code]#include <amxmodx> #include <amxmisc> #include <engine> #include <fun> #define KZ_LEVEL ADMIN_KICK // Adminlevel #define MIN_DIST 70.0 #define THROW_POWER 1500 new grab[32] new Float:grabdistance[32] new bool:grabsearch[32] new g_short enum color {normal = 1, green, team} public plugin_init() { register_plugin("ProKreedzGrab","1.0","p4ddY") register_clcmd("+grab","grab_on",KZ_LEVEL) register_clcmd("-grab","grab_off",KZ_LEVEL) register_event("DeathMsg","deathmsg","a") register_event("ResetHUD","resethud","be") } public plugin_precache() { precache_sound("weapons/xbow_fire1.wav") g_short = precache_model("sprites/MG_grab/energy_grab.spr"); } // ================================================================================================= public grab_on(id,level,cid) { if(!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED grabsearch[id-1] = true return PLUGIN_HANDLED } public grab_off(id,level,cid) { if(!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED grabsearch[id-1] = false grab[id-1] = 0 return PLUGIN_HANDLED } // ================================================================================================= public grab_player(id,target) { grab[id-1] = target grabsearch[id-1] = false new Float:origin1[3], Float:origin2[3] entity_get_vector(id,EV_VEC_origin,origin1) entity_get_vector(target,EV_VEC_origin,origin2) grabdistance[id-1] = get_distance_f(origin1,origin2) set_user_rendering(target, kRenderFxGlowShell, random(256), random(256), random(256), kRenderNormal, 43); new namep[32], namea[32] get_user_name(target, namep, charsmax(namep)) get_user_name(id, namea, charsmax(namea)) ColorChat(id, "!nYou grabbed !tPlayer !n: !g%s!n.", namep) ColorChat(target, "!tAdmin !g%s !n: !ngrabbed you.", namea) emit_sound(id, CHAN_VOICE, "weapons/xbow_fire1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM) grab_eff(target) if(callfunc_begin("detect_cheat","prokreedz.amxx") == 1) { callfunc_push_int(target) callfunc_push_str("Grab") callfunc_end() } } // ================================================================================================= public is_user_grabbed(id) { for(new i=0;i<32;i++) { if(grab == id) return (i+1) } return -1 } // ================================================================================================= public client_PreThink(id) { new buttons = entity_get_int(id,EV_INT_button) if(grabsearch[id-1] == true) { new aimid, aimbody if(get_user_aiming(id,aimid,aimbody) != 0.0 && aimid != 0) { new targetclass[16] entity_get_string(aimid,EV_SZ_classname,targetclass,16) if(equal(targetclass,"player")) { if(is_user_grabbed(aimid) == -1) grab_player(id,aimid) else { client_print(id,print_chat,"[ProKreedz] Dieser Spieler ist schon grabbed") grabsearch[id-1] = false } } } } if(grab[id-1] > 0) { // Took this from JediGrap by KCE new Float:origin1[3], Float:origin2[3], ilook[3], Float:look[3], Float:direction[3], Float:moveto[3], Float:grabbedorigin[3], Float:velocity[3], Float:length get_user_origin(id,ilook,3) IVecFVec(ilook,look) entity_get_vector(grab[id-1],EV_VEC_origin,grabbedorigin) entity_get_vector(id,EV_VEC_origin,origin1) entity_get_vector(grab[id-1],EV_VEC_origin,origin2) direction[0] = look[0] - origin1[0] direction[1] = look[1] - origin1[1] direction[2] = look[2] - origin1[2] length = get_distance_f(look,origin1) if(!length) length = 1.0 // avoid division by 0 moveto[0] = origin1[0] + direction[0] * grabdistance[id-1] / length moveto[1] = origin1[1] + direction[1] * grabdistance[id-1] / length moveto[2] = origin1[2] + direction[2] * grabdistance[id-1] / length velocity[0] = (moveto[0] - origin2[0]) * 8 velocity[1] = (moveto[1] - origin2[1]) * 8 velocity[2] = (moveto[2] - origin2[2]) * 8 entity_set_vector(grab[id-1],EV_VEC_velocity,velocity) // Push and Pull if(buttons&IN_ATTACK) { entity_set_int(id,EV_INT_button,buttons&~IN_ATTACK) grabdistance[id-1] += 7 } else if(buttons&IN_ATTACK2) { entity_set_int(id,EV_INT_button,buttons&~IN_ATTACK2) grabdistance[id-1] -= 7 if(grabdistance[id-1] < MIN_DIST) grabdistance[id-1] = MIN_DIST } else if(buttons&IN_JUMP) { entity_set_int(id,EV_INT_button,buttons&~IN_JUMP) VelocityByAim(id,THROW_POWER,velocity) entity_set_vector(grab[id-1],EV_VEC_velocity,velocity) grab[id-1] = 0 } } if(is_user_grabbed(id) != -1) entity_set_int(id,EV_INT_button,buttons&~IN_MOVELEFT&~IN_MOVERIGHT&~IN_FORWARD&~IN_BACK&~IN_JUMP) // Stop sucking :o } // ================================================================================================= public deathmsg() { new attacker = read_data(1) // attacker new victim = read_data(2) grab[attacker-1] = 0 grabsearch[attacker-1] = false new pid = is_user_grabbed(victim) if(pid != -1) grab[pid-1] = 0 } public resethud(id) { new pid = is_user_grabbed(id) if(pid != -1) { grab[pid-1] = 0 } grab[id-1] = 0 grabsearch[id-1] = false } // ================================================================================================= public client_disconnect(id) { grabsearch[id-1] = false grab[id-1] = 0 } public client_putinserver(id) { grabsearch[id-1] = false grab[id-1] = 0 } stock ColorChat(id, String[], any:...) { static szMesage[192]; vformat(szMesage, charsmax(szMesage), String, 3); replace_all(szMesage, charsmax(szMesage), "!n", "^1"); replace_all(szMesage, charsmax(szMesage), "!t", "^3"); replace_all(szMesage, charsmax(szMesage), "!g", "^4"); static g_msg_SayText = 0; if(!g_msg_SayText) g_msg_SayText = get_user_msgid("SayText"); new Players[32], iNum = 1, i; if(id) Players[0] = id; else get_players(Players, iNum, "ch"); for(--iNum; iNum >= 0; iNum--) { i = Players[iNum]; message_begin(MSG_ONE_UNRELIABLE, g_msg_SayText, _, i); write_byte(i); write_string(szMesage); message_end(); } } public grab_eff(target) { new origin[3] get_user_origin(target,origin) message_begin(MSG_ALL,SVC_TEMPENTITY,{0,0,0},target) write_byte(TE_SPRITETRAIL) //Sprite capture write_coord(origin[0]) write_coord(origin[1]) write_coord(origin[2]+20) write_coord(origin[0]) write_coord(origin[1]) write_coord(origin[2]+80) write_short(g_short) write_byte(20) write_byte(20) write_byte(4) write_byte(20) write_byte(10) message_end() } // You reached the end of file // This plugin was made by p4ddY :) // Credits to KCE [/code]
Ce am nevoie mai exact:
- Glow pe player este permanent. As dori sa ca glow sa fie activ doar in momentul folosirii grab-ului.
- Culorile glow-ului sa fie random.