[WIP] Freemode-Remix

Do I need to do something more than just dropping my assassination2.cs into the missions folder to get the resource to acknowledge it? I only altered assassination.cs to create another mission file naming it assassination2.cs and tried to add the menu entry.

Hi there Scammer,

I figured out how to add the file to Missions but when I tried to build it, I introduced a bunch of new errors:

[quote]|Severity|Code|Description|Project|File|Line|Suppression State|
|—|---|—|---|—|---|—|
|Error|CS0101|The namespace ‘Freeroam.Missions’ already contains a definition for ‘Target’|Freeroam|D:\fivem\gta5-fivem\server-data\resources\freemode-remix\Freeroam\Freeroam\Missions\Assassination2.cs|10|Active|
|Error|CS0111|Type ‘Target’ already defines a member called ‘.ctor’ with the same parameter types|Freeroam|D:\fivem\gta5-fivem\server-data\resources\freemode-remix\Freeroam\Freeroam\Missions\Assassination2.cs|15|Active|
|Error|CS0229|Ambiguity between ‘Target.targetPed’ and ‘Target.targetPed’|Freeroam|D:\fivem\gta5-fivem\server-data\resources\freemode-remix\Freeroam\Freeroam\Missions\Assassination.cs|17|Active|
|Error|CS0229|Ambiguity between ‘Target.bodyguards’ and ‘Target.bodyguards’|Freeroam|D:\fivem\gta5-fivem\server-data\resources\freemode-remix\Freeroam\Freeroam\Missions\Assassination.cs|18|Active|
|Error|CS0121|The call is ambiguous between the following methods or properties: ‘Target.Target(Ped, Ped[])’ and ‘Target.Target(Ped, Ped[])’|Freeroam|D:\fivem\gta5-fivem\server-data\resources\freemode-remix\Freeroam\Freeroam\Missions\Assassination.cs|54|Active|
|Error|CS0229|Ambiguity between ‘Target.targetPed’ and ‘Target.targetPed’|Freeroam|D:\fivem\gta5-fivem\server-data\resources\freemode-remix\Freeroam\Freeroam\Missions\Assassination.cs|100|Active|
|Error|CS0229|Ambiguity between ‘Target.targetPed’ and ‘Target.targetPed’|Freeroam|D:\fivem\gta5-fivem\server-data\resources\freemode-remix\Freeroam\Freeroam\Missions\Assassination.cs|105|Active|
|Error|CS0229|Ambiguity between ‘Target.targetPed’ and ‘Target.targetPed’|Freeroam|D:\fivem\gta5-fivem\server-data\resources\freemode-remix\Freeroam\Freeroam\Missions\Assassination.cs|159|Active|
|Error|CS0229|Ambiguity between ‘Target.targetPed’ and ‘Target.targetPed’|Freeroam|D:\fivem\gta5-fivem\server-data\resources\freemode-remix\Freeroam\Freeroam\Missions\Assassination.cs|160|Active|
|Error|CS1579|foreach statement cannot operate on variables of type ‘Target.bodyguards’ because ‘Target.bodyguards’ does not contain a public instance definition for ‘GetEnumerator’|Freeroam|D:\fivem\gta5-fivem\server-data\resources\freemode-remix\Freeroam\Freeroam\Missions\Assassination.cs|161|Active|
|Error|CS0229|Ambiguity between ‘Target.bodyguards’ and ‘Target.bodyguards’|Freeroam|D:\fivem\gta5-fivem\server-data\resources\freemode-remix\Freeroam\Freeroam\Missions\Assassination.cs|161|Active|
|Error|CS0229|Ambiguity between ‘Target.targetPed’ and ‘Target.targetPed’|Freeroam|D:\fivem\gta5-fivem\server-data\resources\freemode-remix\Freeroam\Freeroam\Missions\Assassination2.cs|17|Active|
|Error|CS0229|Ambiguity between ‘Target.bodyguards’ and ‘Target.bodyguards’|Freeroam|D:\fivem\gta5-fivem\server-data\resources\freemode-remix\Freeroam\Freeroam\Missions\Assassination2.cs|18|Active|
|Error|CS0121|The call is ambiguous between the following methods or properties: ‘Target.Target(Ped, Ped[])’ and ‘Target.Target(Ped, Ped[])’|Freeroam|D:\fivem\gta5-fivem\server-data\resources\freemode-remix\Freeroam\Freeroam\Missions\Assassination2.cs|49|Active|
|Error|CS0229|Ambiguity between ‘Target.targetPed’ and ‘Target.targetPed’|Freeroam|D:\fivem\gta5-fivem\server-data\resources\freemode-remix\Freeroam\Freeroam\Missions\Assassination2.cs|95|Active|
|Error|CS0229|Ambiguity between ‘Target.targetPed’ and ‘Target.targetPed’|Freeroam|D:\fivem\gta5-fivem\server-data\resources\freemode-remix\Freeroam\Freeroam\Missions\Assassination2.cs|100|Active|
|Error|CS0229|Ambiguity between ‘Target.targetPed’ and ‘Target.targetPed’|Freeroam|D:\fivem\gta5-fivem\server-data\resources\freemode-remix\Freeroam\Freeroam\Missions\Assassination2.cs|154|Active|
|Error|CS0229|Ambiguity between ‘Target.targetPed’ and ‘Target.targetPed’|Freeroam|D:\fivem\gta5-fivem\server-data\resources\freemode-remix\Freeroam\Freeroam\Missions\Assassination2.cs|155|Active|
|Error|CS1579|foreach statement cannot operate on variables of type ‘Target.bodyguards’ because ‘Target.bodyguards’ does not contain a public instance definition for ‘GetEnumerator’|Freeroam|D:\fivem\gta5-fivem\server-data\resources\freemode-remix\Freeroam\Freeroam\Missions\Assassination2.cs|156|Active|
|Error|CS0229|Ambiguity between ‘Target.bodyguards’ and ‘Target.bodyguards’|Freeroam|D:\fivem\gta5-fivem\server-data\resources\freemode-remix\Freeroam\Freeroam\Missions\Assassination2.cs|156|Active|
[/quote]

Which makes me think that I either rename those elements in Assassination2 or I am going about this completely incorrectly.

Here’s the two files being used in the build:

Assasination.cs
Assassination2.cs

I’ll continue playing around with it but could you tell me what I need to do differently? It seems like my trouble might be that I’m redeclaring elements by duplicating that file.

I managed to solve all of the errors by renaming Target to Target2 and making some small related changes.

I started and successfully completed the mission and it looks like everything worked great. I can’t thank you enough for all the help you provided. I imagine my friends and I will use this more than anything else in the game to have some GTAO-like fun.

Are there or will there be additional modes of mission? Grab a car and deliver it, capture a spot, etc? Steal and deliver some illicit product, etc?

Will there be the ability to share the missions with your friends? Currently and understandably so, someone doing a mission locks everyone else out from doing one but it would be cool if I could help someone and share the progress reports of a mission.

I’ll begin working on some additional missions right away, somewhat mimicing the “gangland” missions found in retail.

Thank you again for a great resource. My friends and I really appreciate it!

No problem!

Yeah I’ll eventually extend the mission pool and also add stuff like organizations and random events which would allow for even more missions.

1 Like

One quick question:

Can I change the target to want to stay and fight instead of run? I found this line of code:

 Ped targetPed = await Util.CreatePed(PedHash.Business01AMY, targetSpawns[i]);

And it looks like the magic might be contained in Business01AMY but I’m having problems finding documentation concerning this method of pednaming. I use this page to find peds and their hashes/names: https://wiki.rage.mp/index.php?title=Peds

but am not sure how to carry this over. As an example, I’d like to pick the type of characterer( perhaps some FIB characters, like this guy: s_m_m_fibsec_01 ) and then have the target stay and fight with the bodyguards so you’re not running from the fight area as soon as it starts trying to chase down the target.

Is this possible? I’ve found some discussion concerning the ambiance and how the letters precipitating the model name can dictate how they behave but can not figure out how to make it work.

Thanks for your time!

Giving a ped a gun will very likely make them fight.

Also if you want to make them fight without a gun, see how my old zombie script does it.

Two questions:

  1. How would I give a weapon to my target? Does it require additional code or would I simply alter the line
Ped targetPed = await Util.CreatePed(PedHash.Business01AMY, targetSpawns[i]);
  1. How to modify the models for the target? I can’t find a list in either the wiki or forum that contains: Business01AMY . I see this in the rage list: a_m_m_business_01, which seems convertible to the format used in your code but I don’t understand if I can turn everything into your format, for instance, would

s_m_y_prismuscl_01

successfully translate to:

Prisonmuscl01SMY

?

I may have answered my first question by looking at bodyguard:

Ped targetPed = await Util.CreatePed(PedHash.Business01AMY, targetSpawns[i]);
                targetPed.Weapons.Give(WeaponHash.CarbineRifle, int.MaxValue, true, true);

If that looks correct to you, that leaves me just wondering if there’s a list of player models that I can use in the format of:

Business01AMY

The wiki has vehicle and weapon lists but no ped list I can find shows models in that naming convention.

Hi there Scammer, and thanks very much for the link. It opened up a bunch of possibilities to understand I can scour the source code for stuff that I need.

Trying some missions have me wondering, would it be possible to set the player as unwanted during the mission time period? So they dont’ end up with a bunch of unintended aggressors while completing a larger mission?

I’ve looked through your resource and I see where you reward a player for losing a wanted level but I didn’t see anywhere that I could force it to remain unwanted during the mission, then remove that at the end of the mission.

Thanks for your time!

Just keep setting the player’s wanted level to 0 on tick. That should do it.

I see where you determine someones wanted level in the resource but I don’t see how you set it. What code would set it to 0?

and secondly, would that be placed in here in Mission.cs?

 public Mission()
        {
            EventHandlers[Events.MISSION_START] += new Action<string>(StartMission);
            EventHandlers[Events.MISSION_STOP] += new Action<bool>(StopMission);

            EventHandlers[Events.MISSION_RUNNING] += new Action<int, bool>(ClientStartedMission);

            Tick += OnTick;
        }

I found this in the wiki:

SetPlayerWantedLevel(PlayerId(), 0, false)
SetPlayerWantedLevelNow(PlayerId(), false)

Would this be what I use? How do I populate the playerid in the string? Is there a global variable for it?

I think I’m getting closer but I must be implementing it correctly. I found this inside the missioncode:

 if (killer == playerPed)
                                {
                                    if (Game.Player.WantedLevel < 3) Game.Player.WantedLevel = 3;
                                }

                                DespawnTargetSquad(targets[i]);
                                targets[i] = null;

so I commented if (Game.Player.WantedLevel < 3) Game.Player.WantedLevel = 3; and took it and tried to place it above changing it to work with 0:

        public async Task Tick()
        {
            if (enableTick)
            {
                Ped playerPed = Game.PlayerPed;
                if (Game.Player.WantedLevel < 0) Game.Player.WantedLevel = 0;
                if (playerPed.IsDead)
                {
                    BaseScript.TriggerEvent(Events.MISSION_STOP, false);
                    enableTick = false;
                }
                else
                {

Am I using the line incorrectly, or did I perhaps place it at the wrong spot?

Haha, that little arrow causes me so much grief. Fixed it with:

Great to hear it worked out for you!

1 Like

Hi there Scammer, I have another question but I understand if this is outside the scope of your support. Just let me know.

My friends and I use ESX because we like to be able to buy cars, store in garages, use the clothes, barbers, etc. It uses a bank and money system that pays for these things. I was wondering what I would need to do to get your system to pay into that pool of money. Would this be something that would require huge changes or would it be relatively simple to change the triggerevent MONEY_ADD to do this?

As it stands currently, we have two separate money totals, one of which we can’t use. We would love to be able to pay it into the pool of money that we can.

Again, I’m sorry if this is not a proper support question.

Assuming ESX uses events for allowing other resources to add money (I don’t know), you’d just have to change it to trigger that event on the end of a mission / after a bonus instead. Though the money and level display of this resource would still remain.

Hi there Scammer,

I didn’t get a lot of help in the other resource threads but I did find the ESX method of adding money to the player’s account in a wiki:

and I found that class in the resource /server/classes/player.lua .

So I’d like to try it in the freeroam code but when I tried adding it to the code:

                BaseScript.TriggerEvent(Events.MONEY_ADD, 10000);
                xPlayer.addBank(10000);

I received the error that The name ‘xPlayer’ does not exist in the current context

I did some searching and it seems that I need to declare the class. Do you happen to know (or have a guess) How I would declare it so I could use this ESX function in the freeroam code? I tried:

        public Ped targetPed;
        public Ped[] bodyguards;
        public xPLayer;

But it added more errors:

Thanks for your time!

Hi there Scammer,

Someone helped me with how to enable player payment through ESX. They state

Client side:



    ESX = nil

    Citizen.CreateThread(function()
    while ESX == nil do
    TriggerEvent(‘esx:getSharedObject’, function(obj) ESX = obj end)
    Citizen.Wait(0)
    end
    end)

Server side:

ESX = nil

TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)

Then at the payment command,

xPlayer.addMoney(vehPrice)

I’m not sure how to do this in the mission code, however. Do you happen to know how I would do these two things for the mission payments?