AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   plugin only for steam id (https://forums.alliedmods.net/showthread.php?t=303263)

conn 11-30-2017 02:55

plugin only for steam id
 
hello i'd like to know if a plugin can be set by steam id
something in the code

in another words
that a certain plugin works only for my steam account and doesnt matter if others admins have all the flags.

the plugin i want to make work only for my steam id is:

PHP Code:

/*
 *
 *    Author:        Cheesy Peteza
 *    Date:        22-Apr-2004 (updated 2-March-2005)
 *
 *
 *    Description:    Enable bunny hopping in Counter-Strike.
 *
 *    Cvars:
 *            bh_enabled        1 to enable this plugin, 0 to disable.
 *            bh_autojump        If set to 1 players just need to hold down jump to bunny hop (no skill required)
 *            bh_showusage        If set to 1 it will inform joining players that bunny hopping has been enabled
 *                        and how to use it if bh_autojump enabled.
 *
 *    Requirements:    AMXModX 0.16 or greater
 *
 *
 */

#include <amxmodx>
#include <engine>

#define    FL_WATERJUMP    (1<<11)    // player jumping out of water
#define    FL_ONGROUND    (1<<9)    // At rest / on the ground

public plugin_init() {
    
register_plugin("Super Bunny Hopper""1.2""Cheesy Peteza")
    
register_cvar("sbhopper_version""1.2"FCVAR_SERVER)

    
register_cvar("bh_enabled""1")
    
register_cvar("bh_autojump""1")
    
register_cvar("bh_showusage""1")
}

public 
client_PreThink(id) {
    if (!
get_cvar_num("bh_enabled"))
        return 
PLUGIN_CONTINUE

    entity_set_float
(idEV_FL_fuser20.0)        // Disable slow down after jumping

    
if (!get_cvar_num("bh_autojump"))
        return 
PLUGIN_CONTINUE

// Code from CBasePlayer::Jump (player.cpp)        Make a player jump automatically
    
if (entity_get_int(idEV_INT_button) & 2) {    // If holding jump
        
new flags entity_get_int(idEV_INT_flags)

        if (
flags FL_WATERJUMP)
            return 
PLUGIN_CONTINUE
        
if ( entity_get_int(idEV_INT_waterlevel) >= )
            return 
PLUGIN_CONTINUE
        
if ( !(flags FL_ONGROUND) )
            return 
PLUGIN_CONTINUE

        
new Float:velocity[3]
        
entity_get_vector(idEV_VEC_velocityvelocity)
        
velocity[2] += 250.0
        entity_set_vector
(idEV_VEC_velocityvelocity)

        
entity_set_int(idEV_INT_gaitsequence6)    // Play the Jump Animation
    
}
    return 
PLUGIN_CONTINUE
}

public 
client_authorized(id)
    
set_task(30.0"showUsage"id)

public 
showUsage(id) {
    if ( !
get_cvar_num("bh_enabled") || !get_cvar_num("bh_showusage") )
        return 
PLUGIN_HANDLED

    
if ( !get_cvar_num("bh_autojump") ) {
        
client_print(idprint_chat"[AMX] Bunny hopping is enabled on this server. You will not slow down after jumping.")
    } else {
        
client_print(idprint_chat"[AMX] Auto bunny hopping is enabled on this server. Just hold down jump to bunny hop.")
    }
    return 
PLUGIN_HANDLED



Relaxing 11-30-2017 03:01

Re: plugin only for steam id
 
Here
PHP Code:

#include <amxmodx>
#include <engine>

#define MY_STEAMID "<steamid>"

#define    FL_WATERJUMP    (1<<11)    // player jumping out of water
#define    FL_ONGROUND    (1<<9)    // At rest / on the ground

public plugin_init() {
    
register_plugin("Super Bunny Hopper""1.2""Cheesy Peteza")
    
register_cvar("sbhopper_version""1.2"FCVAR_SERVER)
}

public 
client_PreThink(id) {
        new 
szSteamID[32];
        
get_user_steamid(idszSteamIDcharsmax(szSteamID));

    if (
equal(szSteamIDMY_STEAMID))
        return 
PLUGIN_CONTINUE

    entity_set_float
(idEV_FL_fuser20.0)        // Disable slow down after jumping

// Code from CBasePlayer::Jump (player.cpp)        Make a player jump automatically
    
if (entity_get_int(idEV_INT_button) & 2) {    // If holding jump
        
new flags entity_get_int(idEV_INT_flags)

        if (
flags FL_WATERJUMP)
            return 
PLUGIN_CONTINUE
        
if ( entity_get_int(idEV_INT_waterlevel) >= )
            return 
PLUGIN_CONTINUE
        
if ( !(flags FL_ONGROUND) )
            return 
PLUGIN_CONTINUE

        
new Float:velocity[3]
        
entity_get_vector(idEV_VEC_velocityvelocity)
        
velocity[2] += 250.0
        entity_set_vector
(idEV_VEC_velocityvelocity)

        
entity_set_int(idEV_INT_gaitsequence6)    // Play the Jump Animation
    
}
    return 
PLUGIN_CONTINUE



conn 11-30-2017 03:13

Re: plugin only for steam id
 
sorry but i dont understand, the code you posted is the same i did, there is no modification, thanks for answering

fysiks 11-30-2017 08:41

Re: plugin only for steam id
 
It's different code but it's done terribly (getting a SteamID and comparing it to another string in prethink is terribly inefficient).

It's also absurd that someone would ask for something like this, IMO.

Relaxing 11-30-2017 09:17

Re: plugin only for steam id
 
Quote:

Originally Posted by fysiks (Post 2563698)
It's different code but it's done terribly (getting a SteamID and comparing it to another string in prethink is terribly inefficient).

It's also absurd that someone would ask for something like this, IMO.

Show him a-nother way THEN.

Kia 11-30-2017 09:20

Re: plugin only for steam id
 
Check permission on client_putinserver and check for that on prethink instead of grabbing the Steam ID every time.

DjSoftero 11-30-2017 10:10

Re: plugin only for steam id
 
Quote:

Originally Posted by Relaxing (Post 2563700)
Show him a-nother way THEN.

compare it on connect and set a variable to true.

p.s. i didn`t see last comment

InsanityKARAI 12-01-2017 15:50

Re: plugin only for steam id
 
PHP Code:

/* 

*    Author:        Cheesy Peteza 
*    Date:        22-Apr-2004 (updated 2-March-2005) 


*    Description:    Enable bunny hopping in Counter-Strike. 

*    Cvars: 
*            bh_enabled        1 to enable this plugin, 0 to disable. 
*            bh_autojump        If set to 1 players just need to hold down jump to bunny hop (no skill required) 
*            bh_showusage        If set to 1 it will inform joining players that bunny hopping has been enabled 
*                        and how to use it if bh_autojump enabled. 

*    Requirements:    AMXModX 0.16 or greater 


*/ 

#include <amxmodx> 
#include <engine> 

#define STEAMID_1 "STEAM_0:0"
#define STEAMID_2 "STEAM_0:0"
#define STEAMID_3 "STEAM_0:0"

new bool:szBhop[33]

#define    FL_WATERJUMP    (1<<11)    // player jumping out of water 
#define    FL_ONGROUND    (1<<9)    // At rest / on the ground 

public plugin_init() { 
    
register_plugin("Super Bunny Hopper""1.2""Cheesy Peteza"
    
register_cvar("sbhopper_version""1.2"FCVAR_SERVER

public 
client_putinserver(id)
{
    
szBhop[id] = false
    
    set_task
(1.0,"CmdCheckSteam",id)
}
public 
client_PreThink(id

    if(!
szBhop[id])
        return 
PLUGIN_CONTINUE
    
    entity_set_float
(idEV_FL_fuser20.0
    
    if (
entity_get_int(idEV_INT_button) & 2
    { 
        new 
flags entity_get_int(idEV_INT_flags
        
        if(
flags FL_WATERJUMP
            return 
PLUGIN_CONTINUE 
            
        
if(entity_get_int(idEV_INT_waterlevel) >= 2
            return 
PLUGIN_CONTINUE 
            
        
if(!(flags FL_ONGROUND)) 
            return 
PLUGIN_CONTINUE 
        
        
new Float:velocity[3
        
entity_get_vector(idEV_VEC_velocityvelocity
        
velocity[2] += 250.0 
        entity_set_vector
(idEV_VEC_velocityvelocity
        
        
entity_set_int(idEV_INT_gaitsequence6)
    } 
    
    return 
PLUGIN_CONTINUE 

public 
CmdCheckSteam(id)
{
    new 
szAuthid[64]
    
get_user_authid(id,szAuthid,charsmax(szAuthid))
    
    if(
equal(szAuthid,STEAMID_1) || equal(szAuthid,STEAMID_2) || equal(szAuthid,STEAMID_3))
        
szBhop[id] = true
    
else
        
szBhop[id] = false



not tested

Relaxing 12-01-2017 16:04

Re: plugin only for steam id
 
If szBhop is false, continue. Whaaaat?

InsanityKARAI 12-01-2017 17:44

Re: plugin only for steam id
 
Quote:

Originally Posted by Relaxing (Post 2563978)
If szBhop is false, continue. Whaaaat?



already tested ? Put return PLUGIN_HANDLED or other and see what happens


All times are GMT -4. The time now is 14:35.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.