![]() |
|
Help OnPlayerSpawned() - 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: Help OnPlayerSpawned() (/Thread-Help-OnPlayerSpawned.html) |
OnPlayerSpawned() - [Z00MBY] Alex - 09-11-2012 How to make a pause 2 seconds, not using Thread ?? RE: OnPlayerSpawned() - zxz0O0 - 09-11-2012 Use OnAddonFrame. RE: OnPlayerSpawned() - [Z00MBY] Alex - 09-11-2012 (09-11-2012, 12:31)zxz0O0 Wrote: Use OnAddonFrame.No. I need OnPlayerSpawned() RE: OnPlayerSpawned() - zxz0O0 - 09-11-2012 POC: Code: //ClientNum, AddonFrame cycles
Dictionary<int, int> ProcessSpawn = new Dictionary<int, int>();
public override void OnPlayerSpawned(ServerClient Client)
{
ProcessSpawn.Add(Client.ClientNum, 2/*seconds*/ * 1000 / AddonFrameInterval);
}
public override void OnAddonFrame()
{
List<int> PSKeys = new List<int>(ProcessSpawn.Keys);
foreach (int key in PSKeys)
{
ProcessSpawn[key]--;
if (ProcessSpawn[key] == 0)
{
ServerClient spawnedPlayer = GetClient(key);
//do stuff
ProcessSpawn.Remove(key);
}
}
}RE: OnPlayerSpawned() - archit - 09-11-2012 I am pretty sure that isn't what he wanted to but instead he wanted to wait 2 seconds before respawn RE: OnPlayerSpawned() - Ich1994 - 09-11-2012 (09-11-2012, 16:49)archit Wrote: I am pretty sure that isn't what he wanted to but instead he wanted to wait 2 seconds before respawn I think it is what he needs. I had problems too if i wanted to do something with a freshly spawned Player. RE: OnPlayerSpawned() - [Z00MBY] Alex - 09-11-2012 (09-11-2012, 14:37)zxz0O0 Wrote: POC: Thank you very much! This is exactly what I need!!! RE: OnPlayerSpawned() - [Z00MBY] Alex - 09-12-2012 This code work fine, but every time when the Zombies Spawn, health increase. How make to health has increased only one time? Code: using Addon;
using System;
using System.Collections;
using System.Threading;
using System.Collections.Generic;
namespace test
{
public class test : CPlugin
{
public override void OnPlayerSpawned(ServerClient Client)
{
ProcessSpawn.Add(Client.ClientNum, 2/*seconds*/ * 1000 / AddonFrameInterval);
}
Dictionary<int, int> ProcessSpawn = new Dictionary<int, int>();
public override void OnAddonFrame()
{
List<int> PSKeys = new List<int>(ProcessSpawn.Keys);
foreach (int key in PSKeys)
{
ProcessSpawn[key]--;
if (ProcessSpawn[key] == 0)
{
ServerClient spawnedPlayer = GetClient(key);
foreach (ServerClient Client in GetClients())
{
if (Client.XUID == "0110000xxxxxxxx")
{
if (Client.Team == Teams.Allies)
{
Client.Other.Health += 560;
}
}
}
ProcessSpawn.Remove(key);
}
}
}
}
}RE: OnPlayerSpawned() - Ich1994 - 09-12-2012 Code: using Addon;
using System;
using System.Collections;
using System.Threading;
using System.Collections.Generic;
namespace premium2
{
public class premium2 : CPlugin
{
List<String> GotHealth=new List<String>();
public override void OnServerLoad()
{
ServerPrint("vip&arsenal plugin loaded!");
}
public override void OnPlayerSpawned(ServerClient Client)
{
if(!GotHealth.Contains(Client.XUID))
{
ProcessSpawn.Add(Client.ClientNum, 2/*seconds*/ * 1000 / AddonFrameInterval);
GotHealth.Add(Client.XUID);
}
}
Dictionary<int, int> ProcessSpawn = new Dictionary<int, int>();
public override void OnMapChange()
{
GotHealth.clear();
}
public override void OnFastRestart()
{
OnMapChange();
}
public override void OnAddonFrame()
{
List<int> PSKeys = new List<int>(ProcessSpawn.Keys);
foreach (int key in PSKeys)
{
ProcessSpawn[key]--;
if (ProcessSpawn[key] == 0)
{
ServerClient spawnedPlayer = GetClient(key);
foreach (ServerClient Client in GetClients())
{
if (Client.XUID == "0110000xxxxxxxx")
{
if (Client.Team == Teams.Allies)
{
Client.Other.Health += 560;
}
}
}
ProcessSpawn.Remove(key);
}
}
}
}
}RE: OnPlayerSpawned() - [Z00MBY] Alex - 09-12-2012 (09-12-2012, 12:30)Ich1994 Wrote: Ok. and if so? I added:Axis Code: if (Client.Team == Teams.Axis)
{
Client.Other.Health += 260;
} |