AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Code Snippets/Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=83)
-   -   [INC] Half-Life Stocks (https://forums.alliedmods.net/showthread.php?t=132825)

KORD_12.7 07-19-2010 07:45

[INC] Half-Life Stocks
 
1 Attachment(s)
Stocks for Half-Life DM (valve)

PHP Code:

/*
* AMX mod X functions for Half-Life
*
* Version 1.1 (last update: 29.07.2010)
*
* http://hl.levshi.ru/forum/ - Russian Half-Life and Adrenaline Gamer Community
*
 
/* Returns player deaths.
*/
hl_get_user_deaths(client)
 
/* Sets player deaths.
*/
hl_set_user_deaths(clientdeaths)
 
/* Get amount of ammo in backpack on a user for a specific weapon.
* Look in hlsdk_const.inc for weapon types: HLW_*.
* Weapons on the same line uses the same ammo type:
* shotgun
* mp5, glock
* argrenade
* python
* gauss, egon
* rpg
* crossbow
* tripmine
* satchel
* handgrenade
* snark
* hornet
*/
hl_get_user_bpammo(clientweapon)
 
/* Restock/remove ammo in a user's backpack.
*/
hl_set_user_bpammo(clientweaponammo)
 
/* Get user model.
*/
hl_get_user_model(clientmodel[], len)
 
/* Set user model.
*/
hl_set_user_model(client, const model[])
 
/* Returns health value.
*/
hl_get_user_health(client)
 
/* Sets player health.
*/
hl_set_user_health(clienthealth)
 
/* Returns armor value.
*/
hl_get_user_armor(client)
/* Sets player armor.
*/
hl_set_user_armor(clientarmorvalue)
 
/* Returns team id. When length is greater then 0 then a name of team is set.
*/
hl_get_user_team(clientteam[] = ""len 0)
 
/* Set player team by teamname.
*/
hl_set_user_team(client, const team[])
 
/* Returns entity index of active weapon.
*/
hl_get_user_weapon_ent(client)
 
/* Returns amount of ammo in weapon's clip.
*/
hl_get_weapon_ammo(entity)
 
/* Set amount of ammo in weapon's clip.
*/
hl_set_weapon_ammo(entityclip)
 
/* Get weapon type. Corresponds to HLW_* in hlsdk_const.inc: 1 is HLW_CROWBAR, 2 is HLW_GLOCK and so on...
*/
hl_get_weapon_id(entity)
 
/* Returns weapon entity index from weaponbox.
*/
hl_get_wbox_weapon_ent(entity)
 
/* Returns amount of ammo in weaponbox.
*/
hl_get_wbox_ammo(entity)
 
/* Set amount of ammo in weaponbox.
*/
hl_set_wbox_ammo(entityammo)
 
/* Spawns a Half-Life player.
*/
hl_user_spawn(client)
 
/* Strips all weapons from player.
*/
hl_strip_user_weapons(client
 
/* Check if player in spectator mode.
*/
hl_get_user_spectator(client)
 
/* Switch player to spectator mode.
*/
hl_set_user_spectator(clientbool:spectator true)
 
/* Check if player have longjump module.
*/
hl_get_user_longjump(client
 
/* Set longjump module to player.
*/
hl_set_user_longjump(clientbool:longjump truebool:tempicon true


hleV 07-19-2010 08:38

Re: [INC] Half-Life Stocks
 
Sweet. For getting health and armor as integer I'd use
Code:

healthvalue = pev(client, pev_health)
armorvalue = pev(client, pev_armorvalue)


ot_207 07-19-2010 12:30

Re: [INC] Half-Life Stocks
 
Nice. This will make users create more hl plugins, including me :p.

ConnorMcLeod 07-19-2010 13:04

Re: [INC] Half-Life Stocks
 
Suggestions : use get_user_info and set_user_info to set/get player model.

You should find m_fLongJump offset and update it when you (un)set longjump, this offset is used for item_longjump Touch fonction.

MMYTH 07-25-2010 20:14

Re: [INC] Half-Life Stocks
 
oh very very nice

joropito 07-25-2010 21:23

Re: [INC] Half-Life Stocks
 
Quote:

Originally Posted by ConnorMcLeod (Post 1244585)
Suggestions : use get_user_info and set_user_info to set/get player model.

You should find m_fLongJump offset and update it when you (un)set longjump, this offset is used for item_longjump Touch fonction.

I't seems to be this

m_fLongJump = 98 (103 win)

KORD_12.7 07-29-2010 05:56

Re: [INC] Half-Life Stocks
 
Updated to version 1.1

Fixed some errors and changed stocks:
g(s)et_user_team
g(s)et_user_spectator
g(s)et_user_model
set_user_longjump

Thanks to ConnorMcLeod and joropito for suggestions.

Conan1018 01-29-2011 01:14

Re: [INC] Half-Life Stocks
 
hl_set_user_deaths wont work. Let say score is 10/5, it reset then the next time he died, his score is 0/6.

Protocol version 48
Exe version 1.1.2.1 (valve)
Exe build: 14:21:06 Mar 8 2010 (4554)

KORD_12.7 01-29-2011 02:46

Re: [INC] Half-Life Stocks
 
On my hl steam is everything ok. May be you use non-steam? Or may be you use custom hl.dll (xdm, bubble mod, severian mod and etc.)?

Conan1018 01-29-2011 13:13

Re: [INC] Half-Life Stocks
 
im using xdm. maybe the deaths offset is different from the default one. i've been trying to find the code to collect player offset but no luck so far. maybe you can give me?


All times are GMT -4. The time now is 14:01.

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