AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   [INC] Dino D-Day Stocks (https://forums.alliedmods.net/showthread.php?t=164304)

McFlurry 08-09-2011 21:48

[INC] Dino D-Day Stocks
 
3 Attachment(s)
Well I've spent some time and collected data from Dino D-Day and have come up with a ddd_stocks.inc file similar to tf2_stocks.inc

Here it is. There might be a few weapon id's I've missed, but these were all I could aquire. So all the unknown's in the list might be unused.
PHP Code:

#if defined _ddd_stocks_included
 #endinput
#endif
#define _ddd_stocks_included

// Weapon codes as used in events, such as player_death
enum {
    
DDD_WEAPON_MP40 1,
    
DDD_WEAPON_THOMPSON,
    
DDD_WEAPON_SHOTGUN,
    
DDD_WEAPON_UNKNOWN1,
    
DDD_WEAPON_COLT45,
    
DDD_WEAPON_UNKNOWN2,
    
DDD_WEAPON_TRENCHKNIFE,
    
DDD_WEAPON_GARAND,
    
DDD_WEAPON_BAR,
    
DDD_WEAPON_LUGER,
    
DDD_WEAPON_UNKNOWN3,
    
DDD_WEAPON_UNKNOWN4,
    
DDD_WEAPON_UNKNOWN5,
    
DDD_WEAPON_MOSIN,
    
DDD_WEAPON_K98//Streicher's unscoped k98
    
DDD_WEAPON_VELOCIRAPTORCLAW,
    
DDD_WEAPON_UNKNOWN6,
    
DDD_WEAPON_UNKNOWN7,
    
DDD_WEAPON_UNKNOWN8,
    
DDD_WEAPON_K98SNIPER,
    
DDD_WEAPON_DESMATOSUCHUS//both the flak and melee kill*
    
DDD_WEAPON_UNKNOWN9,
    
DDD_WEAPON_UNKNOWN10,
    
DDD_WEAPON_FLECHETTE,
    
DDD_WEAPON_BERSERK,
    
DDD_WEAPON_UNKNOWN11,
    
DDD_WEAPON_UNKNOWN12,
    
DDD_WEAPON_UNKNOWN13,
    
DDD_WEAPON_MP44,
    
DDD_WEAPON_DILOPHOSAURUS,
    
DDD_WEAPON_UNKNOWN14,
    
DDD_WEAPON_STENGUN,
    
DDD_WEAPON_P38,
    
DDD_WEAPON_NAGANT,
    
DDD_WEAPON_FISTSREGULAR,
    
DDD_WEAPON_UNKNOWN15,
    
DDD_WEAPON_TREX//This is the MG kill if the player controlling the trex eats a player the weaponid will be DDD_WEAPON_TREX and DDD_CUSTOM_DINNER
    
DDD_WEAPON_UNKNOWN16,
    
DDD_WEAPON_UNKNOWN17,
    
DDD_WEAPON_TRIGGER//both MG and melee*
    
DDD_WEAPON_STYGIMOLOCH //both MG and melee*
};    

// Custom kill identifiers for the customkill property on the player_death event
// * = Get the weapon string on the player_death event to differentiate between melee and primary gun
enum {
    
DDD_CUSTOM_SUICIDE 1,
    
DDD_CUSTOM_HEADSHOT,
    
DDD_CUSTOM_DINNER 37 //between DDD_CUSTOM_HEADSHOT and DDD_CUSTOM_DINNER there have been no custom id's identified
};    

enum DDDClassType
{
    
DDDClass_Spectate 0,
    
DDDClass_Desmatosuchus,
    
DDDClass_Velociraptor,
    
DDDClass_Dilophosaurus,
    
DDDClass_Streicher,
    
DDDClass_Hissman,
    
DDDClass_Graff,
    
DDDClass_Hardgrave,
    
DDDClass_Spencer,
    
DDDClass_Nigel,
    
DDDClass_Ilona,
    
DDDClass_Camille,
    
DDDClass_Jakob,
    
DDDClass_Styracosaurus,
    
DDDClass_Trex,
    
DDDClass_Trigger,
    
DDDClass_Stygimoloch
};

enum DDDTeam
{
    
DDDTeam_Unassigned 0,
    
DDDTeam_Spectator 1,
    
DDDTeam_Allies 2,
    
DDDTeam_Axis 3    
};
 
 
enum DDDResourceType
{
    
DDDResource_Ping,
    
DDDResource_Score,
    
DDDResource_Deaths,
    
DDDResource_Health,
    
DDDResource_PlayerClass
};

static const 
String:DDDResourceNames[DDDResourceType][] =
{
    
"m_iPing",
    
"m_iScore",
    
"m_iDeaths",
    
"m_iHealth",
    
"m_iPlayerClass"
};

/**
 * Get's a Clients current class.
 *
 * @param client        Player's index.
 * @return                Current DDDClassType of player.
 * @error                Invalid client index.
 */
stock DDDClassType:DDD_GetPlayerClass(client)
{
    return 
DDDClassType:GetEntProp(clientProp_Send"m_iSpecialClass");
}

/**
 * Set's a Clients class.
 *
 * Note: If setting player class in a player spawn hook weapons should be set to false.
 *
 * @param client        Player's index.
 * @param class            DDDClassType class symbol.
 * @param weapons        This paramater is ignored.
 * @param persistant    If true changes the players desired class so the change stays after death.
 * @noreturn
 * @error                Invalid client index.
 */
stock DDD_SetPlayerClass(clientDDDClassType:class, bool:weapons=truebool:persistant=true)
{
    
SetEntProp(clientProp_Send"m_iSpecialClass"_:class);
    
    if (
persistant)
    {
        
SetEntProp(clientProp_Send"m_iDesiredPlayerClass"_:class);
    }
}

/**
 * Retrieves client data from the resource entity
 *
 * @param client        Player's index.
 * @param type            ResourceType constant
 * @return                Value or -1 on failure.
 * @error                Invalid client index, client not in game or failed to find resource entity.
 */
stock DDD_GetPlayerResourceData(clientDDDResourceType:type)
{
    if (!
IsClientConnected(client))
    {
        return -
1;    
    }
    
    new 
offset FindSendPropInfo("CDDDPlayerResource"DDDResourceNames[type]);
        
    if (
offset 1)
    {
        return -
1;    
    }
                
    new 
entity DDD_GetResourceEntity();
    
    if (
entity == -1)
    {
        return -
1;
    }
    
    return 
GetEntData(entityoffset + (client*4));
}

/**
 * Sets client data in the resource entity
 *
 * Note: The game overwrites these values every frame, so changing them will have very little effect.
 *
 * @param client        Player's index.
 * @param type            ResourceType constant
 * @param value            Value to set.
 * @return                Value or -1 on failure.
 * @error                Invalid client index, client not in game or failed to find resource entity.
 */
stock bool:DDD_SetPlayerResourceData(clientDDDResourceType:typeany:value)
{
    if (!
IsClientConnected(client))
    {
        return 
false;    
    }
    
    new 
offset FindSendPropInfo("CDDDPlayerResource"DDDResourceNames[type]);
                        
    if (
offset 1)
    {
        return 
false;    
    }
                
    new 
entity DDD_GetResourceEntity();
    
    if (
entity == -1)
    {
        return 
false;    
    }
    
    
SetEntData(entityoffset + (client*4), value);
    
    return 
true;    
}

/**
 * Removes all weapons from a client's weapon slot
 *
 * @param client        Player's index.
 * @param slot            Slot index (0-5)
 * @noreturn
 * @error                Invalid client, invalid slot or lack of mod support
 */
stock DDD_RemoveWeaponSlot(clientslot)
{
    new 
weaponIndex;
    while ((
weaponIndex GetPlayerWeaponSlot(clientslot)) != -1)
    {
        
RemovePlayerItem(clientweaponIndex);
        
RemoveEdict(weaponIndex);
    }
}

/**
 * Removes all weapons from a client
 *
 * @param client        Player's index.
 * @noreturn
 */
stock DDD_RemoveAllWeapons(client)
{
    for (new 
0<= 5i++)
    {
        
DDD_RemoveWeaponSlot(clienti);
    }
}    

/**
 * Retrieves the entity index of the CDDDPlayerResource entity
 *
 * @return                The current resource entity index.
 */
stock DDD_GetResourceEntity()
{
    return 
FindEntityByClassname(-1"ddd_player_manager");


Hope someone finds this information useful.
Views before stock re-upload: 6
Please redownload this stock there is a small error that will stop compiling.

psychonic 08-09-2011 22:15

Re: [INC] Dino D-Day Stocks
 
Here's the weapon list from the binary, in order, starting from 0 (none). Should help you fill in some of the unknowns.

Code:

.data:105BA820                                        ; "none"
.data:105BA824                dd offset aMp40        ; "mp40"
.data:105BA828                dd offset aThompson    ; "thompson"
.data:105BA82C                dd offset aShotgun      ; "shotgun"
.data:105BA830                dd offset aGrenade      ; "grenade"
.data:105BA834                dd offset aPistol      ; "pistol"
.data:105BA838                dd offset aKabar        ; "kabar"
.data:105BA83C                dd offset aTrenchknife  ; "trenchknife"
.data:105BA840                dd offset aGarand      ; "garand"
.data:105BA844                dd offset aBar          ; "bar"
.data:105BA848                dd offset aLuger        ; "luger"
.data:105BA84C                dd offset aStickgrenade ; "stickgrenade"
.data:105BA850                dd offset aPiat        ; "piat"
.data:105BA854                dd offset aBigjoe      ; "bigjoe"
.data:105BA858                dd offset aMosin        ; "mosin"
.data:105BA85C                dd offset aK98          ; "k98"
.data:105BA860                dd offset aClaws        ; "claws"
.data:105BA864                dd offset aPterosaur    ; "pterosaur"
.data:105BA868                dd offset aMg42        ; "mg42"
.data:105BA86C                dd offset aSniper      ; "sniper"
.data:105BA870                dd offset aK98sniper    ; "k98sniper"
.data:105BA874                dd offset aFlak30      ; "flak30"
.data:105BA878                dd offset aFlak30reload ; "flak30reload"
.data:105BA87C                dd offset aJackrabbit  ; "jackrabbit"
.data:105BA880                dd offset aFlechette    ; "flechette"
.data:105BA884                dd offset aFists        ; "fists"
.data:105BA888                dd offset aSticky      ; "sticky"
.data:105BA88C                dd offset aHealthkit    ; "healthkit"
.data:105BA890                dd offset aSmokegrenade ; "smokegrenade"
.data:105BA894                dd offset aMp44        ; "mp44"
.data:105BA898                dd offset aDilophosaurus ; "dilophosaurus"
.data:105BA89C                dd offset aSatchel      ; "satchel"
.data:105BA8A0                dd offset aSten        ; "sten"
.data:105BA8A4                dd offset aP38          ; "p38"
.data:105BA8A8                dd offset aNagant      ; "nagant"
.data:105BA8AC                dd offset aFistsregular ; "fistsregular"
.data:105BA8B0                dd offset aStyracosaur  ; "styracosaur"
.data:105BA8B4                dd offset aTrex        ; "trex"
.data:105BA8B8                dd offset aTrexbomb    ; "trexbomb"
.data:105BA8BC                dd offset aTankmine    ; "tankmine"
.data:105BA8C0                dd offset aTrigger      ; "trigger"
.data:105BA8C4                dd offset aStygimoloch  ; "stygimoloch"


McFlurry 08-10-2011 14:20

Re: [INC] Dino D-Day Stocks
 
Well that's strange I was aquiring my data through the player_death event using the weaponid and customkill shorts. Things like the Grenade, Stickgrenade, PIAT, Pterosaur all gave me 0 as their weaponid...

psychonic 08-10-2011 14:49

Re: [INC] Dino D-Day Stocks
 
Quote:

Originally Posted by McFlurry (Post 1529751)
Well that's strange I was aquiring my data through the player_death event using the weaponid and customkill shorts. Things like the Grenade, Stickgrenade, PIAT, Pterosaur all gave me 0 as their weaponid...

They might be used elsewhere, it may just be a bug in player_death, or they may be completely unused. Hard to tell.


All times are GMT -4. The time now is 21:53.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.