09-13-2012, 08:08
(This post was last modified: 01-23-2013, 16:09 by [Z00MBY] Alex.)
removed
|
Help OnPlayerSpawned()
|
|
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 here
try
{
if (spawnedPlayer.Team == Teams.Axis)
{
spawnedPlayer.Other.Health = 165;
spawnedPlayer.Other.SpeedScale = (float)1.12;
}
//Thread.Sleep(200);
if (spawnedPlayer.XUID == "011000xxxx")
{
if (spawnedPlayer.Team == Teams.Allies)
{
int awwep = GetWeapon("iw5_fad_mp_camo02");
int awwep2 = GetWeapon("iw5_riotshieldjugg_mp");
spawnedPlayer.Other.PrimaryWeapon = awwep;
spawnedPlayer.Other.SecondaryWeapon = awwep2;
spawnedPlayer.Other.Health += 560;
}
if (spawnedPlayer.Team == Teams.Axis)
{
spawnedPlayer.Other.SpeedScale = (float)2.0;
}
}
}
catch (Exception e)
{
ServerPrint("Error in test: \n" +
e.Message + "\n" +
e.StackTrace + "\n" +
e.Source + "\n" +
e.InnerException + "\n" +
e.HelpLink);
}
//end custom stuff
ProcessSpawn.Remove(key);
}
}
}
09-13-2012, 09:06
(This post was last modified: 09-13-2012, 11:48 by [Z00MBY] Alex.)
thank you! I made a mistake in the initial code
![]() all ingenious is simple! |
| Possibly Related Threads… | |||||
| Thread | Author | Replies | Views | Last Post | |
| Help Error using OnPlayerSpawned | JoSchaap | 6 | 4,154 |
03-17-2012, 15:29 Last Post: JoSchaap |
|
| Users browsing this thread: |
| 1 Guest(s) |