Author
|
Message
|
Senior Member
|
08-23-2014
, 13:22
[HL2] Getting entity data tables?
|
#1
|
Basically I want to change a netprop in the client's m_HL2Local named m_iMoney to a new value, but I have no idea on how to do this.
Quote:
#include <sourcemod>
#include <sdktools>
public Plugin:myinfo =
{
name = "SMOD FIREFIGHT Money Test",
author = "Bitl",
description = "",
version = "1.0",
url = ""
}
public OnPluginStart()
{
RegConsoleCmd("sm_addmoney", Command_addmoney);
RegConsoleCmd("sm_removemoney", Command_removemoney);
RegConsoleCmd("sm_setmoney", Command_setmoney);
}
public Action:Command_addmoney(client, args)
{
new String:arg1[128];
GetCmdArg(1, arg1, 128 );
new cash = StringToInt(arg1);
SetEntProp( client, Prop_Data, "m_iMoney", GetEntProp( client, Prop_Send, "m_iMoney" ) + cash );
}
public Action:Command_removemoney(client, args)
{
new String:arg1[128];
GetCmdArg(1, arg1, 128 );
new cash = StringToInt(arg1);
SetEntProp( client, Prop_Data, "m_iMoney", GetEntProp( client, Prop_Send, "m_iMoney" ) - cash );
}
public Action:Command_setmoney(client, args)
{
new String:arg1[128];
GetCmdArg(1, arg1, 128 );
new cash = StringToInt(arg1);
SetEntProp( client, Prop_Data, "m_iMoney", cash );
}
|
__________________
Last edited by Bitl; 08-23-2014 at 13:24.
|
|
|
|