Hazzza
Hazzza
CC#
Created by Hazzza on 1/18/2025 in #help
✅ How to move an NPC locally only
Im just trying to make an npc move to a location only for the client player only. My code below doesnt work
print("running")
local NPC = PlayerNPCFolder:WaitForChild("Noob")
local humanoid = NPC:WaitForChild("Humanoid")
humanoid:MoveTo(Vector3.new(18, 28.375, 147))
humanoid.MoveToFinished:Wait()
print("running")
local NPC = PlayerNPCFolder:WaitForChild("Noob")
local humanoid = NPC:WaitForChild("Humanoid")
humanoid:MoveTo(Vector3.new(18, 28.375, 147))
humanoid.MoveToFinished:Wait()
The code does run, and the local script is places in starter player scripts
7 replies
CC#
Created by Hazzza on 12/3/2024 in #help
SQL gives Missing operator error
No description
14 replies
CC#
Created by Hazzza on 12/2/2024 in #help
SQL: Trying to obtain all rows that have a primary key inside a inputted table
The code works if the Recipe string replaces the ? in the string. However, as I want to prevent SQL injection the RecipeString isn't treated as SQL so the ' ' either side of each name in RecipeString isn't identified in the SQL string hence returning no values. Hopefully you understand the issue. If anyone has any ideas on how to fix this it would be greatly appriciated. Thanks Code:
C#
string _sSqlString = "SELECT * FROM IngredientRecipe WHERE ProductName IN (?)";

string RecipeString = "";

foreach(string name in Recipes.elements)
{
if(name != "")
{
RecipeString += $"'{name}',";
}
}
RecipeString = RecipeString.Remove(RecipeString.Length - 1);


string[] Parameters = new string[1];
Parameters[0] = RecipeString;

DataTable result = databaseUtils.ExecuteSqlQuery(_sSqlString, Parameters);
C#
string _sSqlString = "SELECT * FROM IngredientRecipe WHERE ProductName IN (?)";

string RecipeString = "";

foreach(string name in Recipes.elements)
{
if(name != "")
{
RecipeString += $"'{name}',";
}
}
RecipeString = RecipeString.Remove(RecipeString.Length - 1);


string[] Parameters = new string[1];
Parameters[0] = RecipeString;

DataTable result = databaseUtils.ExecuteSqlQuery(_sSqlString, Parameters);
Example Recipe String is:
'bread','pizza'
'bread','pizza'
8 replies
CC#
Created by Hazzza on 11/30/2024 in #help
Trying to detect when a checkbox is ticked/unticked in a datagridview checkbox column (WinForms)
Check Box Column Creation Code:
C#
DataGridViewCheckBoxColumn RestrictIngredientColumn = new DataGridViewCheckBoxColumn();
RestrictIngredientColumn.ValueType = typeof(bool);
RestrictIngredientColumn.Width = 50;
RestrictIngredientColumn.Name = "Restrict";
RestrictIngredientColumn.HeaderText = "Restrict";
dgvOptimiseIngredients.Columns.Add(RestrictIngredientColumn);
C#
DataGridViewCheckBoxColumn RestrictIngredientColumn = new DataGridViewCheckBoxColumn();
RestrictIngredientColumn.ValueType = typeof(bool);
RestrictIngredientColumn.Width = 50;
RestrictIngredientColumn.Name = "Restrict";
RestrictIngredientColumn.HeaderText = "Restrict";
dgvOptimiseIngredients.Columns.Add(RestrictIngredientColumn);
Checkbox Click Detection Code: (Column[1] is the column of checkboxes)
C#
private void dgvOptimiseIngredients_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == 1 && e.RowIndex != -1)
{
DataGridViewCell cell = dgvOptimiseIngredients[e.ColumnIndex, e.RowIndex];

MessageBox.Show((Convert.ToBoolean(cell.Value) == true).ToString());
}
}
C#
private void dgvOptimiseIngredients_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == 1 && e.RowIndex != -1)
{
DataGridViewCell cell = dgvOptimiseIngredients[e.ColumnIndex, e.RowIndex];

MessageBox.Show((Convert.ToBoolean(cell.Value) == true).ToString());
}
}
Showcase of output: https://gyazo.com/101659e8af97d91876baa8a6cf4d1834 Seems to return true/false very randomly anyone have any idea why this happens. Thanks
7 replies
CC#
Created by Hazzza on 8/27/2024 in #help
SQL help
No description
22 replies
CC#
Created by Hazzza on 8/23/2024 in #help
How do I detect if the mouse position is outside a panel and its children in WinForm
No description
8 replies
CC#
Created by Hazzza on 8/16/2023 in #help
❔ I can't run my C# code in VS code
I get the message 'The .NET Core SDK cannot be located. A valid dotnet installation could not be found. .NET Core debugging will not be enabled. Make sure .NET Core SDK is installed and is on the path
37 replies