• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

Code [HELP]Weapon Spawns for Specific Players

mmmm you'd need a new type of weapon class..... one that does this:

player touches->checks toucher.controller.playername(not sure about checking steam id)->?playername=somelist.personsname: give toucher item: else ignore

but sense it would require a new weapon class you'd have to have all weapons be of that class type.......... a lot of work.....
 
Upvote 0
You have to make new perk class with a code like:
Code:
var config array<string> GivenIDs;

static function AddDefaultInventory(KFPlayerReplicationInfo KFPRI, Pawn P)
{
    local string S;
    local int i;

    S = P.PlayerReplicationInfo.PlayerName; // OR: S = PlayerController(P.Controller).GetPlayerIDHash();
    for( i=0; i<Default.GivenIDs.Length; ++i )
        if( Default.GivenIDs[i]~=S )
        {
            KFHumanPawn(P).CreateInventoryVeterancy("KFMod.Bullpup", GetCostScaling(KFPRI, class'BullpupPickup'));
            break;
        }
}
if you use PlayerName it will use display name of players, if you use IDHash, it is an encrypted version of SteamID (you should see the player ID hashes from ServerPerksStat.ini).
 
  • Like
Reactions: YoYoBatty
Upvote 0
You have to make new perk class with a code like:
Code:
var config array<string> GivenIDs;

static function AddDefaultInventory(KFPlayerReplicationInfo KFPRI, Pawn P)
{
    local string S;
    local int i;

    S = P.PlayerReplicationInfo.PlayerName; // OR: S = PlayerController(P.Controller).GetPlayerIDHash();
    for( i=0; i<Default.GivenIDs.Length; ++i )
        if( Default.GivenIDs[i]~=S )
        {
            KFHumanPawn(P).CreateInventoryVeterancy("KFMod.Bullpup", GetCostScaling(KFPRI, class'BullpupPickup'));
            break;
        }
}
if you use PlayerName it will use display name of players, if you use IDHash, it is an encrypted version of SteamID (you should see the player ID hashes from ServerPerksStat.ini).

Thanks for the help Falidell and Marco!! :D
I'll try to get it working
 
Last edited:
Upvote 0
Just to confirm, if i want to add it in to the existing perks i just copy and paste the code below into the bottom of the Perk Source code then recompile?

var config array<string> GivenIDs;STEAMIDHASHHERE

static function AddDefaultInventory(KFPlayerReplicationInfo KFPRI, Pawn P)
{
local string S;
local int i;

S = PlayerController(P.Controller).GetPlayerIDHash();
for( i=0; i<Default.GivenIDs.Length; ++i )
if( Default.GivenIDs~=S )
{
KFHumanPawn(P).CreateInventoryVeterancy("DESIREDWEAPONCLASSHERE", GetCostScaling(KFPRI, class'WEAPONPICKUPHERE'));
break;
}
}

[EDIT] I think i confused myself. ANyways, i suppose i have to create a new .uc file and paste this in?
But what Class does it extend?
 
Last edited:
Upvote 0