DARsKater
Messages postés747Date d'inscriptionvendredi 4 janvier 2008StatutMembreDernière intervention 5 août 2020
-
27 juin 2009 à 17:52
Bonjour,
Mon problème est que j'ai téléchargé un plugin amxx pour mon serveur cs 1.6,
Tout est fonctionnel, mais uniquement pour les admins amx, je voudrais que tout le monde puisse utiliser les commandes +hook et +rope sans qu'il y est besoin de modifier une cvar.
Si vous pouviez m'aider sa me serait grandement utile
je vous fournis ci-dessous le code source du plugin que j'ai trouvé :
#define TE_BEAMENTPOINT 1
#define TE_KILLBEAM 99
#define DELTA_T 0.1 // seconds
#define BEAMLIFE 100 // deciseconds
#define MOVEACCELERATION 150 // units per second^2
#define REELSPEED 300 // units per second
/* Hook Stuff */
new gHookLocation[33][3]
new gHookLenght[33]
new bool:gIsHooked[33]
new gAllowedHook[33]
new Float:gBeamIsCreated[33]
new global_gravity
new beam
/************************************************************************************************************************/
public plugin_init() //Called on plugin start
{
// Plugin Info
register_plugin("Admin Hook","1.0","AssKicR")
//CVARS
register_cvar("sv_adminhook", "1" )
//ADMIN CMDS
register_concmd("amx_granthook","AdminGrantHook",ADMIN_LEVEL_A,"<authid, nick, @team, @all or #userid> <on/off>")
/*************************************************************************************************************************/
/**************************************************** HOOKED EVENTS ******************************************************/
/*************************************************************************************************************************/
public ResetHUD(id) {
//Check if he is hooked to something
if (gIsHooked[id]) RopeRelease(id)
}
/************************************************************************************************************************/
stock kz_velocity_set(id,vel[3]) {
//Set Their Velocity to 0 so that they they fall straight down from
new Float:Ivel[3]
Ivel[0]=float(vel[0])
Ivel[1]=float(vel[1])
Ivel[2]=float(vel[2])
entity_set_vector(id, EV_VEC_velocity, Ivel)
}
stock kz_velocity_get(id,vel[3]) {
//Set Their Velocity to 0 so that they they fall straight down from
new Float:Ivel[3]
/************************************************************************************************************************/
/**************************************************** ADMIN COMMANDS ****************************************************/
/************************************************************************************************************************/
public AdminGrantHook(id,level,cid)
{
if ( !cmd_access(id,level,cid,1) )
return PLUGIN_HANDLED
new arg1[32],arg2[32]
read_argv(1,arg1,31)
read_argv(2,arg2,31)
new onoff = str_to_num(arg2)
if ( equali(arg1,"@all") )
{
new plist[32],pnum
get_players(plist,pnum,"a")
if (pnum==0)
{
console_print(id,"[%s] There are no clients",gModName)
return PLUGIN_HANDLED
}
for (new i=0; i<pnum; i++) {
gAllowedHook[plist[i]]=onoff
if (gIsHooked[plist[i]]==true && onoff==0)
{
RopeRelease(plist[i])
}
}
console_print(id,"[%s] %s all players access to hook/rope",gModName,onoff ? "Gave":"Removed")
}
else if ( arg1[0]=='@' )
{
new plist[32],pnum
get_players(plist,pnum,"ae",arg1[1])
if ( pnum==0 )
{
console_print(id,"[%s] No clients in such team",gModName)
return PLUGIN_HANDLED
}
for (new i=0; i<pnum; i++) {
gAllowedHook[plist[i]]=onoff
if (gIsHooked[plist[i]]==true && onoff==0)
{
RopeRelease(plist[i])
}
}
console_print(id,"[%s] %s all %ss access to hook/rope",onoff ? "Gave":"Removed",arg1[1])
}
else
{
new pName[32]
new player = cmd_target(id,arg1,6)
if (!player) return PLUGIN_HANDLED
gAllowedHook[player]=onoff
if (gAllowedHook[player]==0 && onoff==0)
{
RopeRelease(player)
}
get_user_name(player,pName,31)
console_print(id,"[%s] %s ^"%s^" access to hook/rope",onoff ? "Gave":"Removed",pName)
}
public ropetask(parm[])
{
new id = parm[0]
new user_origin[3], user_look[3], user_direction[3], move_direction[3]
new A[3], D[3], buttonadjust[3]
new acceleration, velocity_towards_A, desired_velocity_towards_A
new velocity[3], null[3]
if (!is_user_alive(id))
{
RopeRelease(id)
return
}
if (gBeamIsCreated[id] + BEAMLIFE/10 <= get_gametime())
{
beamentpoint(id)
}
if (get_user_button(id)&IN_FORWARD) buttonadjust[0]+=1
if (get_user_button(id)&IN_BACK) buttonadjust[0]-=1
if (get_user_button(id)&IN_MOVERIGHT) buttonadjust[1]+=1
if (get_user_button(id)&IN_MOVELEFT) buttonadjust[1]-=1
if (get_user_button(id)&IN_JUMP) buttonadjust[2]+=1
if (get_user_button(id)&IN_DUCK) buttonadjust[2]-=1
public hook_on(id)
{
if (get_cvar_num("sv_adminhook")==1)
{
if (gAllowedHook[id] || (get_user_flags(id)&ADMIN_LEVEL_E)) {
if (!gIsHooked[id] && is_user_alive(id))
{
new cmd[32]
read_argv(0,cmd,31)
if(equal(cmd,"+rope")) RopeAttach(id,0)
if(equal(cmd,"+hook")) RopeAttach(id,1)
}
}else{
client_print(id,print_chat,"[%s] You have no access to that command",gModName)
return PLUGIN_HANDLED
}
}else{
client_print(id,print_chat,"[%s] This command is deativated",gModName)
}
return PLUGIN_HANDLED
}
public hook_off(id)
{
if (gAllowedHook[id] || (get_user_flags(id)&ADMIN_LEVEL_E)) {
if (gIsHooked[id])
{
RopeRelease(id)
}
}else{
client_print(id,print_chat,"[%s] You have no access to that command",gModName)
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}