|
楼主 |
发表于 2007-9-23 23:38:08
|
显示全部楼层
来自 中国–广东–广州–白云区
回复: T 的1.5 双手MP5枪插件
new plrHealth = get_user_health(id)
new plrNewDmg
//
// plrDmg is set to how much damage was done to the victim
// plrHealth is set to how much health the victim has
// plrAttacker is set to the id of the person doing the shooting
//
// Could have put the above on one line, didn't for learning purposes (nubs may read this!) lol
// Example: new plrWeap, plrPartHit, plrAttacker = get_user_attacker( .. etc etc
//
if (plrWeap != CSW_MP5NAVY){
// If the damage was not done with an MP5, just exit function..
return PLUGIN_CONTINUE
}
if (is_user_alive(id)){
// If the victim is still alive.. (should be)
plrNewDmg = (plrHealth - plrDmg)
//
// Make the new damage their current health - plrDmg..
// This is actually damage 2x, becuase when they did the damage
// lets say it was 10, now this is subtracting 10 from current heatlh
// doing 20, so thats 2 times =D
//
if(plrNewDmg < 1){
// If the new damage will kill the player..
set_msg_block(get_user_msgid("DeathMsg"),BLOCK_ONCE);
// Block one the death messages to prevent 'suicide'
message_begin(MSG_ALL, get_user_msgid("DeathMsg"), {0,0,0}, 0)
// Start a death message, so it doesnt just say "Player Died",
// the killer will get the credit
write_byte(plrAttacker)
// Write KILLER ID
write_byte(id)
// Write VICTIM ID
write_byte(random_num(0,1))
// Write HEAD SHOT or not
// I made this random because I was unsure of how to detect
// if plrPartHit was "head" or not.. someone help..
write_string("mp5navy")
// Write the weapon VICTIM ID was killed with..
message_end()
// End the message..
}
set_user_health(id, plrNewDmg)
// Then set the health, even if it will kill the player
}
return PLUGIN_CONTINUE
} |
|