Thanks, works fine, but how do can i set the function client_print, so when the ct writes /toss, it shows %s turned on gun toss distance? I think it goes something like this, but im not completly sure :
PHP Code:
{
new name[32];
get_user_name(id, name, 31);
client_print(0, print_chat, "%s turned on gun toss distance.", name);
}
Also I tried to do the same with spray stats but it gave me error on line 27 and 57 :
PHP Code:
#include <amxmodx>
#include <engine>
#include <cstrike>
new g_bEnabled = true
public plugin_init()
{
/* SVC_TEMPENTITY (event #23) event, trigger if parameter 1 is equal to 112 (TE_PLAYERDECAL) */
register_event("23", "player_spray", "a", "1=112")
register_clcmd("say /spray", "cmdToggleState")
}
public cmdToggleState(id)
{
if(cs_get_user_team(id) == CS_TEAM_CT )
{
if( g_bEnabled )
{
// Plugin is currently enabled.
g_bEnabled = false // Disable plugin.
}
else
{
// Plugin is currently disabled.
g_bEnabled = ture // Enable plugin.
}
}
}
public player_spray()
{
if( g_bEnabled ) // Perform action only if plugin is enabled.
{
{
new id = read_data(2) /* as seen in the include, player index is the second parameter */
new iOrigin[3]
iOrigin[0] = read_data(3) /* and of course, the coordinates... */
iOrigin[1] = read_data(4)
iOrigin[2] = read_data(5)
/* you can get the rest of parameters too if you need them */
/* now, what you needed... distance... */
new iPlayerOrigin[3]
get_user_origin(id, iPlayerOrigin)
new iDistance = get_distance(iPlayerOrigin, iOrigin)
client_print(id, print_chat, "You sprayed your spray %d units far.", iDistance)
}
And how can i do the same when you write /spray it shows %s turned on spray stats.
Big thanks for helping me.