AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help with /spec plugin . (https://forums.alliedmods.net/showthread.php?t=296418)

Skyliner 04-20-2017 12:12

Help with /spec plugin .
 
Hey lads, so, I got the code.
I modified an ond plugin but no luck.
So, I wanna make this plugin to only use the command /spec and /back only admins with immunity, with flag "a" .

I tried with "register_concmd("say /spec", "spec", ADMIN_LEVEL_C)" but no luck.
The code it's don't here.
Any help please?
Thanks!

Code:


#include <amxmodx>
#include <cstrike>
#include <fun>

#define PLUGIN "Spectator"
#define VERSION "1.0.0"
#define AUTHOR "AlexN"

new CsTeams:zTeam[33]
new zDeath[33]

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_concmd("say /spec", "spec", ADMIN_LEVEL_C)
    register_concmd("say_team /spec", "spec", ADMIN_LEVEL_C)       
    register_concmd("say /back", "back", ADMIN_LEVEL_C)
    register_concmd("say_team /back", "back", ADMIN_LEVEL_C)
       
        //register_clcmd("say_team /back", "back", ADMIN_LEVEL_C)
       
}

public cmdExample(id, level, cid)
{
    if( (get_user_flags(id) & level) != level )
    {
        // User does NOT have both flags
        return PLUGIN_HANDLED
    }
   
    // User has both flags


public client_putinserver(id)
    set_task(20.0,"rule",id)


public spec(id)
{
    zDeath[id] = cs_get_user_deaths(id)
    if(cs_get_user_team(id) == CS_TEAM_SPECTATOR) return 1;
    else
    zTeam[id] = cs_get_user_team(id)
    cs_set_user_team(id, CS_TEAM_SPECTATOR)
    user_kill(id, 1)
    return 0;
}

public back(id)
{
    if(cs_get_user_team(id) == CS_TEAM_SPECTATOR)
    cs_set_user_team(id, zTeam[id])
    cs_set_user_deaths(id, zDeath[id])

}

public rule(id)
{
    client_print(id,print_chat,"[WAR3.FGSCS.RO] Scrie /spec daca vrei sa treci la SPECTATOR (valabil doar pentru admini si vip)."),
        client_print(id,print_chat,"[WAR3.FGSCS.RO] Scrie /back ca sa revii inapoi in echipa (valabil doar pentru admini si vip).")
}


CrazY. 04-20-2017 12:54

Re: Help with /spec plugin .
 
Use cmd_access (amxmisc.Inc), don't get_user_flags().

OciXCrom 04-20-2017 13:27

Re: Help with /spec plugin .
 
Or you can try my /spec plugin - https://github.com/OciXCrom/GoSpec/archive/master.zip
By default it's on flag "e", but you can change it with the cvar gospec_spec_flag.

Skyliner 04-20-2017 13:34

Re: Help with /spec plugin .
 
Quote:

Originally Posted by OciXCrom (Post 2513876)
Or you can try my /spec plugin - https://github.com/OciXCrom/GoSpec/archive/master.zip
By default it's on flag "e", but you can change it with the cvar gospec_spec_flag.

Oh, nice.
Thanks for the plugin and for the help :) .


All times are GMT -4. The time now is 09:37.

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