Well I'm trying to make a command where any player in the server can open the console and type 'mslap <number of slaps >' and it will slap them according to the amount of slaps they output.
Code:
#include <amxmodx>
#include <amxmisc>
new pName[] = "Mult Self Slap"
new pVersion[] = "v0.1"
new pAuthor[] = "Nicholas Glistak"
new msSlaps[33] = 0
public plugin_init ( )
{
register_plugin ( pName, pVersion, pAuthor )
register_clcmd ( "mslap", "MultSelfSlap", -0, " < Usage : mslap |Number Of Slaps| > " )
register_cvar ( "aios_msSlaps", "1" )
register_cvar ( "aios_msLimit", "2" )
register_event ( "ResetHUD", "msSlaps_Reset", "a" )
}
public client_connect ( id )
{
msSlaps[id] = 0
}
public msSlaps_Reset ()
{
new Players[32], iPlayers
get_players ( Players, iPlayers, "a" )
for ( new x = 0; x <= iPlayers; x++ )
{
msSlaps[x] = 0
}
}
public MultSelfSlap ( ids[] )
{
new id = ids[0]
new name[32]
get_user_name ( id, name, 31 )
new argv[32]
read_argv ( 1, argv, 31 )
new msNum
msNum = str_to_num ( argv )
if ( get_cvar_num ( "aios_msSlaps" ) != 1 ) {
client_print ( id, print_console, "[AIOS] Sorry this function is turned OFF" )
return PLUGIN_HANDLED
}
if ( msNum > 100 ) {
client_print ( id, print_console, "[AIOS] You cannot slap yourself more than 100 times" )
return PLUGIN_HANDLED
}
new MAX_SLAPS = get_cvar_num ( "aios_msLimit" )
if ( msSlaps[id] > MAX_SLAPS ) {
client_print ( id, print_console, "[AIOS] Sorry %s : You have used this function too many times this round", name )
return PLUGIN_HANDLED
} else {
new SlapDmg = get_cvar_num ( "aios_SlapDmg" )
for ( new i = 0; i < msNum; i++ )
{
user_slap ( id, SlapDmg )
}
msSlaps[id]++
}
new r = random ( 256 )
new g = random ( 256 )
new b = random ( 256 )
set_hudmessage ( r, g, b, 0.03, 0.62, 2, 0.02, 6.0, 0.01, 0.1, 1 )
show_hudmessage ( 0, "[AIOS] %s : Has slapped himself %d times", name, msNum )
console_print ( 0, "[AIOS] Client %s : Has slapped himself %d times", name, msNum )
return PLUGIN_HANDLED
}
Compiles with no errors or warnings.