I make it work. Also i make the posibiliy of making the user to set the speed and the times to repeat. But i have a problem, it doesn't works with numbers higher than 9. If i put 10, it takes 1 instead of 10
PHP Code:
public admin_flash(id,level,cid) {
if (!cmd_access(id,level,cid,2)) {
return PLUGIN_HANDLED
}
new n[32], n1[2], n2[2]
read_argv(1,n,31)
read_argv(2,n1,1)
read_argv(3,n2,1)
new player = cmd_target(id,n,0)
if (!player) return PLUGIN_HANDLED
new ids[2]
ids[0] = player
set_task(str_to_float(n1), "Flash", 0, ids, 1, "a",str_to_num(n2))
return PLUGIN_HANDLED
}
public Flash(ids[]) {
new id=ids[0]
message_begin(MSG_ONE,gMsgScreenFade,{0,0,0},id)
write_short( 1<<15 )
write_short( 1<<10 )
write_short( 1<<12 )
write_byte( 255 )
write_byte( 255 )
write_byte( 255 )
write_byte( 255 )
message_end()
emit_sound(id,CHAN_BODY, "weapons/flashbang-2.wav", 1.0, ATTN_NORM, 0, PITCH_HIGH)
return PLUGIN_CONTINUE
}