Skip to content
View in the app

A better way to browse. Learn more.

LCPDFR.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

(RPH) Give LocalPlayer weapon

Featured Replies

Hello, I know that I'm supposed to put this stuff on the RPH Forums but for some reason, I can't make an account.

I need help with giving the LocalPlayer a weapon

 

I know how to give a ped a weapon, but do I need to make the LocalPlayer into a ped and how would I do that

There is no Game.LocalPlayer.Character.GiveWeapon or anything like that so IDK how to

This is in C# btw.

You need to use PedInventory.GiveNewWeapon().

 

For example: 

Game.LocalPlayer.Character.Inventory.GiveNewWeapon(WeaponHash.AssaultRifle, -1, true);

// GiveNewWeapon(weapon, ammoCount, equipNow)
// weapon: the WeaponHash/WeaponAsset/WeaponDescriptor that indicates which weapon give to the player, e.g. WeaponHash.AssaultRifle
// ammoCount: the value that indicates the amount of ammo that the player will receive, if "-1" it gives infinite ammo
// equipNow: indicates whether the player will equip the weapon right after he receives the weapon

 

  • Author
2 minutes ago, alexguirre said:

You need to use PedInventory.GiveNewWeapon().

 

For example: 


Game.LocalPlayer.Character.Inventory.GiveNewWeapon(WeaponHash.AssaultRifle, -1, true);

// GiveNewWeapon(weapon, ammoCount, equipNow)
// weapon: the WeaponHash/WeaponAsset/WeaponDescriptor that indicates which weapon give to the player, e.g. WeaponHash.AssaultRifle
// ammoCount: the value that indicates the amount of ammo that the player will receive, if "-1" it gives infinite ammo
// equipNow: indicates whether the player will equip the weapon right after he receives the weapon

 

 

Thanks, didn't know you had to put it in the inventory of the Character.

Something that I do is make a new bookmarks folder and whenever I find something that may help me in coding I book mark it. For example RPH Docs or LSPDFR forums which maybe be beneficial in a certain mod. 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.