Raised This Month: $ Target: $400
 0% 

Problem with set_tr


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
BLACO
Junior Member
Join Date: Dec 2007
Location: Espaņa / Spain
Old 12-02-2007 , 16:25   Problem with set_tr
Reply With Quote #1

First, I'm spanish boy(sorry for my english) (si me contestais en espaņol mejor xD) and I made this code in spanish. I traslate later, but i could forget something.

I have a problem with "set_tr( TR_flFraction, 100.0 )". I read some posts where say that with this function evade shoots. I cant do that. Someone tell me how do that?
Code:
<!-- Code block --> <div style="margin:20px; margin-top:5px">     <div class="smallfont" style="margin-bottom:2px">Code:</div>     <pre class="alt2" dir="ltr" style="margin: 0px;padding: 6px;border: 1px inset;width: auto; height: 499px; text-align: left; overflow: auto">#include <amxmodx> #include <csx> #include <fun> #include <fakemeta> #include <engine> #include <cstrike> #define PLUGIN "Duelos" #define VERSION "0.1 BETA" #define AUTHOR "[B]" // max clip  stock const maxClip[31] = { -1, 13, -1, 10,  1,  7,  1,  30, 30,  1,  30,  20,  25, 30, 35, 25,  12,  20,             10,  30, 100,  8, 30,  30, 20,  2,  7, 30, 30, -1,  50 };  // max bpammo  stock const maxAmmo[31] = { -1, 52, -1, 90, -1, 32, -1, 100, 90, -1, 120, 100, 100, 90, 90, 90, 100, 100,             30, 120, 200, 32, 90, 120, 60, -1, 35, 90, 90, -1, 100 }; // a sprite that will be on the players' head new gSprite //only one attacker per player new attacker[32] public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_event("ResetHUD","newRound","b")     register_forward(FM_TraceLine,"desvia_balas",1);     show_victim() } public plugin_precache() {     gSprite = precache_model("sprites/iplayer.spr") } //When a player respawn, he call this function. public newRound (id){     attacker[attacker[id]]=attacker[id];     attacker[id]=id; } // public desvia_balas(Float:v1[3],Float:v2[3],noMonsters,pentToSkip){     new iAttacker=pentToSkip     new iVictim = get_tr(TR_pHit);     //is a valid victim??     if (SHARED_ValidPlayer( iVictim )){         //I dont know how to do better the next lines on this method         if (attacker[iAttacker]==iAttacker && attacker[iVictim]==iVictim){             return FMRES_IGNORED         }             if (attacker[iVictim]!=iAttacker ){             set_tr( TR_flFraction, 100.0 );             set_tr(TR_pHit,iAttacker);             return FMRES_SUPERCEDE;         }     }     return FMRES_IGNORED; } //when a player is damaged public client_damage(att,vic,dam,wpn,hit,ta){     set_hudmessage(50, 155,50 , -1.0, 0.2)     //if is the first time victim is hurted and attacker attacks then...     if (att==attacker[att] && vic==attacker[vic]){         attacker[att]=vic;         attacker[vic]=att;         new name[30]         get_user_name(vic,name,30)         show_hudmessage(att, "You must kill %s",name)         get_user_name(att,name,30)         show_hudmessage(vic, "You must kill %s",name)             }     else if (att!=attacker[vic] && att!=vic){         show_hudmessage(att,"You can't hurt that player yet")         //I use the next method because set_tr( TR_flFraction, 1.0) dont work         returnHealth(vic,dam);     }     } public client_death(killer,victim,wpn,hit,tk){     if (killer!=attacker[victim]){         attacker[attacker[killer]]=attacker[killer]         attacker[attacker[victim]]=attacker[victim]     }     attacker[killer]=killer     attacker[victim]=victim     set_user_health(killer,100)     set_user_armor(killer,100)     cargar_arma (killer) } public returnHealth (id, damage){     new actualHealth     actualHealth=get_user_health(id)     set_user_health(id,actualHealth+damage);     set_user_armor(id,100) } public cargar_arma (id){     new recamara,cargadores     new iwpn=get_user_weapon(id,recamara,cargadores)     new arma[30]     get_weaponname(iwpn,arma,30);     if (iwpn!=29){         cs_set_user_bpammo(id,iwpn,maxAmmo[iwpn])         new wid = find_ent_by_owner(-1, arma, id);         if(wid){             cs_set_weapon_ammo(wid,maxClip[iwpn])         }     } } bool:SHARED_ValidPlayer( id ) {     new MAXPLAYERS=get_playersnum();     if ( id < 1 || id > MAXPLAYERS )     {         return false;     }     return true; } public show_victim (){     set_task(0.3,"show_victim");     new players[32]     new pnum, vec1[3]     new iddraw,id         get_players(players,pnum,"a")     for (new i = 0; i < pnum; i++) {         id=players[i];         for (new j=0;j<pnum;j++){             iddraw = players[j]             new bool:bIsAtt=false             for (new k=0;k<pnum;k++){                 if(iddraw==attacker[k] && k!=iddraw){                     bIsAtt=true                 }             }             if (get_user_team(id)==get_user_team(iddraw)) continue                         if (iddraw == id) continue             if (!is_user_alive(iddraw)) continue             if (!get_user_origin(iddraw,vec1,0)) continue             message_begin(MSG_ONE,SVC_TEMPENTITY,vec1,id)             write_byte( 21)             write_coord(vec1[0])             write_coord(vec1[1])             write_coord(vec1[2]+45)             write_coord(vec1[0]-2)             write_coord(vec1[1]+20)             write_coord(vec1[2]+46)             write_short( gSprite )             write_byte( 1 ) // startframe             write_byte( 1 ) // framerate             write_byte( 3 ) // life (0.1seg)             write_byte( 16) // width 16             write_byte( 16 ) // noise             if (iddraw==attacker[id]){                 write_byte( 255 ) // r                 write_byte( 100 ) // g                 write_byte( 100 ) // b             }             else if (bIsAtt || id!=attacker[id]){                 write_byte( 100 ) // r                 write_byte( 100 ) // g                 write_byte( 255 ) // b             }             else{                 write_byte( 100 ) // r                 write_byte( 255 ) // g                 write_byte( 100 ) // b             }             write_byte( 205 ) //brightness             write_byte( 0 ) // speed             message_end()         }     } }</pre> </div> <!-- /Code block -->

If someone need I tell what the plugin or some method do, ask me ;)

Thanks for all.
BLACO is offline
Send a message via Skype™ to BLACO
 



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 11:03.


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