public static void SpawnOnStartEvents() { ArenaData data = GameRules.GetArenaInfo(); foreach (GameEvent events in data.StartEvents) { events.SpawnEvent(); } foreach (SecurityGaurds guards in data.SecurityGaurds) { guards.SpawnGaurds(); } }
private static async Task respawnPlayer(Util.Teams team, int playerID, int ped) { string rulesID = "criminal"; if (team == Util.Teams.TEAM_POLICE) { rulesID = "cop"; } ArenaTeamData rules = GameRules.GetArenaInfo().getTeamData(rulesID); if (rules == null) { return; } if (team == Util.Teams.TEAM_CRIMINAL) { await EntityCreate.SetSkin("mp_m_freemode_01", playerID); } else { await EntityCreate.SetSkin("s_m_y_cop_01", playerID); } ped = GetPlayerPed(playerID); SetPlayerInvincible(playerID, false); SetPlayerInvisibleLocally(playerID, false); SetEntityVisible(ped, true, true); SetEntityCollision(ped, true, true); SetCanAttackFriendly(ped, false, true); SetEntityHealth(ped, 200); SetPlayerMaxArmour(playerID, 100); SetPedArmour(ped, 100); Vector3 pos = rules.playerSpawnLocation(); pos.Z = World.GetGroundHeight(pos); SetEntityCoords(ped, pos.X, pos.Y, pos.Z, false, false, false, false); SetEntityRotation(ped, 0, 0, rules.getSpawnHeading(), 0, true); NetworkResurrectLocalPlayer(pos.X, pos.Y, pos.Z, rules.getSpawnHeading(), true, true); FreezeEntityPosition(ped, false); if (team == Util.Teams.TEAM_CRIMINAL) { SetPedComponentVariation(ped, 0, 0, 0, 2); // Face SetPedComponentVariation(ped, 2, 11, 4, 2); // Hair SetPedComponentVariation(ped, 4, 1, 5, 2); // Pantalon SetPedComponentVariation(ped, 6, 1, 0, 2); // Shoees SetPedComponentVariation(ped, 11, 7, 2, 2); // Jacket GiveWeaponToPed(ped, (uint)GetHashKey("WEAPON_CROWBAR"), 0, false, false); GiveWeaponToPed(ped, (uint)GetHashKey("WEAPON_DBSHOTGUN"), 10, false, false); GiveWeaponToPed(ped, (uint)GetHashKey("WEAPON_COMBATPDW"), 260, false, true); GiveWeaponToPed(ped, (uint)GetHashKey("WEAPON_MOLOTOV"), 1, false, false); Team = Util.Teams.TEAM_CRIMINAL; } else { GiveWeaponToPed(ped, (uint)GetHashKey("WEAPON_PISTOL"), 120, false, false); GiveWeaponToPed(ped, (uint)GetHashKey("WEAPON_STUNGUN"), 2, false, false); GiveWeaponToPed(ped, (uint)GetHashKey("WEAPON_NIGHTSTICK"), 0, false, false); GiveWeaponToPed(ped, (uint)GetHashKey("WEAPON_PUMPSHOTGUN"), 120, false, true); SetCanAttackFriendly(ped, false, false); Team = Util.Teams.TEAM_POLICE; } SetPedRelationshipGroupHash(ped, (uint)GetHashKey(rulesID)); setupTeamRelationships(); bisDead = false; }