Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VehicleModelType as command parameter #416

Closed
LDami opened this issue Jul 5, 2022 · 4 comments
Closed

VehicleModelType as command parameter #416

LDami opened this issue Jul 5, 2022 · 4 comments

Comments

@LDami
Copy link
Contributor

LDami commented Jul 5, 2022

With the following code, /v tug does not work (Usage message displayed), but /v Tug works.

[Command("vehicle", "veh", "v", DisplayName = "v")]
private static void SpawnVehicleCommand(Player player, VehicleModelType model)
{
 // Spawn vehicle
}

This might be caused by 2 entries in the enum starting with same name: Tug and TugStairsTrailer.

https://github.com/ikkentim/SampSharp/blob/master/src/SampSharp.GameMode/SAMP/Commands/ParameterTypes/EnumType.cs#L59

@VillainOP2393
Copy link

if(sscanf(params, "s[20]I(-1)I(-1)", model, color1, color2))
{
return SCM(playerid, COLOR_SYNTAX, "Usage: /veh [modelid/name] [color1 (optional)] [color2 (optional)]");
}

@CiprianN23
Copy link
Contributor

if(sscanf(params, "s[20]I(-1)I(-1)", model, color1, color2))
{
return SCM(playerid, COLOR_SYNTAX, "Usage: /veh [modelid/name] [color1 (optional)] [color2 (optional)]");
}

Hi

Your code snippet is from pawn, it is not relevant in the context of SampSharp and C# and also is not working in this context

@ikkentim
Copy link
Owner

ikkentim commented Sep 19, 2022

I tested this with this command, but it works fine for me:

[Command("vehicle", "veh", "v", DisplayName = "v")]
private static void SpawnVehicleCommand(Player player, VehicleModelType model)
{
    // Spawn vehicle
    var vehicle = Vehicle.Create(model, player.Position, 0, 0, 0);
    player.PutInVehicle(vehicle);
}

Could you provide a repro case?

@LDami
Copy link
Contributor Author

LDami commented Oct 17, 2023

Fixed in 0.10

@LDami LDami closed this as completed Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants