PDA

View Full Version : CS:GO Set armor


iGANGNAM
10-18-2014, 06:33
What I'm trying to do is to set armor for player after he spawns.

#include <sourcemod>
#include <smlib>

public Plugin:myinfo =
{
name = "Vip armor",
author = "",
description = "",
version = "0.1",
url = ""
};

public OnPluginStart() {

HookEvent("player_spawn", Event_SpawnEvent);

}

public Action:Event_SpawnEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));

if ( Client_IsValid(client) && Client_IsIngame(client) && Client_HasAdminFlags(client, ADMFLAG_RESERVATION)) {
CreateTimer(0.2, GiveEquipment, client, TIMER_FLAG_NO_MAPCHANGE);
}
}

public Action:GiveEquipment(Handle:timer, any:client)
{
SetEntProp( client, Prop_Send, "m_ArmorValue", 100, 1 );
return Plugin_Handled;
}But for some reason it just don't work.Firstly tried without timer, but with timer same result.....

I have mp_free_armor 0 on server

Wilczek
10-18-2014, 06:48
Replace
SetEntProp( client, Prop_Send, "m_ArmorValue", 100, 1 );

with:
SetEntProp( client, Prop_Data, "m_ArmorValue", 100, 1 );

iGANGNAM
10-18-2014, 07:00
if ( Client_IsValid(client) && Client_IsIngame(client) && Client_HasAdminFlags(client, ADMFLAG_RESERVATION)) {Something wrong with that line... And it works when I remove that IF thank you Wilczek (https://forums.alliedmods.net/member.php?u=206496)