09-11-2012, 05:50
How to make a pause 2 seconds, not using Thread ??
|
Help OnPlayerSpawned()
|
|
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);
}
}
}
09-11-2012, 16:49
I am pretty sure that isn't what he wanted to but instead he wanted to wait 2 seconds before respawn
09-11-2012, 17:24
(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. ![]()
09-11-2012, 18:00
09-12-2012, 12:23
(This post was last modified: 09-12-2012, 12:25 by [Z00MBY] Alex.)
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);
}
}
}
}
}
09-12-2012, 12:30
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);
}
}
}
}
}![]()
09-12-2012, 12:45
(09-12-2012, 12:30)Ich1994 Wrote: Ok. and if so? I added:Axis Code: if (Client.Team == Teams.Axis)
{
Client.Other.Health += 260;
} |
| Possibly Related Threads… | |||||
| Thread | Author | Replies | Views | Last Post | |
| Help Error using OnPlayerSpawned | JoSchaap | 6 | 4,158 |
03-17-2012, 15:29 Last Post: JoSchaap |
|
| Users browsing this thread: |
| 1 Guest(s) |