Hey, i dont want to any admin menu in my server so i want to use f8 console to give weapons. But i cant find the give weapon command. I find car command usind car zentorno etc. But no luck on weapons. What is the f8 console command for giving weapons? And are there any other useful f8 commands?
There is no Give Weapon Command. You can create one though using the normal RegisterCommand() native though.
example:
RegisterCommand("giveweapon", function(source, args)
-- Give weapon thingys in here.
end)
Then if you type "giveweapon"
in the Client Console its gonna execute whats inside the RegisterCommand()
function
Where i will need to add? And there is any other useful commands like this?
You add this to a client script.
There is no commands like giveweapon from the beginning unless its been added by someone.
Sory about my noobie but what is the client script? Is it new lua? Or adding somewhere
You create a resource inside your resource folder. Call it “giveweapon”
inside the resource create 2 files.
Name one "__resource.lua"
Name the other one "client.lua"
Inside the __resource.lua type this in:
resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937'
client_script "client.lua"
Inside the client.lua add this:
RegisterCommand("giveweapon", function(source, args)
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_PISTOL"), 999, false, false)
end)
Then go to your server.cfg and add “start giveweapon”
Then it should give you a Pistol when you type “giveweapon” in F8 Console.
Can i add assault rifle with this “WEAPON_PİSTOL”, “WEAPON_ASSAULTRIFLE”
Or need to open a new paragraph?
You can replace "WEAPON_PISTOL"
to whatever weapon. It doesnt matter
Wait, Disregard my last.
Inside the weaponstoadd
table add your weapons you want to be added.
Add this inside the client.lua:
local weaponstoadd = {
"WEAPON_PISTOL",
"WEAPON_ASSAULTRIFLE",
}
RegisterCommand("giveweapon", function(source, args)
for _, weapons in pairs(weaponstoadd) do
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey(weapons), 999, false, false)
end
end)
Am i need to add any otger weapons before weaponstoadd right? If right thank you so much
Yes, Just add whatever weapon you want the player to get when they type "giveweapon"
I want to do it to because vmenu wont work and what resource folder Is it?
You will need to make your own resource folder. See the above instruction how do it by @BigYoda. The only thing that has changed is that __resource.lua should now be named fxmanifest.lua.
Here is a guide to start scripting: Introduction to resources - Cfx.re Docs