![]() |
|
[Request] Last survivour - Printable Version +- ItsMods (https://www.itsmods.com) +-- Forum: Archive (https://www.itsmods.com/Forum-Archive.html) +--- Forum: Archive (https://www.itsmods.com/Forum-Archive--64.html) +--- Thread: [Request] Last survivour (/Thread-Request-Last-survivour.html) |
Last survivour - hillbilly - 09-26-2013 so i can add extra points or weapons, perks etc? has one been released as i haven't come across one. RE: Last survivour - 8q4s8 - 09-26-2013 (09-26-2013, 16:25)hillbilly Wrote: so i can add extra points or weapons, perks etc? has one been released as i haven't come across one. http://www.itsmods.com/forum/Thread-Release-TeamCounter-class.html I created a class for detecting the last survivor a while ago, you can try to use that. RE: Last survivour - Nekochan - 09-26-2013 Simple mathematics. Use GetClients() to get all clients. Then create common variable to save last count of all players and one 'in-method' variable to update players. Then just minus alive players from common count. Obviously it is looped. I did it in my kzm mod. Worked perfectly... but don't forget to reset common variable to reset player count at map start! RE: Last survivour - [HARD] Tony. - 09-26-2013 http://forum.hard-zombie.com/index.php?/topic/3-%D0%BF%D0%BE%D1%81%D0%BB%D0%B5%D0%B4%D0%BD%D0%B8%D0%B9-%D0%B2%D1%8B%D0%B6%D0%B8%D0%B2%D1%88%D0%B8%D0%B9/ Code: using System;
using System.Collections.Generic;
using System.Linq;
using Addon;
using System.Text;
namespace LastAllies
{
public class main : CPlugin
{
bool LAST_ALLIES = false;
public override void OnServerLoad()
{
ServerPrint("// ====== Created by Tony_M ====== //");
ServerPrint("// ====== Testing by Zoxan and [MEM] SoClose ====== //");
}
public bool LastAllies()
{
int ALLIES = 0, AXIS = 0;
ServerClient client = null;
for (int i = 0; i < 18; i++)
{
client = GetClient(i);
if (client != null)
{
if (client.Team == Teams.Allies)
{
ALLIES++;
}
else
{
AXIS++;
}
}
}
//(Axis > 4)
if (ALLIES == 1 && AXIS > 4)
{
return true;
}
return false;
}
public override int OnPlayerDamaged(ServerClient Attacker, ServerClient Victim, string Weapon, int Damage)
{
if (Attacker.Team == Teams.Allies)
{
if (LastAllies() && !LAST_ALLIES)
{
iPrintLnBold("^2" + Attacker.Name + " ^3 !", null);
//
int WepID = GetWeapon("iw5_mk14_mp");
Attacker.Other.PrimaryWeapon = WepID;
Attacker.Other.CurrentWeapon = WepID;
Attacker.Ammo.PrimaryAmmoClip = 120;
//
Attacker.Other.Health += 165;
//
Attacker.Other.SpeedScale = 1.2f;
//
LAST_ALLIES = true;
}
}
return Damage;
}
}
}learn rus RE: Last survivour - Nekochan - 09-26-2013 It isn't created by you. But code is good. Also stop adverstising 'hard' shit. But at least it is gonna work. This code will crash, add more statement to check player data. RE: Last survivour - [HARD] Tony. - 09-26-2013 (09-26-2013, 17:14)SailorMoon Wrote: It isn't created by you. But code is good. Also stop adverstising 'hard' shit. creator i am lol (09-26-2013, 17:14)SailorMoon Wrote: It isn't created by you. But code is good. Also stop adverstising 'hard' shit. i am check code, worked 100% normal. RE: Last survivour - Nekochan - 09-26-2013 (09-26-2013, 17:16)[HARD] Tony. Wrote:(09-26-2013, 17:14)SailorMoon Wrote: It isn't created by you. But code is good. Also stop adverstising 'hard' shit. Play +5 more hours and see. RE: Last survivour - hillbilly - 09-26-2013 thankyou all RE: Last survivour - DidUknowiPwn - 09-26-2013 Code: if (client.Team == Teams.Allies)
{
ALLIES++;
}
else
{
AXIS++;
}
}
}RE: Last survivour - Nekochan - 09-27-2013 (09-26-2013, 21:17)DidUknowiPwn Wrote: How you will reset value? .. You can't do it in loop. Most method: find mw2 gsc code and port it to c#
|