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;
}
no help thanks
You're welcome, if you don't mind the problem.
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
Check the LMSCount.
Add this on your onplayerkill
print(LMSCount);
Nothing on console coming
Are you expecting it on script load?
Kill someone in LMS and tell
LOL i kill someone then i tell noting happens i am not fool
@Noob take some screenshots or record video then show us.
Try this:-
if ( LMSCount <= 1 ) CheckEnd( killer );
Not working same prob
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 ) )
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
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.
nothing comming
how many players are you testing with ?
2
at the top of the OnPlayerKill event, put
print( stats[ player.ID ].LMS );
look in the console, what does it return ?
well, if its returning nothing, that's your problem.
// Your asking it to return a value
if ( stats[ player.ID ].LMS )
{
// This part is only triggered if the above statement is true
}
and in your case, you said it's returning nothing, so the code in the if statement wont get triggered.
Take a break and listen to this
https://www.youtube.com/watch?v=cc-ep3ldGVQ
Then post me your lms join code
if ( cmd == "join" )
{
if ( !LMSActive ) MessagePlayer( "LMS is not active.", player );
else if ( stats[ player.ID ].LMS ) MessagePlayer( "Already in LMS.", player );
else if ( !player.Spawned ) MessagePlayer( "Not yet spawned.", player );
else if ( player.Health < 75 ) MessagePlayer( "Need more HP [75%]", player );
else
{
player.Pos = Vector(-754.187866, -1602.638916, 23.734970);
player.IsFrozen = true;
Message( ">> " + player.Name + " joined LMS" );
LMSCount++;
player.Team = -1;
stats[ player.ID ].LMS = true;
player.Health = 100;
}
}
you told me this returned nothing. its either going to return true or false.
print( stats[ player.ID ].LMS );
go back a step, and tell me what it returns
nothing and if i try to print anything onplayerkill nothing retruning whats can cause of it :P
Edit:Check Pm
not sure about that, but you've defiantly removed the try/catch statement?, because there's got to be a error returning somewhere
the lms join code looks fine, i'm sure it's one of the if statements in your OnPlayerKill event not triggering, which one i dunno tho
Like this you sayfunction onPlayerKill( killer, player, reason, bodypart )
{
print( stats[ player.ID ].LMS );
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++;
}
}
}
send me your script and i'll look at it tomorrow, I don't have the time right now.
trying to debug over a forum is not easy lol
relax and listen to this
https://www.youtube.com/watch?v=aL8kZ-iVk90
I'll have a look at your script tomorrow for you.
Ok thanks
Quote from: Noob on Oct 31, 2015, 07:48 PMLike this you say[spoiler]function onPlayerKill( killer, player, reason, bodypart )
{
print( stats[ player.ID ].LMS );
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++;
}
}
}
[/spoiler]
Really? It shows nothing in the console?
Update your server version this time :D
Also make sure you don't have multiple onPlayerKill functions in your script.
Nope only single
I actually think this is a VC:MP bug, because i am writing a game-mode but also cannot get the 'onPlayerKill' event to trigger.
I am using VC:MP in windowed mode and connecting from the same PC.
Even if i strip everything out and put something as simple as
function onPlayerKill( killer, player, reason, bodypart )
{
print( player.Name );
}
It still won't print anything to the console.
is it possible if a dev could look into this ? or is anyone else having the same problem. Remember i am connecting both players from the same computer and i am in windowed mode.
Kind regards
rulk
@rulk, Please consider this:
http://forum.vc-mp.org/?topic=254.msg1389#msg1389
@Doom_Killer That's the answer!! your a genius. :-)
Team -1 is the free team.
Btw, if your server is based on DM (FFA), then you can use this:-
function onPlayerTeamKill( killer, player, reason, bodypart )
{
onPlayerKill( killer, player, reason, bodypart )
}
I posted this because
@Noob can solve that thing.
Thanks @Kakan
@rulk @DoomKiller for help at last this topic solved thanks to all
Doomkiller hates me but thanks if you dont hate me give a like to my this post :P