Code:
/* Ice Skating Wars plugin!
What does it do?: It will change the players friction so that it feels like you are walking in ice!
Commands:
amx_icewars <1|0> "Activates the plugin"
Cvars: amx_friction < 1.0 is default and 0.1 is totally slippy>
amx_ice_maxspeed <sets the maxspeed that will be activated>
UPDATE: added INCREDIBLE speed
The plugin will be reset every round
*/
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fun>
new iceskate
new gCurrentWeapon[33]
public plugin_init() {
register_plugin("Ice skating wars", "1.0", "AtomiC")
register_clcmd ("amx_icewars", "icewars", ADMIN_LEVEL_A,"<1|0>")
register_cvar("amx_friction","0.1")
register_cvar("amx_ice_maxspeed","1000.0")
register_event("CurWeapon","weapon_switch","be","1=1")
}
public icewars (id,level,cid)
{
if (!cmd_access(id,level,cid,2))
return PLUGIN_HANDLED
new arg[8] , a
read_argv(1,arg,7)
iceskate = str_to_num(arg)
if(iceskate == 1)
{
new players[32], inum
get_players(players,inum)
for(a = 0; a < inum; a++)
{
entity_set_float(players[a], EV_FL_friction, get_cvar_float("amx_friction"))
set_user_maxspeed (players[a], get_cvar_float("amx_ice_maxspeed"))
}
set_hudmessage(222, 70,0, -1.0, 0.3, 1, 10.0, 10.0, 2.0, 4.0, 8)
show_hudmessage(0,"Ice skating wars is now on")
server_cmd ("sv_maxspeed 1000")
}
if(iceskate == 0)
{
new players[32], inum
get_players(players,inum)
for(a = 0; a < inum; a++)
{
entity_set_float(players[a], EV_FL_friction, 1.0)
set_user_maxspeed (players[a], 250.0)
}
set_hudmessage(222, 70,0, -1.0, 0.3, 1, 10.0, 10.0, 2.0, 4.0, 8)
show_hudmessage(0,"Ice skating wars is now off")
}
return PLUGIN_HANDLED
}
public round_start() {
if(iceskate == 1)
{
entity_set_float(0, EV_FL_friction, 1.0)
set_user_maxspeed (0, 250.0)
iceskate = 0
}
return PLUGIN_CONTINUE
}
public client_connect( id )
{
client_cmd(id, "cl_forwardspeed 1000");
client_cmd(id, "cl_sidespeed 1000");
client_cmd(id, "cl_backspeed 1000");
}
public weapon_switch(id) //this code
{
new arg[8] , a
read_argv(1,arg,7)
iceskate = str_to_num(arg)
if(iceskate == 1)
}
new Float:maxSpeed = get_cvar_float("amx_ice_maxspeed");
new weaponid = read_data(2)
if(gCurrentWeapon[id] != weaponid) {
gCurrentWeapon[id] = weaponid
set_user_maxspeed(id,maxSpeed)
}
}
}