Albo do przodu albo na bok.
Nie działa "wd" "wa" "sa" "sd"
Zauważyłem, że przestawia sie w cfg każdemu graczowi takie komendy
z tego
cl_backspeed 400 cl_forwadspeed 400
na to
cl_backspeed 9999 cl_forwadspeed 9999
tutaj speed_api.sma
#include <amxmodx>
#include <fun>
#include <fakemeta>
#include <engine>
#define PLUGIN "Speed API"
#define AUTHOR "OT"
#define VERSION "4.0"
#define OFFSET_SHIELD 510
#define HAS_SHIELD (1<<24)
#define USING_SHIELD (1<<16)
new const Float:wpn_act_speed[31] =
{
0.0, 250.0, 0.0, 260.0, 250.0, 240.0, 250.0, 250.0, 240.0, 250.0, 250.0, 250.0, 250.0, 210.0, 240.0, 240.0, 250.0, 250.0, 210.0, 250.0, 220.0, 230.0, 230.0, 250.0, 210.0, 250.0, 250.0, 235.0, 221.0, 250.0, 245.0
}
enum FwdState
{
FWD_BLOCK_ALL,
FWD_BLOCK_ONCE,
FWD_BLOCK_NOT
}
new cl_weapon[33] = {0, ...}
new Float:cl_cur_speed[33] = {250.0, ...}
new Float:cl_for_speed[33] = {0.0, ...}
new fwid,fwid2
new FwdState:block_fw = FWD_BLOCK_ALL
new bool:cl_unzomed[33] = false
public plugin_cfg()
{
register_event("CurWeapon","event_active_weapon","be","1=1")
register_event("SetFOV","event_zoom","be")
register_event("HLTV","event_new_round","a","1=0","2=0")
register_logevent("event_start_round", 2, "1=Round_Start")
fwid = CreateMultiForward("fw_playermaxspeed",ET_IGNORE,FP_CELL)
fwid2 = CreateMultiForward("fw_pluginmaxspeed",ET_IGNORE,FP_CELL)
}
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
}
public plugin_natives()
{
register_library("speed_api")
register_native("api_set_maxspeed","native_api_speed_set",1)
register_native("api_force_maxspeed","native_api_force_speed",1)
register_native("api_unforce_maxspeed","native_api_unforce_speed",1)
register_native("api_get_current_maxspeed","native_api_speed_get",1)
register_native("api_get_weapon_maxspeed","native_api_speed_actual_get",1)
}
public client_disconnect(id)
{
cl_cur_speed[id] = 0.0
cl_unzomed[id] = false
}
public event_new_round()
{
block_fw = FWD_BLOCK_ALL
for (new i=0;i<33;i++)
{
cl_cur_speed[i] = 1.0
}
}
public event_start_round()
{
block_fw = FWD_BLOCK_ONCE
}
public native_api_speed_set(id,Float:speed,execfw)
{
if (is_user_alive(id))
{
set_user_maxspeed(id,speed)
if (execfw)
{
run_forward(id)
}
else
{
cl_cur_speed[id] = speed
}
return 1
}
return 0
}
public native_api_force_speed(id,Float:speed)
{
cl_for_speed[id] = speed
set_user_maxspeed(id,speed)
}
public native_api_unforce_speed(id)
{
cl_for_speed[id] = 0.0
native_api_speed_set(id,regular_maxspeed(id),1)
}
public Float:native_api_speed_get(id)
{
return cl_cur_speed[id]
}
public Float:native_api_speed_actual_get(id)
{
return regular_maxspeed(id)
}
public event_active_weapon(id)
{
new weapon = read_data(2)
if (weapon != cl_weapon[id] && cl_weapon[id] != 0)
{
if (cl_unzomed[id])
{
set_user_maxspeed(id,regular_maxspeed(id))
}
run_forward(id)
}
cl_weapon[id] = weapon
}
public event_zoom(id)
{
if (read_data(1) == 90)
cl_unzomed[id] = true
if (get_user_maxspeed(id) != cl_cur_speed[id])
{
run_forward(id)
}
}
public plugin_end()
{
DestroyForward(fwid)
DestroyForward(fwid2)
}
public run_forward(id)
{
if(fwid < 0)
return log_amx("Forward could not be created.")
if (cl_for_speed[id] != 0.0)
{
return 0
}
new ret
if(!ExecuteForward(fwid,ret,id))
return log_amx("Could not execute forward.")
cl_cur_speed[id] = get_user_maxspeed(id)
return 1
}
public client_PreThink(id)
{
if (!is_user_alive(id))
return PLUGIN_CONTINUE
if (cl_for_speed[id] != 0.0)
set_user_maxspeed(id,cl_for_speed[id])
return PLUGIN_CONTINUE
}
public client_PostThink(id)
{
if (!is_user_alive(id) || block_fw == FWD_BLOCK_ALL)
return PLUGIN_CONTINUE
if (cl_cur_speed[id] != get_user_maxspeed(id) && block_fw == FWD_BLOCK_ONCE)
{
run_forward(id)
block_fw = FWD_BLOCK_NOT
return PLUGIN_CONTINUE
}
if (cl_cur_speed[id] != get_user_maxspeed(id) && cl_for_speed[id] == 0.0)
{
if(fwid2 < 0)
return log_amx("Forward could not be created.")
new ret
if(!ExecuteForward(fwid2,ret,id))
return log_amx("Could not execute forward.")
cl_cur_speed[id] = get_user_maxspeed(id)
}
if (cl_for_speed[id] != 0.0)
set_user_maxspeed(id,cl_for_speed[id])
return PLUGIN_CONTINUE
}
Float:regular_maxspeed(id)
{
if(!is_user_alive(id)) return 0.0
new shield = get_pdata_int(id,OFFSET_SHIELD,5)
if(shield & USING_SHIELD) return 180.0
if(shield & HAS_SHIELD) return 250.0
new weapon = cl_weapon[id]
if(weapon < 0 || weapon > 30) return 0.0
return wpn_act_speed[weapon]
}
Gdzie naprawić problem, żeby nie zmieniało tych ustawień każdemu graczowi?
Może coś tu pomoże?
http://forums.allied... ... post690214