Post: [RELEASE]GivePlayerWeapon for 1.09
03-07-2014, 03:25 AM #1
Absolute Zero
Do your homework, fool.
(adsbygoogle = window.adsbygoogle || []).push({});
Give Player Weapon for Ghosts 1.09

Info:

Hey guys, just thought I would throw this out to whoever doesn't have it, pretty simple to update for 1.09. All you need to use this is PS3Lib and Choco's RPC (If you have different RPC you can edit it for that RPC). So yeah, here's the code below.

What Does This Do?

This allows you to give yourself (or another client) a gun in game, can be very useful when making client mods and mod menus. With this you can give yourself the walking Loki and other fun weapons.

How to Use:

Firstly, insert this somewhere in your coding:

     public static class Conversions
{
public static uint PlayerState = 0xF43B00;
public static byte[] ReverseBytes(byte[] input)
{
Array.Reverse(input);
return input;
}
}


That is for g_client. Next, add this:

    public static void SV_GameSendServerCommand(int Client, string Command)
{
RPC.Call(0x53D984, new object[]
{
Client,
0,
Command
});
}


That is the SV_GameSendServerCommand function for RPC. Lastly, add this:

    private void GiveWeapon(int client, int weapon, int ammo, int akimbo)
{
RPC.Call(0x290504, (uint)(Conversions.PlayerState + (client * 0x3700)), weapon, akimbo);
RPC.Call(0x244E84, (uint)(Conversions.PlayerState + (client * 0x3700)), weapon, 0, ammo, 1);
RPC.Call(0x53D984, client, 0, "a \"" + weapon + "\"");
}

That is the actual function that can give weapons in game. You use this by typing this into a button, checkbox, etc. Whatever you want to put it in:

    
GiveWeapon(0, (weapon id here), 999, 0);


Breakdown:
The 0 is the client number, so change it according to what client you want to use it for. The second part is where you put the weapon index number. There are threads with weapon ids all over NGU. For example though, 135 is the Maverick, 136 is the Ripper, and 137 is the Maverick A2. The third part where 999 is is the ammo. 999 is full ammo for the weapon, but you can mess with it as you so please. And finally, the 0 at the end represents akimbo. To set akimbo, simply set the 0 to a 1, or keep it at 0 for no akimbo.

Wrap Up:
That's basically it guys, hope this helps you develop bigger and better things and helps you learn. This is the way I do it, so please do not hate if there is an easier way. It works regardless, that is the point. Well, enjoy!

~Zero~

And because Christian requested, credits to him for giving me the AddAmmo address because I couldn't find it anywhere :/
(adsbygoogle = window.adsbygoogle || []).push({});

The following 6 users say thank you to Absolute Zero for this useful post:

Eddie Mac, K-9MEMBER, MaNamesTyler, Mango_Knife, Notorious, RatchetBooty
03-07-2014, 03:33 PM #11
INSAN3LY_D34TH
INSAN3LY GAMING
Originally posted by ZeroNGU View Post
Give Player Weapon for Ghosts 1.09

Info:

Hey guys, just thought I would throw this out to whoever doesn't have it, pretty simple to update for 1.09. All you need to use this is PS3Lib and Choco's RPC (If you have different RPC you can edit it for that RPC). So yeah, here's the code below.

What Does This Do?

This allows you to give yourself (or another client) a gun in game, can be very useful when making client mods and mod menus. With this you can give yourself the walking Loki and other fun weapons.

How to Use:

Firstly, insert this somewhere in your coding:

     public static class Conversions
{
public static uint PlayerState = 0xF43B00;
public static byte[] ReverseBytes(byte[] input)
{
Array.Reverse(input);
return input;
}
}


That is for g_client. Next, add this:

    public static void SV_GameSendServerCommand(int Client, string Command)
{
RPC.Call(0x53D984, new object[]
{
Client,
0,
Command
});
}


That is the SV_GameSendServerCommand function for RPC. Lastly, add this:

    private void GiveWeapon(int client, int weapon, int ammo, int akimbo)
{
RPC.Call(0x290504, (uint)(Conversions.PlayerState + (client * 0x3700)), weapon, akimbo);
RPC.Call(0x244E84, (uint)(Conversions.PlayerState + (client * 0x3700)), weapon, 0, ammo, 1);
RPC.Call(0x53D984, client, 0, "a \"" + weapon + "\"");
}

That is the actual function that can give weapons in game. You use this by typing this into a button, checkbox, etc. Whatever you want to put it in:

    
GiveWeapon(0, (weapon id here), 999, 0);


Breakdown:
The 0 is the client number, so change it according to what client you want to use it for. The second part is where you put the weapon index number. There are threads with weapon ids all over NGU. For example though, 135 is the Maverick, 136 is the Ripper, and 137 is the Maverick A2. The third part where 999 is is the ammo. 999 is full ammo for the weapon, but you can mess with it as you so please. And finally, the 0 at the end represents akimbo. To set akimbo, simply set the 0 to a 1, or keep it at 0 for no akimbo.

Wrap Up:
That's basically it guys, hope this helps you develop bigger and better things and helps you learn. This is the way I do it, so please do not hate if there is an easier way. It works regardless, that is the point. Well, enjoy!

~Zero~


I think you forgot me in credits lol :P

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo