Lms prob

Started by Cool, Oct 29, 2015, 12:25 PM

Previous topic - Next topic

Cool

lms not ending when 1 player kills in lms why
Onplayerkillfunction onPlayerKill( killer, player, reason, bodypart )
{
   try{
   if ( ( status[ killer.ID ].IsReg ) && ( status[ player.ID ].IsReg ) )
   {
       status[ killer.ID ].Kills++;
   status[ player.ID ].Deaths++;
IncCash(killer, 500);
DecCash(player, 250);
    ePrivMessage( "Killed: " + player.Name + ", Wep: " + GetWeaponName( reason ) + ", Part: " + GetBodypartName(bodypart) + ", Reward: 0", killer );
    ePrivMessage( "Killer: " + killer.Name + ", Wep: " + GetWeaponName( reason ) + ", Part: " + GetBodypartName(bodypart) + ", Lost: 0", player );
       EchoMessage(ICOL_RED + " " + killer.Name + " killed " + player.Name + " with Wep: " + GetWeaponName( reason ) + ", Part: " + GetBodypartName(bodypart) + ".");
    if ( bodypart <= 6 ) IncPlayerBodyPart( killer, bodypart, 1 );
       if ( reason <= 32 ) IncPlayerWep( killer, reason, 1 );
   status[ killer.ID ].Spree++;
   StartSpree( killer );
   if ( status[ player.ID ].Spree >= 5 ) EndSpree( player, killer );
   if ( stats[ player.ID ].LMS )
        {
         LMSCount--;
         EMessage( ">> " + player.Name + " is out of the LMS round." );
         stats[ player.ID ].LMS = false;
         if ( LMSCount == 1 ) CheckEnd( killer );
stats[ player.ID ].Lost++;
        }
}
   
   }
   catch(e) print( "OnPlayerKill Error: " + e );
}

Full lms Function EXcluding onplayerkill because i posted already and if player exit lms ends and onplayerdeath lms ended but not ending onplayerkill
function CheckEnd( a )
{
       Message( ">> " + a.Name + " has won the LMS match. Reward: [00]" );
       a.Cash += 3000;
       MessagePlayer( "You have been rewarded with 00.", a );
       LMSActive = false;
       stats[ a.ID ].LMS = false;
       a.Pos = Vector( 496.26, -83.9443, 10.0302  );
   LMSCount = 0;
   stats[ a.ID ].Wins++;
   for( local i = 0; i <= GetMaxPlayers(); i++ )
{
local plr = FindPlayer( i );
if ( stats[ plr.ID ].Bet )
  {
   local amount = BAmount;
    if ( stats[ plr.ID ].Bet = a.Name )
  {
   Message( ">>" + plr.Name + " has won the bet which was placed on " + a.Name + "." );
   plr.Cash += amount.tointeger();
   Message( ">>" + plr.Name + " has got $" + amount + "." );
   amount = 0;
  } else MessagePlayer( "You lost the bet", plr );
  }
}
}


function CheckMembers()
{
     if ( LMSCount > 1 )
{
NewTimer( "Ann", 1000, 1, "3" );
NewTimer( "Ann", 2000, 1, "2" );
NewTimer( "Ann", 3000, 1, "1" );
} else CloseLMS();
}

function Ann( number )
{
        for( local i = 0; i <= GetMaxPlayers(); i++ )
{
local plr = FindPlayer( i );
    if ( ( plr ) && ( stats[ plr.ID ].LMS ) )
                        {
switch( number.tointeger() )
    {
case 1:
Announce( "1", plr );
StartLMS();
Announce( "Play!", plr );
break;

case 2:
Announce( "2", plr );
break;

case 3:
Announce( "3", plr );
break;
    }
}
}
}

function StartLMS()
{
    Message( "LMS round activated" );
    local plr;
        for( local i = 0; i <= GetMaxPlayers(); i++ )
{
plr = FindPlayer( i );
    if ( ( plr ) && ( stats[ plr.ID ].LMS ) )
                       {
                         plr.IsFrozen = false;
stats[ plr.ID ].Played++;
                       }
            }
}

function CloseLMS()
{
   Message( "LMS cancelled due to less players." );
   LMSActive = false;
   LMSCount = 0;
    local plr;
        for( local i = 0; i <= GetMaxPlayers(); i++ )
{
plr = FindPlayer( i );
    if ( ( plr ) && ( stats[ plr.ID ].LMS ) )
                       {
                         stats[ plr.ID ].LMS = false;
                         plr.IsFrozen = false;
                         plr.Pos = Vector( 496.26, -83.9443, 10.0302  );
if ( BAmount > 0 ) Message( ">> The bet amount have been lost." );
BAmount = 0;
                       }
                }
}

function CheckEnd2()
{
for( local i = 0; i <= GetMaxPlayers(); i++ )
{
local plr = FindPlayer( i );
local winner = FindPlayer( i );
if (( plr ) && ( stats[ plr.ID ].Bet ))
  {
  if ( stats[ winner.ID ].LMS )
    {
      local amount = BAmount;
       if ( stats[ plr.ID ].Bet = winner.Name )
    {
     Message( "" + plr.Name + " has won the bet which was placed on " + winner.Name + "." );
     plr.Cash += amount.tointeger();
     Message( "" + plr.Name + " has got $" + amount + "." );
     amount = 0;
    } else MessagePlayer( "You lost the bet", plr );
    }
  }

    if ( ( plr ) && ( stats[ plr.ID].LMS ) )
            {
                Message( ">> " + plr.Name + " has won the LMS match. Reward: [00]" );
                plr.Cash += 3000;
                MessagePlayer( "You have been rewarded with 00.", plr );
                LMSActive = false;
                plr.Pos = Vector( 496.26, -83.9443, 10.0302  );
                stats[ plr.ID ].LMS = false;
LMSCount--;
stats[ plr.ID ].Wins++;
  } 

}
}
function BetCheck( plr, Winner )
{
local amount = BAmount;
if ( stats[ plr.ID ].Bet == Winner )
{
Message( "" + plr.Name + " has won the bet which was placed on " + Winner + "." );
plr.Cash += amount.tointeger();
Message( "" + plr.Name + " has got $" + amount + "." );
amount = 0;
} else MessagePlayer( "You lost the bet", plr );
}

function round(value, precision) {
     local factor = pow(10.0, precision);
     return floor(value * factor + 0.5) / factor;
}

Cool


KAKAN

You're welcome, if you don't mind the problem.
oh no

Cool

LOL i wait too much no reply comming i am waiting for reply to solve anyone my mean i say if you help me so thanks if not so thanks
sorry for bad english

KAKAN

Check the LMSCount.
Add this on your onplayerkill
print(LMSCount);
oh no

Cool

Nothing on console coming

KAKAN

Are you expecting it on script load?
Kill someone in LMS and tell
oh no

Cool

LOL i kill someone then i tell noting happens i am not fool

Cool


SAzEe21

@Noob take some screenshots or record video then show us.

KAKAN

Try this:-
if ( LMSCount <= 1 ) CheckEnd( killer );
oh no

Cool

Not working same prob

rulk

are the players your testing with registered ?  You've got everything in the OnPlayerKill event wrapped around...
if ( ( status[ killer.ID ].IsReg ) && ( status[ player.ID ].IsReg ) )
We are all god's children.

Cool

I didnt get you but if your mean is that i am testing lms with registered players so yes players registered on which i test lms

rulk

#14
yes, that's what i meant.
Ok, remove the try/catch and see if any errors are in the console.

edit: your setting  "stats[ player.ID ].LMS = false;" twice, once in the OnPlayerKill event and again in the CheckEnd function, its only needed once in the OnPlayerKill event - this change wont fix your problem tho, its just a observation.
We are all god's children.