AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   End Round weapon stats (https://forums.alliedmods.net/showthread.php?t=57336)

black-eye 07-02-2007 17:45

End Round weapon stats
 
Hey...

Er got a problem whit one of my first scripts...
Its a end round weapon stats poster...

My problem is that i dont get the last hit/kill of the round... why?


Log file:
Code:

L 07/02/2007 - 23:29:59: World triggered "Round_Start"
L 07/02/2007 - 23:30:00: "?<6><X><CT>" attacked "(1)?<5><XX><TERRORIST>" with "usp" (damage "27") (damage_armor "0") (health "73") (armor "0")
L 07/02/2007 - 23:30:01: "?<6><X><CT>" attacked "(1)?<5><XX><TERRORIST>" with "usp" (damage "36") (damage_armor "0") (health "37") (armor "0")
L 07/02/2007 - 23:30:01: "?<6><X><CT>" attacked "(1)?<5><XX><TERRORIST>" with "usp" (damage "38") (damage_armor "0") (health "-1") (armor "0")
L 07/02/2007 - 23:30:01: "?<6><X><CT>" killed "(1)?<5><XX><TERRORIST>" with "usp"
L 07/02/2007 - 23:30:01: Team "CT" triggered "CTs_Win" (CT "2") (T "0")
L 07/02/2007 - 23:30:01: "?<6><X><CT>" triggered "weaponstats" (weapon "usp") (shots "3") (hits "2") (kills "0") (headshots "0") (tks "0") (damage "63") (deaths "0")
L 07/02/2007 - 23:30:01: "?<6><X><CT>" triggered "weaponstats2" (weapon "usp") (head "0") (chest "0") (stomach "1") (leftarm "1") (rightarm "0") (leftleg "0") (rightleg "0")
L 07/02/2007 - 23:30:01: World triggered "Round_End"
L 07/02/2007 - 23:30:12: World triggered "Round_Start"

Script:
Code:

public plugin_init()
{
XXX
XXX
  register_logevent("round_end", 2, "1=Round_End")
}

public round_end()
{
  new id, players, szTeam[16], szName[32], szAuthid[32], iStats[8], iHits[8], szWeapon[24]
  // Find player
  players = get_playersnum()
  if (players == 0) {
    players = 1
  }
  for (id = 1; id <= players; id++) {
    new iUserid = get_user_userid(id)
    new _max = xmod_get_maxweapons()
           
    get_user_team(id, szTeam, 15)
    get_user_name(id, szName, 31)
    get_user_authid(id, szAuthid, 31)

    for (new i = 1 ; i < _max ; ++i) {
      if (get_user_wrstats(id, i, iStats, iHits))
      {
        xmod_get_wpnname(i, szWeapon, 23)
                               
        log_message("^"%s<%d><%s><%s>^" triggered ^"weaponstats^" (weapon ^"%s^") (shots ^"%d^") (hits ^"%d^") (kills ^"%d^") (headshots ^"%d^") (tks ^"%d^") (damage ^"%d^") (deaths ^"%d^")",
        szName, iUserid, szAuthid, szTeam, szWeapon, iStats[4], iStats[5], iStats[0], iStats[2], iStats[3], iStats[6], iStats[1])
        log_message("^"%s<%d><%s><%s>^" triggered ^"weaponstats2^" (weapon ^"%s^") (head ^"%d^") (chest ^"%d^") (stomach ^"%d^") (leftarm ^"%d^") (rightarm ^"%d^") (leftleg ^"%d^") (rightleg ^"%d^")",
        szName, iUserid, szAuthid, szTeam, szWeapon, iHits[1], iHits[2], iHits[3], iHits[4], iHits[5], iHits[6], iHits[7])
      }
    }
  }
}

Anyone how can help me, whit this little problem?

black-eye 07-03-2007 09:52

Re: End Round weapon stats
 
I have found a way to get the last hit/kill.
I just added a set_task with delay on 0.1


All times are GMT -4. The time now is 21:34.

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