Using givecar preset with the mycar permission onlySuggestion
hello, 
i would like to give the possibility to my players to spawn a "speed car" (3 motors on a 4 slot chassis) directly when spawning on my server.
but i don't want to give them the /givecar permission, 
it could be nice to have the possibility to add a default preset available for players with actual restrictions (only 1 car at a time)
Yeah, this is something I was thinking about when I started this plugin. I opted for implementing player-defined presets initially since I estimated it would be the most common usage. It makes sense that you would want to define common presets so that players don't have to build them out first.

How I'm currently thinking of doing this is to add admin commands to save an admin's car as a server-wide preset, which people can see with mycar list (or possibly a different command) and spawn with mycar <preset>. These presets will be limited to just the name and the modules, without the other options such as locks/fuel/water since those will be determined by the player permissions.
thanks for your fast reply !

Yes it seems to be a good way to do it.
preset directly available in /mycar list is good too.
it can be nice too  if the player , after spawned the server wide preset car, can save the model on his own list, to have the possibility to edit it easily, and/or add lock/fuel/water options too after that :)
Yes, once the player spawns a car from a server preset, they would be able to save it under a personal preset if desired, including as their default preset.

and/or add lock/fuel/water options too after that :)

That part is harder to get right without an explicit configuration file. For the foreseeable future, I plan on keeping these as player-specific settings rather than player-preset-specific settings as I think it's probably easier for players to understand.

Merged post

Also, I'm thinking of only showing the server presets to a player if they have permission to spawn a car of the length the preset requires. So if you defined a 4-length server preset, but the player is only allowed to spawn 3-length cars, the 4-length preset would not be included in the list they see, nor would they be able to spawn it.

Another thing I'm thinking is, since I'd like to keep the convenience of spawning server presets with just mycar <preset>, it means there can be conflicts between server and player preset names. I'm thinking of giving the player-defined preset precedence in that case when spawning or loading. If the player wants to spawn the server preset when there is a conflict, they would have to rename their current preset temporarily, or use a workaround like providing a * prefix in the name.
yes, seems good :)

Merged post

and what about create a pre-filled player preset file when a player use /mycar ?

1 - admin create 3 or 4 presets, preset1, preset2 ......
2 - player connect, and use /mycar preset1
3 - plugin create pre-filled preset player file, and spawn preset1 car defined by admin.
4 - player can still save his cars like usual on his preset player file.
5 - if player erase admin preset by saving his modified car with same name, not my problem :D
6 - or maybe an option to restore player preset file with the pre-filled preset file if he messed up. ^^
That's an interesting idea I hadn't thought of. So basically each player gets a default list of presets when they first use /mycar. They can customize the presets after that as much as they want and make new ones. Then, if they want, they can also reset their preset list to the current list of default presets and start over. That should be possible, and it could be a separate feature from the common presets idea as well.

I already did most of the work last night to implement common presets. I will spend some time tonight testing it and probably make a release. Here's what it looks like currently:

Players with permission to use common presets can do:
  • mycar common list
  • mycar common <name>
  • mycar common load <name> (also requires the load permission)
Players with permission to manage common presets can do:
  • mycar common save <name>
  • mycar common update <name>
  • mycar common rename <name> <new name>
  • mycar common delete <name>
Once the player spawns a car from a common preset, if they have the permission to use personal presets, then they can save that car as their own preset if desired. It should be possible to allow players to use common presets only, without allowing them to have personal presets. The player would still require the spawn.2-4 permissions to do this, so the plugin can determine which preset length they are allowed to have, meaning there still won't be a way to prevent players from spawning random cars (not sure why anyone would want that but someone asked for it).
all this seems cool too. i'll try asap.

Merged post

Where do i add the common preset ?
in the cfg files ? in the data files ?
with wich code ?

Merged post

ok, i found. 
so common presets are on
data/SpawnModulCar.json

and players presets are on
data/SpawnModularCar/<Steam ID>.json

:)

Merged post

i had issue to copy a car i didnt spawn myself. it can be nice to be able to copy any cars, even if it's not our car
"oh, you got a nice car, i want the same. ^^ "

but except that, everythings seems to works good.
I just have a small doubt on the chat code to enter just to spawn a common preset. it's quite long to write /mycar common preset1
and it's probably the 1st code new players will enter. but it's just a details.
Thanks for the nice work !

i had issue to copy a car i didnt spawn myself. it can be nice to be able to copy any cars, even if it's not our car

I can probably add a command to save the car you are looking at.

I just have a small doubt on the chat code to enter just to spawn a common preset. it's quite long to write /mycar common preset1 and it's probably the 1st code new players will enter

Yeah, I wasn't excited about this, but it seemed easier and cleaner to implement the separate subcommand and it avoided some issues. I might try to make a shorter version later. Open to ideas. For now, you can try using the command aliases plugin to make aliases for your server.
5f1792699e67b.jpg WhiteThunder
Open to ideas. For now, you can try using the command aliases plugin to make aliases for your server.

oh yes , very good idea !thanks !

is it possible to implement a cooldown for the /givecar function? 

I am using this command in a specific group of players, but they are able to spawn unlimited vehicles. 

codepimp1234

is it possible to implement a cooldown for the /givecar function? 

I am using this command in a specific group of players, but they are able to spawn unlimited vehicles. 

The givecar command is designed for admins, not for players. Why are you granting that permission to players? Also, I think this isn't what this topic was originally about, so I suggest creating a new topic.