AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   game_player_equip (https://forums.alliedmods.net/showthread.php?t=121620)

joropito 03-17-2010 19:12

game_player_equip
 
Does anybody knows how to create and use game_player_equip with a plugin?

I mean, I guess I know how it works but I've tried to create and add some weapons as kvd but doesn't work.

As far as I know, this entity give items to players when they spawn.

Arkshine 03-17-2010 19:21

Re: game_player_equip
 
example :

entity = create_entity( "game_player_equip" );
DispatchKeyValue( entity, "weapon_knife" , "1" );
DispatchKeyValue( entity, "weapon_glock18", "1" );
DispatchKeyValue( entity, "ammo_9mm" , "3" );
DispatchKeyValue( entity, "targetname" , "equipment" );
DispatchSpawn( entity );

Then you need to trigger it either using another entity (any entities which can called a target ) either I guess with Ham_Use or something.
This entity doesn't give weapons at spawn. It needs another entity to trigger it ( game_playerspawn used multi_manager )
Something like : https://forums.alliedmods.net/showpo...27&postcount=2 ; but it will called each times on resethud too ; so it may not a good idea.

joropito 03-17-2010 19:26

Re: game_player_equip
 
Right, but what about this:

http://developer.valvesoftware.com/w...e_player_equip
Quote:

Spawns one or several entities at the location of the player. Used in multiplayer games to automatically equip the players with standard gear on map spawn
I want the engine give items automatically using it.

ConnorMcLeod 03-17-2010 19:28

Re: game_player_equip
 
Yes it works, you don't need any other trigger ent.
But weapons will be given also when players send command "fullupdate".

Arkshine 03-17-2010 19:29

Re: game_player_equip
 
oh I was not aware, so yes it should work so, though never tried.

Arkshine 03-17-2010 19:45

Re: game_player_equip
 
I'm idiot, I was aware. Last time I have decompiled PlayerSpawn() for Connor and it's quite the same as the HLSDK one and we can see well it search for game_player_equip automatically :

Code:
void CHalfLifeMultiplay::PlayerSpawn( CBasePlayer *pPlayer ) {     if ( pPlayer->m_bJustConnected )     {         return;     }     bool addDefault = true;     CBaseEntity *pWeapon = NULL;         pPlayer->pev->weapons |= ( 1 << WEAPON_SUIT );     while ( pWeapon = UTIL_FindEntityByClassname( pWeapon, "game_player_equip" ) )     {         pWeapon->Touch( pPlayer );         addDefault = false;     }     if ( pPlayer->m_bNotKilled )     {         addDefault = false;     }         if ( addDefault || pPlayer->m_bIsVIP )     {         pPlayer->GiveDefaultItems();     }     pPlayer->SetPlayerModel(); }

joropito 03-17-2010 20:00

Re: game_player_equip
 
Last question.
Should this entity be created at precache or can be created during game?

Arkshine 03-17-2010 20:05

Re: game_player_equip
 
If it searches like that on player's spawn we can guess it can be creatde in game without problem.

ish12321 06-11-2018 07:07

Re: game_player_equip
 
Quote:

Originally Posted by Arkshine (Post 1120901)
example :

entity = create_entity( "game_player_equip" );
DispatchKeyValue( entity, "weapon_knife" , "1" );
DispatchKeyValue( entity, "weapon_glock18", "1" );
DispatchKeyValue( entity, "ammo_9mm" , "3" );
DispatchKeyValue( entity, "targetname" , "equipment" );
DispatchSpawn( entity );

Then you need to trigger it either using another entity (any entities which can called a target ) either I guess with Ham_Use or something.
This entity doesn't give weapons at spawn. It needs another entity to trigger it ( game_playerspawn used multi_manager )
Something like : https://forums.alliedmods.net/showpo...27&postcount=2 ; but it will called each times on resethud too ; so it may not a good idea.

Sorry to bump this old thread.
If there is already an existing game_player_equip entity. Is it possible to know which all keyvalues it has, i.e., which all weapons it gives ?


All times are GMT -4. The time now is 08:36.

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