public void startCreator(Client player)
        {
            API.setEntityPosition(player, new Vector3(407.458771, -966.489685, -99.0090561));
            API.setEntityRotation(player, new Vector3(0, 0, 140.5));
            Cams.createCameraActive(player, new Vector3(413.93, -976.4, -98.35), new Vector3(0, 0, 179));      //gtam
            Cams.createCameraInactive(player, new Vector3(404.73, -976.4, -98.35), new Vector3(0, 0, 179));    //gtaof
            Cams.createCameraInactive(player, new Vector3(395.6, -976.4, -98.35), new Vector3(0, 0, 179));     //ped
            Cams.createCameraInactive(player, new Vector3(407, -967.22, -98.2), new Vector3(0, 0, -375));      //face
            Cams.createCameraInactive(player, new Vector3(406.33, -968.62, -98.67), new Vector3(0, 0, -41.5)); //clothes
            var dim = DimensionManager.RequestPrivateDimension(player);

            player.setSkin(PedHash.FreemodeMale01);
            player.dimension = dim;
            showCreatorMenu(player);
            player.freeze(true);
        }
Exemple #2
0
        public void ClientEvent(Client sender, string eventName, object[] args)
        {
            if (eventName == "skin_select_accept")
            {
                var skin = args[0];
                API.setEntityData(sender, "Skin", skin);

                DimensionManager.DismissPrivateDimension(sender);
                API.setEntityDimension(sender, 1);

                if (Database.IsPlayerLoggedIn(sender))
                {
                    SpawnCitizen(sender);
                    API.call("Interaction", "Customize", sender);
                }
            }
        }
        public void clientEvent(Client sender, string eventName, object[] args)
        {
            if (eventName == "menu_handler_select_item")
            {
                var callbackId = (int)args[0];
                var ind        = (int)args[1];
                if (callbackId == PED_HEAD)
                {
                    switch (ind)
                    {
                    case 0:
                    {
                        var count = sender.getData("Scount");
                        if (sender.model == (int)PedHash.FreemodeMale01)
                        {
                            if (count < maleheads.Count())
                            {
                                sender.setData("GTAO_SHAPE_FIRST_ID", maleheads[count]);
                                sender.setSyncedData("GTAO_SHAPE_FIRST_ID", maleheads[count]);
                                sender.setData("GTAO_SKIN_FIRST_ID", maleheads[count]);
                                sender.setSyncedData("GTAO_SKIN_FIRST_ID", maleheads[count]);
                                API.call("GTAOnlineCharacter", "updatePlayerFace", sender.handle);

                                count++;
                                sender.setData("Scount", count);
                            }
                            else
                            {
                                count = 0;
                                sender.setData("Scount", count);
                            }
                        }
                        else
                        {
                            if (count < femaleheads.Count())
                            {
                                sender.setData("GTAO_SHAPE_FIRST_ID", femaleheads[count]);
                                sender.setSyncedData("GTAO_SHAPE_FIRST_ID", femaleheads[count]);
                                sender.setData("GTAO_SKIN_FIRST_ID", femaleheads[count]);
                                sender.setSyncedData("GTAO_SKIN_FIRST_ID", femaleheads[count]);
                                API.call("GTAOnlineCharacter", "updatePlayerFace", sender.handle);

                                count++;
                                sender.setData("Scount", count);
                            }
                            else
                            {
                                count = 0;
                                sender.setData("Scount", count);
                            }
                        }
                        break;
                    }

                    case 1:
                    {
                        var count = sender.getData("Scount");
                        if (sender.model == (int)PedHash.FreemodeMale01)
                        {
                            if (count < maleheads.Count())
                            {
                                sender.setData("GTAO_SHAPE_SECOND_ID", maleheads[count]);
                                sender.setSyncedData("GTAO_SHAPE_SECOND_ID", maleheads[count]);
                                sender.setData("GTAO_SKIN_SECOND_ID", maleheads[count]);
                                sender.setSyncedData("GTAO_SKIN_SECOND_ID", maleheads[count]);
                                API.call("GTAOnlineCharacter", "updatePlayerFace", sender.handle);

                                count++;
                                sender.setData("Scount", count);
                            }
                            else
                            {
                                count = 0;
                                sender.setData("Scount", count);
                            }
                        }
                        else
                        {
                            if (count < femaleheads.Count())
                            {
                                sender.setData("GTAO_SHAPE_SECOND_ID", femaleheads[count]);
                                sender.setSyncedData("GTAO_SHAPE_SECOND_ID", femaleheads[count]);
                                sender.setData("GTAO_SKIN_SECOND_ID", femaleheads[count]);
                                sender.setSyncedData("GTAO_SKIN_SECOND_ID", femaleheads[count]);
                                API.call("GTAOnlineCharacter", "updatePlayerFace", sender.handle);

                                count++;
                                sender.setData("Scount", count);
                            }
                            else
                            {
                                count = 0;
                                sender.setData("Scount", count);
                            }
                        }
                        break;
                    }

                    case 2:
                    {
                        var count = sender.getData("Scount");
                        if (count < 31)
                        {
                            sender.setData("GTAO_EYE_COLOR", count);
                            sender.setSyncedData("GTAO_EYE_COLOR", count);
                            API.call("GTAOnlineCharacter", "updatePlayerFace", sender.handle);
                            count++;
                            sender.setData("Scount", count);
                        }
                        else
                        {
                            count = 0;
                            sender.setData("Scount", count);
                        }
                        break;
                    }

                    case 3:
                    {
                        var count = sender.getData("Scount");
                        if (count < 33)
                        {
                            sender.setData("GTAO_EYEBROWS", count);
                            sender.setSyncedData("GTAO_EYEBROWS", count);
                            API.call("GTAOnlineCharacter", "updatePlayerFace", sender.handle);
                            count++;
                            sender.setData("Scount", count);
                        }
                        else
                        {
                            count = 0;
                            sender.setData("Scount", count);
                        }
                        break;
                    }

                    case 4:
                    {
                        var count = sender.getData("Scount");
                        if (count < 37)
                        {
                            API.setPlayerClothes(sender, 2, count, 0);
                            sender.setData("draw2", count);
                            count++;
                            sender.setData("Scount", count);
                        }
                        else
                        {
                            count = 0;
                            sender.setData("Scount", count);
                        }
                        break;
                    }

                    case 5:
                    {
                        var count = sender.getData("Scount");
                        if (SetHairColor(sender, count))
                        {
                            count++;
                            sender.setData("Scount", count);
                        }
                        else
                        {
                            count = 0;
                            sender.setData("Scount", count);
                        }
                        break;
                    }

                    case 6:
                    {
                        var count = sender.getData("Scount");
                        if (count < 29)
                        {
                            if (sender.model == (int)PedHash.FreemodeMale01)
                            {
                                sender.setData("GTAO_BEARD", count);
                                sender.setSyncedData("GTAO_BEARD", count);
                            }
                            else
                            {
                                sender.setData("GTAO_MAKEUP", count);
                                sender.setSyncedData("GTAO_MAKEUP", count);
                            }
                            API.call("GTAOnlineCharacter", "updatePlayerFace", sender.handle);
                            count++;
                            sender.setData("Scount", count);
                        }
                        else
                        {
                            count = 0;
                            sender.setData("Scount", count);
                        }
                        break;
                    }

                    case 7:
                    {
                        var count = sender.getData("Scount");
                        if (count < 28)
                        {
                            if (sender.model == (int)PedHash.FreemodeMale01)
                            {
                                sender.setData("GTAO_BEARD_COLOR", count);
                                sender.setSyncedData("GTAO_BEARD_COLOR", count);
                            }
                            else
                            {
                                sender.setData("GTAO_MAKEUP_COLOR", count);
                                sender.setSyncedData("GTAO_MAKEUP_COLOR", count);
                                sender.setData("GTAO_MAKEUP_COLOR2", count);
                                sender.setSyncedData("GTAO_MAKEUP_COLOR2", count);
                            }
                            API.call("GTAOnlineCharacter", "updatePlayerFace", sender.handle);
                            count++;
                            sender.setData("Scount", count);
                        }
                        else
                        {
                            count = 0;
                            sender.setData("Scount", count);
                        }
                        break;
                    }

                    case 8:
                    {
                        showPedMenu(sender);
                        Cams.interpolateCamera(sender, 4, 500, false, false);
                        API.triggerClientEvent(sender, "display_subtitle", "Press ~g~E ~w~ to confirm outfit and play!", 30000);
                        API.sendChatMessageToPlayer(sender, "Press ~g~E ~w~ to confirm outfit and play!");
                        API.setEntitySyncedData(sender, "LastStep", true);
                        break;
                    }
                    }
                }

                else if (callbackId == PED_CREATOR)
                {
                    switch (ind)
                    {
                    case 0:
                    {
                        // API.triggerClientEvent(sender, "skin_type_gtaom");
                        Cams.interpolateCamera(sender, 0, 1000, false, false);
                        showCreatorMenu(sender);
                        API.setPlayerSkin(sender, PedHash.FreemodeMale01);
                        API.call("GTAOnlineCharacter", "initializePedFace", sender.handle);
                        API.setEntitySyncedData(sender, "GTAO_HAS_CHARACTER_DATA", true);
                        API.setEntityData(sender, "GTAO_HAS_CHARACTER_DATA", true);
                        API.setEntityData(sender, "GTAO_SHAPE_MIX", 0.35);
                        API.setEntityData(sender, "GTAO_SKIN_MIX", 0.35);
                        API.setEntitySyncedData(sender, "GTAO_SHAPE_MIX", 0.35);
                        API.setEntitySyncedData(sender, "GTAO_SKIN_MIX", 0.35);
                        var skin = (int)PedHash.FreemodeMale01;
                        API.setEntityData(sender, "Skin", skin);
                    }
                    break;

                    case 1:
                    {
                        // API.triggerClientEvent(sender, "skin_type_gtaof");
                        Cams.interpolateCamera(sender, 1, 1000, false, false);
                        showCreatorMenu(sender);
                        API.setPlayerSkin(sender, PedHash.FreemodeFemale01);
                        API.call("GTAOnlineCharacter", "initializePedFace", sender.handle);
                        API.setEntitySyncedData(sender, "GTAO_HAS_CHARACTER_DATA", true);
                        API.setEntityData(sender, "GTAO_HAS_CHARACTER_DATA", true);
                        API.setEntityData(sender, "GTAO_SHAPE_MIX", 0.35);
                        API.setEntityData(sender, "GTAO_SKIN_MIX", 0.35);
                        API.setEntitySyncedData(sender, "GTAO_SHAPE_MIX", 0.65);
                        API.setEntitySyncedData(sender, "GTAO_SKIN_MIX", 0.65);
                        var skin = (int)PedHash.FreemodeFemale01;
                        API.setEntityData(sender, "Skin", skin);
                    }
                    break;

                    case 2:
                    {
                        // API.triggerClientEvent(sender, "skin_type_ped");
                        Cams.interpolateCamera(sender, 2, 1000, false, false);
                        showCreatorMenu(sender);
                        API.setPlayerSkin(sender, PedHash.Cow);
                        var skin = (int)PedHash.Cow;
                        API.setEntityData(sender, "Skin", skin);
                    }
                    break;

                    case 3:
                    {
                        API.triggerClientEvent(sender, "menu_handler_close_menu");
                        divergeCreator(sender);
                    }
                    break;
                    }
                }
                else if (callbackId == PED_OUTFIT)
                {
                    if (sender.model == (int)PedHash.FreemodeMale01)
                    {
                        setOutfit(sender, Males[ind]);
                        //  showPedMenu(sender);
                    }
                    if (sender.model == (int)PedHash.FreemodeFemale01)
                    {
                        setOutfit(sender, Females[ind]);
                        //    showPedMenu(sender);
                    }
                }
            }
            else if (eventName == "stopCreator")
            {
                API.sendNativeToPlayer(sender, Hash.DO_SCREEN_FADE_OUT, 200);
                API.triggerClientEvent(sender, "menu_handler_close_menu");
                // API.stopPlayerAnimation(sender);
                API.delay(800, true, () => {
                    Cams.clearCameras(sender);
                    sender.freeze(false);
                    var homeid = sender.getData("HomeID");
                    DimensionManager.DismissPrivateDimension(sender);
                    foreach (Homes.Home home in Homes.Homeslist)
                    {
                        if (homeid == home.ID)
                        {
                            home.teleportIn(sender, sender.getData("HomeDimension"));
                            API.triggerClientEvent(sender, "display_subtitle", "~r~F1 Player Menu ~g~F2 Vehicle Menu", 6000);
                        }
                    }
                    API.resetEntitySyncedData(sender, "LastStep");
                    API.sendNativeToPlayer(sender, Hash.DO_SCREEN_FADE_IN, 750);
                });
            }
        }