Basic Aces & Principals overview/guide

@Briglair
So, heres the code:

using CitizenFX.Core;
using static CitizenFX.Core.Native.API;

namespace NoFormatName
{
    public class Class1
    {
        private void HasCon()
        {
            rescan:;
            Wait(300000);
            ExecuteCommand("say Test...");
            PlayerList players = new PlayerList();
            foreach (Player player in players)
            {
                if (player.Name.Contains("^") || player.Name.Contains("~"))
                {
                    int pID = player.ServerId;

                    try
                    {
                        ExecuteCommand("clientkick " + pID + " Dein Name darf keine Formatierungs-Codes enthalten!");
                        ExecuteCommand("say Der Spieler (ID: " + pID + ") wurde gekickt!");
                    }
                    catch
                    {
                        ExecuteCommand("say Der Spieler (ID: " + pID + ") konnte nicht vom Server geworfen werden!");
                    }
                    goto rescan;
                }
                goto rescan;
            }
        }
    }
}

Did i forget something or made a mistake? I couldnt find a mistake.

Well, your code will wait 300000 ms (~83 minutes) before running anything below that Wait. Move the ExecuteCommand before that in order for it to actually be ran.

In addition, do you have any other script calling this method? If that is the only C# code you have, that is not setup properly.

@Briglair
lol. I have to check that time again. Actually i wanted it to be 5 minutes… lol.
Thank you :wink:

Im an idiot. That is 5 min. You should also reference this when setting up a C# environment http://docs.fivem.net/scripting-manual/runtimes/csharp/

@Briglair ye, i just calculated it again, i still got 300000ms. But why doesnt the script run then? Do i need to tell it, that it needs to run the void HasCon();?

Yep… I’m just an idiot and did 300000/60/60 instead of /1000/60…

Anyway… Look at this instead [How-to] Setting up C# and creating a basic resource It provides a bit more info. You need to derive from BaseScript in order for FiveM to run your stuff.

1 Like

Maybe something wrong in my __resource.lua file?

resource_manifest_version '05cfa83c-a124-4cfa-a768-c24a5811d8f9'

name 'NoFormatName'
description 'Kicks players having formating-codes in their names.'
author 'Agiger03'
version 'v1.0'

files {

}

client_scripts {

}

server_scripts {
    'NoFormatName.dll',
}

@Briglair
maybe @Vespura can help…

1 Like

This is no longer related to aces/permissions is it?

2 Likes

@Vespura nah, actually it isnt.

Then please make a new topic for it so we can keep this related to aces :wink:

@Vespura i did: Help with script (C#)

Hey i need help badly so i made a script that attaches a flashlight to a pistol if u have it and it worked without perms when i tried to add perms it didnt work here are all my things:-
CLIENT.LUA

RegisterNetEvent("Police:GiveFlash")
AddEventHandler("Police:GiveFlash", function()
    if HasPedGotWeapon(PlayerPedId(), "weapon_pistol", 0) then
        GiveWeaponComponentToPed(PlayerPedId(), "weapon_pistol", "COMPONENT_AT_PI_FLASH")
    end
end)

SERVER.LUA

RegisterCommand("flash", function(source, args, rawCommand)
    if IsPlayerAceAllowed(source, "police.flash") then
        TriggerClientEvent("Police:GiveFlash", source)
    end
end, false)

RESOURCE

resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937'

client_script "client.lua"

server_script "server.lua"

PERMS.CFG

add_principal police police.flash

add_principal identifier.steam:1100001152b4999 police.flash allow
2 Likes

Here you’re adding group police to group police.flash… why?

You almost did it right here, that should be add_ace, not add_principal.

1 Like

so for the police police.flash how do i change it to the correct thing?
and what is it to

1 Like

and also is that the only wrong thing in it?!

1 Like

It looks like it yeah. Just remove that top one completely as it does absolutely nothing. Just use the bottom one with your steam and then change it to add_ace instead. That should work.

Yea im gonna need help is there any video tutorials
because im trying to geth this to work with Yodas aop

Vespura if you can help me reach me on discord please
Xavier#2138

Nope there’s no video tutorials, you can create a topic in #development:scripts, share some code there and ask specific questions about it there.

never mind i found some help but thanks anyways