Vice City Multiplayer

VC:MP => mIRC/pawn Scripting => Topic started by: Amenine on December 30, 2008, 04:27:31 PM

Title: Ratio Problem..
Post by: Amenine on December 30, 2008, 04:27:31 PM
Here ..its not working..anything wrong in it,,
Code:
elseif ($2 == !danger) {
   var %a = 0,%c = -100
   while (%aa <= %MaxPlayers) {
     if ((%ratio > %c) var %b = $vcmp.name(%a),%c = %ratio
     elseif ((%ratio == %c) {
       if ($vcmp.kills(%b) > $vcmp.kills(%a)) { }
       elseif ($vcmp.kills(%b) < $vcmp.kills(%a)) var %b = $vcmp.name(%a),%c = %ratio
     }
     !inc %aa
   }
   if (%b) vcmp.say == %b is the most dangerous player with a ratio of %c
   else { }
 }


Thanks
Amenine
Title: Re: Ratio Problem..
Post by: Force on December 30, 2008, 04:57:08 PM
I don't see the %aa or %ratio variable defined there....
Title: Re: Ratio Problem..
Post by: Amenine on December 30, 2008, 05:41:17 PM
What do u mean??
Means:How it shows the ratio of the player..??

Edit:[/b]:var %ratio = $round($calc($vcmp.kills(%a) / $vcmp.deaths(%a)),2)..This..??

Confusing  
Amenine
Title: Re: Ratio Problem..
Post by: Force on December 30, 2008, 06:08:22 PM
You can't take a variable from somewhere else in the script, it has to be under the particular part.

Aka, If you had this:


var %ratio = blalh
vcmp.say Stats: Blalh - Kills: 11111 - Deaths: 1111 - Ratio: %ratio


You can't then do:


elseif ($2 == !danger) {
    var %a = 0,%c = -100
    while (%aa <= %MaxPlayers) {
      if ((%ratio > %c) var %b = $vcmp.name(%a),%c = %ratio
      elseif ((%ratio == %c) {
        if ($vcmp.kills(%b) > $vcmp.kills(%a)) { }
        elseif ($vcmp.kills(%b) < $vcmp.kills(%a)) var %b = $vcmp.name(%a),%c = %ratio
      }
      !inc %aa
    }
    if (%b) vcmp.say == %b is the most dangerous player with a ratio of %c
    else { }
  }


because it doesn't know where the %ratio variable is. Same applies for the missing %aa variable you have but your using.
Title: Re: Ratio Problem..
Post by: [NoN]Toiletduck on January 11, 2009, 10:34:45 AM
I found the problem with Amenine's script is that he removed half of the script.

  elseif (!stat* iswm $2) || (!pmstat* iswm $2) {
    var %ratio = $round($calc($vcmp.kills(%a) / $vcmp.deaths(%a)),2)
    if ($vcmp.cmdcheck(!stats,%id) == fail) !halt
    elseif (%a == -1) vcmp.msg %id Error - Absent ID/Name
    else vcmp.say $vcmp.name(%a) $+ 's Stats - Joins: $vcmp.joins(%a) $+ , Kills: $vcmp.kills(%a) $+ , Deaths: $vcmp.deaths(%a) $+ , Ratio: %ratio ,
  }