I tried to make a plugin, one of them works but does not give armor, the other plugin simply does not compile, although in other games the armor issuance plugin works, most likely I think this is due to the command itself, which is responsible for issuing armor, but I'm not sure...if anyone knows which line is responsible for spawning armor in the game, let me know, I know that the item in the game is called give misc_armor But it does not work.
1. Spawn with Added random guns
#include <sourcemod>
public OnPluginStart()
{
HookEvent("player_spawn", EventSpawn);
}
public EventSpawn(Handle:Event, const String:Name[], bool:Broadcast)
{
decl Client;
Client = GetClientOfUserId(GetEventInt(Event, "userid"));
GivePlayerItem(Client, "weapon_m4"); GivePlayerItem(Client, "weapon_870"); "random"));
}
2. Spawn with Armor
public OnPluginStart()
{
cvar_armor = CreateConVar( "sv_armor", "1", "Enables/disables the plugin" );
cvar_armor_amount = CreateConVar( "sv_armor_amount", "100", "How much armor player will get on spawn" );
HookEvent( "player_spawn", HookPlayerSpawn, EventHookMode_Post );
CreateConVar( "sm_spawn_armor", PLUGIN_VERSION, "Spawn with Armor version", CVAR_FLAGS );
}
public HookPlayerSpawn( Handle:event, const String:name[ ], bool:dontBroadcast )
{
new client = GetClientOfUserId( GetEventInt( event, "userid" ) );
if ( IsPlayerAlive( client ) && GetConVarInt( cvar_armor ) )
{
SetEntProp( client, Prop_Send, g_armor_prop, GetConVarInt( cvar_armor_amount ), 1 );
}
}
Last edited by ORdli; 12-16-2022 at 09:01.
|