| closedLog custom weapon damage... |
| Started by =|[76AD]|= TatsuSaisei on 08-08-2006, 09:32 PM |
Threads: 54
Joined: May 2005
I figured out how to "log" kills with a custom weapon, but what I want to know now is how to "log" the damage done by the weapon...
Threads: 54
Joined: May 2005
well, I found some natives that sound like it might be what I need, but heck if I can find any documentation on it... n n/* Custom Weapon Support */n/* function will return index of new weapon */nnative custom_weapon_add( wpnname[], melee = 0, logname[]="" ); n/* Function will pass damage done by this custom weapon to stats module and other plugins */nnative custom_weapon_dmg( weapon, att, vic, damage, hitplace=0 ); n/* Function will pass info about custom weapon shot to stats module */nnative custom_weapon_shot( weapon, index ); // weapon id , player idn/* function will return 1 if true */nnative xmod_is_melee_wpn(wpnindex);n/* Returns weapon name. */nnative xmod_get_wpnname(wpnindex, name[], len);n/* Returns weapon logname. */nnative xmod_get_wpnlogname(wpnindex, name[], len);n/* Returns weapons array size */nnative xmod_get_maxweapons();n/* Returns stats array size ex. 8 in TS , 9 in DoD */nnative xmod_get_stats_size();n/* Returns 1 if true */nnative xmod_is_custom_wpn(wpnindex);n nnow mind you... everything I know about PAWN comes from reverse engineering everyone elses plugins, and the experience I have in other languages... and I am a "book" learned type of person, and the documentation on the AMXX stuff is not as good as I would like...n nso... does anyone know anything about these natives, OR know where to look for more "help" ... I have looked through the amxx forum, and have actually talked to a few coders, but none are experienced in DOD, so you guys are the "kings" in this category...
Threads: 103
Joined: May 2005
well isnt that stuff done thru stats_logging plugin?nnlike:n
n log_message("^"%s<%d><%s><%s>^" triggered ^"weaponstats^" (weapon ^"%s^") (shots ^"%d^") (hits ^"%d^") (kills ^"%d^") (headshots ^"%d^") (tks ^"%d^") (damage ^"%d^") (deaths ^"%d^") (score ^"%d^")", szName,iUserid,szAuthid,szTeam,szWeapon,iStats[4],iStats[5],iStats[0], iStats[2],iStats[3],iStats[6],iStats[1],iStats[7])nnisnt that logged for each weapon used on disconnect?nnuses like:n
nget_user_wstats( id , i ,iStats , iHits )nnso i dont know if theres anyway to write to that tho.. not even sure if that helps anynbut maybe you could just create a similar log message for your weapon when clients disconnect.. only think is you'd have to collect all the individual parts of the message
Threads: 54
Joined: May 2005
I have slowly been getting it... I am logging kills and certain damage now... BUT, what I need to do is stop the logging of the original weapon that has been replaced... I spent a good 2-3 hours skimming forums last night and did not find anything useful... what I did find is a bit disappointing... what I need to do is STOP a death before it happens... and then "kill" the player with code... but the more I read, the more people say its not possible to "stop" a death... or its not possible to reduce damage BEFORE its dealt to a player... and "adding health" to avoid a kill will not help those times that one hit kills...n nbtw, Diamond, I read a post of yours (amxmodx forums) about some rock throwing plugin you were try to make, which sounds like at one time you were trying to do the same thing as I am now.... how did that ever work out ??
Threads: 17
Joined: Jan 2005
Well you can block the death message, but i dont think there is anyway to block damage messages.
Threads: 54
Joined: May 2005
Well you can block the death message, but i dont think there is anyway to block damage messages.nno, I do not want to block damage messages, those I want... and I don't care about the death messages, I have it showing a "world" kill, which is fine for now...n nWhat I want to do is stop a death/kill from happening, so the "real" weapon used does not get the kill stat....n nHere is what I have... I took the dod_ninja plugin, added the extra model bit so others see the sword... and I made it so the "ninja" gets a spade, regardless of the team (axis/allies) becuase the spade animation from the player is an overhead chop, where as the knives are stab animations... the stab animation looks so wrong when a sword is in a players hand... but the spade animation... WOW, does it look nice to see a player coming at you with sword swinging...n nanyways... I have the "katana" logging kills now, BUT the spade is also getting the stat as well.. and THAT is what I want to stop... see the game doesnt care what "I" call the weapon, underneath the fancy coding trickery of replacing the spade model with a katana, it is still a spade... so what I want to do is have code that STOPS the spade from killing someone if they are a "ninja" use the user_kill/user_silentkill code and the code to +1 scoreboard stats... I can get the damage managed now with some code, but like I said, now all "katana" kills are also logging spade kills and damage... and I want to stop that...n nI'm the kind of person who thrives on being told it is impossible... ALL things are possible, you just have to "figure" it out, or come up with a valid workaround...
Threads: 17
Joined: Jan 2005
I think in this case its impossible =p
Threads: 103
Joined: May 2005
well lol that rock plugin.. put it on my server last night.. and it would make it crash like every few hrs or less.. and for some reason it wouldnt reboot itself each time.. dont have any idea whats wrong with it.. but this is what im doing (but i dont have to block a kill to begin with..)nn
n set_msg_block(get_user_msgid("DeathMsg"),BLOCK_ONCE)n log_block_state = truen user_kill(object, 1)n log_block_state = falsen n message_begin(MSG_ALL, get_user_msgid("DeathMsg"),{500, 500, 500}, 0)n write_byte(owner)n write_byte(object)n write_byte(0)n message_end()n n new steam[32], teamname[32], name[32]n new steam2[32], teamname2[32], name2[32]n get_user_authid(owner, steam, 31)n get_user_authid(object, steam2, 31)n dod_get_pl_teamname(owner, teamname, 31)n dod_get_pl_teamname(object, teamname2, 31)n get_user_name(owner, name, 31)n get_user_name(object, name2, 31)n n log_message("^"%s<%d><%s><%s>^" killed ^"%s<%d><%s><%s>^" with ^"rock^"", name, get_user_userid(owner), steam, teamname, name2, get_user_userid(object), steam2, teamname2)n n dod_set_user_kills(owner, dod_get_user_kills(owner) + 1)nnnpublic log_block(type, msg[])n{n return(log_block_state?FMRES_SUPERCEDE:FMRES_IGNORED)n}nnThreads: 54
Joined: May 2005
I think in this case its impossible =pnIn my effort to create my MG mustdeploy plugin, I found the answer to my problem... thanx to Wilson. I found that I could block the damage a weapon deals by using the following code:n n
public client_PreThink(id) {n new clip, ammo, myWeapon = dod_get_user_weapon(id,clip,ammo)n if((myWeapon == DODW_SPADE&&g_status[id])){n if(entity_get_int(id, EV_INT_button) & IN_ATTACK) {n if(dod_is_deployed(id) == 0){n client_print(id,print_chat,"Samurai - Katana") //testing textn entity_set_int(id, EV_INT_button, entity_get_int(id, EV_INT_button) & ~IN_ATTACK)n return PLUGIN_HANDLEDn }n }n }n return PLUGIN_HANDLEDn}n nIt still allows the player to go through the normal attack animation, I just have to see about getting the players weapon model to recognize when it "touches" another player model, then code up damage sequences....Threads: 103
Joined: May 2005
you could try like:nn
n new ent,trashn get_user_aiming(id,ent,trash)n if(ent && pev_valid(ent) && ent>32)n {n new classname[32]n pev(ent,pev_classname, classname, 31)n if(equali(classname,"player"))n { n new Float:origin1[3], Float:origin2[3]n pev(id, pev_origin, origin1)n pev(ent, pev_origin, origin2)n new distance = floatround(get_distance_f(origin1, origin2))n n if(distance <= 100)n .......................................n nthat way they have to be aiming at the other player and within a certain distance.. which you'd have to play around with that number..nnbasically the way ive got my animals so they can be killed by knives/bayosThreads: 54
Joined: May 2005
you could try like:n nn nusing a method similar to this (aiming and distance) but using different conditions, it DOES in fact work. So the "impossible" is possible...n nThe next step is to get the players model to do a specific sequence during this time, as since the death/damage is now blocked, it also stops the sequence from displaying to others. This is the next hurdle...nthat way they have to be aiming at the other player and within a certain distance.. which you'd have to play around with that number..n nbasically the way ive got my animals so they can be killed by knives/bayosn new ent,trashn get_user_aiming(id,ent,trash)n if(ent && pev_valid(ent) && ent>32)n {n new classname[32]n pev(ent,pev_classname, classname, 31)n if(equali(classname,"player"))n { n new Float:origin1[3], Float:origin2[3]n pev(id, pev_origin, origin1)n pev(ent, pev_origin, origin2)n new distance = floatround(get_distance_f(origin1, origin2))n n if(distance <= 100)n .......................................n
Threads: 54
Joined: May 2005
well isnt that stuff done thru stats_logging plugin?n nlike:n nisnt that logged for each weapon used on disconnect?n nuses like:n nso i dont know if theres anyway to write to that tho.. not even sure if that helps anynbut maybe you could just create a similar log message for your weapon when clients disconnect.. only think is you'd have to collect all the individual parts of the messagenyes this is how it would be done, but not on disconnect, but after each "hit" or "kill", 1 log line for each action.... or constuct an array to collect the information as you play, THEN on disconnect use the values contained in the array to write only one log line, upon player disconnect.... either way works:D

