AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Fastspectate plugin help (https://forums.alliedmods.net/showthread.php?t=337396)

maNIaRO 04-18-2022 09:00

Fastspectate plugin help
 
Hi everybody,
I have this fastspectate plugin on my server

Code:

#include <amxmodx>
#include <cstrike>

#include <colorchat>
#include <fun>

#pragma semicolon 1

static const PLUGIN_NAME[]        = "Fast Spectate";
static const PLUGIN_AUTHOR[]        = "sPuf ?";
static const PLUGIN_VERSION[]        = "2.0";

new gReturn[33],gDeaths[33],gFrags[33];

new cvar_score,cvar_msg,cvar_spawn;

public plugin_init() {
        register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
       
        cvar_score = register_cvar("fs_score","1");
        cvar_msg = register_cvar("fs_message","1");
        cvar_spawn = register_cvar("fs_spawn","1");
       
        register_clcmd("say /spec","saySpec");
        register_clcmd("say_team /spec","saySpec");
       
        register_clcmd("say /back","sayBack");
        register_clcmd("say_team /back","sayBack");       
}
public saySpec(id) {
        new team = get_user_team(id);
        switch(team) {
                case 1: {
                        gReturn[id] = 1;
                }
                case 2: {
                        gReturn[id] = 2;
                }
                case 3: {
                        if(get_pcvar_num(cvar_msg)) {       
                                ColorChat(id,RED,"[^x04PLOIESTI^x01] You are already spectator!");
                        }
                        return PLUGIN_HANDLED;
                }
        }
        if(get_pcvar_num(cvar_score) == 1) {       
                gFrags[id] = get_user_frags(id);
                gDeaths[id] = get_user_deaths(id);
        }
        if(is_user_alive(id)) {
                user_silentkill(id);
                cs_set_user_team(id,3);
                if(get_pcvar_num(cvar_msg)) {       
                        ColorChat(id,RED,"^x01[^x04PLOIESTI^x01] You have been transferred to ^x03Spectators^x01!");
                        ColorChat(id,RED,"^x01[^x04PLOIESTI^x01] Type in chat ^x04^"/back^" ^x01to be transferred in your last team!");
                }
                return PLUGIN_HANDLED;
        } else {
                cs_set_user_team(id,3);
                if(get_pcvar_num(cvar_msg)) {       
                        ColorChat(id,RED,"^x01[^x04PLOIESTI^x01] You have been transferred to ^x03Spectators^x01!");
                        ColorChat(id,RED,"^x01[^x04PLOIESTI^x01] Type in chat ^x04^"/back^" ^x01to be transferred in your last team!");
                }
                return PLUGIN_HANDLED;
        }
        return PLUGIN_CONTINUE;
}
public sayBack(id) {
        if(!(get_user_team(id) == 3) || is_user_alive(id)) {
                if(get_pcvar_num(cvar_msg)) {       
                        ColorChat(id,RED,"^x01[^x04PLOIESTI^x01] You can use this command only after you typed ^x04/spec^x01 If you want to join a team, type in console ^x04jointeam");
                        ColorChat(id,RED,"^x01[^x04PLOIESTI^x01] Type in chat ^x04^"/spec^" ^x01to be transferred on ^x03Spectators^x01!");
                        return PLUGIN_HANDLED;
                }
        } else {
                switch(gReturn[id]) {
                        case 1: {
                                cs_set_user_team(id,1);
                                if(get_pcvar_num(cvar_msg)) {
                                        ColorChat(id,RED,"^x01[^x04PLOIESTI^x01] You have been transferred to ^x03Terrorist^x01!");
                                        ColorChat(id,RED,"^x01[^x04PLOIESTI^x01] Type in chat ^x04^"/spec^" ^x01to be transferred to ^x03Spectators^x01!");
                                }
                                if(get_pcvar_num(cvar_score)) {       
                                        cs_set_user_deaths(id, gDeaths[id]);
                                        set_user_frags(id, gFrags[id]);
                                        cs_set_user_deaths(id, gDeaths[id]);
                                        set_user_frags(id, gFrags[id]);
                                        ColorChat(id,RED,"^x01[^x04PLOIESTI^x01] Your score is ^x04%d^x01-^x04%d ^x01!",gFrags[id],gDeaths[id]);
                                }
                                if(get_pcvar_num(cvar_spawn)) {
                                        spawn(id);
                                }
                                return PLUGIN_HANDLED;
                        }
                        case 2: {
                                cs_set_user_team(id,2);
                                if(get_pcvar_num(cvar_msg)) {
                                        ColorChat(id,RED,"^x01[^x04PLOIESTI^x01] You have been transferred to ^x03Counter-Terrorist^x01!");
                                        ColorChat(id,RED,"^x01[^x04PLOIESTI^x01] Type in chat ^x04^"/spec^" ^x01to be transferred to ^x03Spectators^x01!");
                                }
                                if(get_pcvar_num(cvar_score)) {       
                                        cs_set_user_deaths(id, gDeaths[id]);
                                        set_user_frags(id, gFrags[id]);
                                        cs_set_user_deaths(id, gDeaths[id]);
                                        set_user_frags(id, gFrags[id]);
                                        ColorChat(id,RED,"^x01[^x04PLOIESTI^x01] Your score is ^x04%d^x01-^x04%d ^x01!",gFrags[id],gDeaths[id]);
                                }
                                if(get_pcvar_num(cvar_spawn)) {
                                        spawn(id);
                                }
                                return PLUGIN_HANDLED;
                        }
                }
        }
        return PLUGIN_CONTINUE;
}
public client_putinserver(id) {
        gDeaths[id] = 0;
        gFrags[id] = 0;
        gReturn[id] = 0;
}
public client_disconnect(id) {
        gDeaths[id] = 0;
        gFrags[id] = 0;
        gReturn[id] = 0;
}

Seems that some of my players/admins are quite smart in finding bugs or "cheating" the system :)
If one player dies in battle :) he types in chat /spec and then /back and respawn nice and easy quite alive.

Can I get help from some of you please, to make it when they type /back, to be dead, not alive?
Or any other idea to fix this issue?

Thanks

JocAnis 04-18-2022 10:09

Re: Fastspectate plugin help
 
register_clcmd("say /back","sayBack");
register_clcmd("say_team /back","sayBack");

>>

//register_clcmd("say /back","sayBack");
//register_clcmd("say_team /back","sayBack");

zXCaptainXz 04-18-2022 10:27

Re: Fastspectate plugin help
 
Disable the cvar fs_spawn, add this to amxx.cfg

fs_spawn 0

maNIaRO 04-18-2022 18:11

Re: Fastspectate plugin help
 
Quote:

Originally Posted by JocAnis (Post 2777126)
register_clcmd("say /back","sayBack");
register_clcmd("say_team /back","sayBack");

>>

//register_clcmd("say /back","sayBack");
//register_clcmd("say_team /back","sayBack");

Yeah, small advice: don't speak if you don't bring any value with those words. Same with your reply.

Quote:

Originally Posted by zXCaptainXz (Post 2777130)
Disable the cvar fs_spawn, add this to amxx.cfg

fs_spawn 0

Thanks zXCaptainXz, problem solved.

JocAnis 04-19-2022 18:41

Re: Fastspectate plugin help
 
Quote:

Originally Posted by maNIaRO (Post 2777174)
Yeah, small advice: don't speak if you don't bring any value with those words. Same with your reply.

you wanted to disable say /back command, and i posted it for you...no need to act smart when someone tries to help you

maNIaRO 04-19-2022 18:48

Re: Fastspectate plugin help
 
Quote:

Originally Posted by JocAnis (Post 2777274)
you wanted to disable say /back command, and i posted it for you...no need to act smart when someone tries to help you

If english is too hard for you, I will repeat my message:
"When they type /back to be dead, not alive"
If I say "when they type", for you means I want to disable that command?

Craxor 04-19-2022 23:15

Re: Fastspectate plugin help
 
You could just check if the user is alive and kill him .

kww 04-20-2022 01:09

Re: Fastspectate plugin help
 
Quote:

Originally Posted by Craxor (Post 2777299)
You could just check if the user is alive and kill him .

no need to do useless actions. There was a cVar to disable respawn. But i dont know why the author decided to add such thing :?
I think they could add some timer to prevent respawn after timer end

Craxor 04-20-2022 13:25

Re: Fastspectate plugin help
 
Quote:

Originally Posted by kww (Post 2777308)
no need to do useless actions. There was a cVar to disable respawn. But i dont know why the author decided to add such thing :?
I think they could add some timer to prevent respawn after timer end

Kww, auto respawn and the plugin his trying to make are two different things so is only natural they will interfere one with each other .

Indeed, if the cvar change will solve the problem, no need to kill the user.

maNIaRO 04-20-2022 13:31

Re: Fastspectate plugin help
 
As I said in my last post. Problem solved.
It was indeed that cvar which I didn't see it in sma and didn't put it in amxx.cfg.

Please stop wasting your energy replying here.

Thanks again.


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

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