Raised This Month: $51 Target: $400
 12% 

How to forbid reviving for spectators


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
2NASTY4U
Senior Member
Join Date: Mar 2014
Old 03-23-2014 , 13:07   How to forbid reviving for spectators
Reply With Quote #1

Hi,

the following code is from Franc1sco's jail awards plugin. It offers the possibility to !revive for 6 credits. But spectators also can revive. I want to forbid this. How to do?

A little help would be nice

Code:
public Action:Resucitar(client,args)
{
    if(client == 0)
    {
        PrintToServer("%t","Command is in-game only");
        return;
    }

    if (!IsPlayerAlive(client))
        {
              if (g_iCredits[client] >= 6)
              {

                      CS_RespawnPlayer(client);

                      g_iCredits[client] -= 6;

                      decl String:nombre[32];
                      GetClientName(client, nombre, sizeof(nombre));

                      PrintToChatAll("\x04[!awards] \x05Der Spieler\x03 %s \x05wurde wiederbelebt!", nombre);
                      PrintCenterTextAll("Spieler %s wurde wiederbelebt!", nombre);

              }
              else
              {
                 PrintToChat(client, "\x04[!awards] \x05Deine Credits: %i (Du hast nicht genügend Credits, benötigt werden 6 Credits)", g_iCredits[client]);
              }
        }
        else
        {
            PrintToChat(client, "\x04[!awards] \x05Du musst tot sein, um Dich wiederbeleben zu können!");
        }
}
Best regards
2NASTY4U
2NASTY4U is offline
Franc1sco
Veteran Member
Join Date: Oct 2010
Location: Spain (Madrid)
Old 03-23-2014 , 14:55   Re: How to forbid reviving for spectators
Reply With Quote #2

Code:
public Action:Resucitar(client,args)
{
    if(client == 0)
    {
        PrintToServer("%t","Command is in-game only");
        return;
    }

    if (!IsPlayerAlive(client) && (GetClientTeam(client) == 2 || GetClientTeam(client) == 3))
        {
              if (g_iCredits[client] >= 6)
              {

                      CS_RespawnPlayer(client);

                      g_iCredits[client] -= 6;

                      decl String:nombre[32];
                      GetClientName(client, nombre, sizeof(nombre));

                      PrintToChatAll("\x04[!awards] \x05Der Spieler\x03 %s \x05wurde wiederbelebt!", nombre);
                      PrintCenterTextAll("Spieler %s wurde wiederbelebt!", nombre);

              }
              else
              {
                 PrintToChat(client, "\x04[!awards] \x05Deine Credits: %i (Du hast nicht genügend Credits, benötigt werden 6 Credits)", g_iCredits[client]);
              }
        }
        else
        {
            PrintToChat(client, "\x04[!awards] \x05Du musst tot sein, um Dich wiederbeleben zu können!");
        }
}
__________________
Veteran Coder -> Activity channel
Coding on CS2 and taking paid and free jobs.

Contact: Steam, Telegram or discord ( franug ).

You like my work? +Rep in my steam profile comments or donate.

Franc1sco is offline
Send a message via MSN to Franc1sco
2NASTY4U
Senior Member
Join Date: Mar 2014
Old 03-23-2014 , 17:34   Re: How to forbid reviving for spectators
Reply With Quote #3

Ok, thanks for help. I did it this way now:

Code:
public Action:Resucitar(client,args)
{
    if(client == 0)
    {
        PrintToServer("%t","Command is in-game only");
        return;
    }
    
    if (GetClientTeam(client) == 2 || GetClientTeam(client) == 3)
        {
        if (!IsPlayerAlive(client))
            {
                if (g_iCredits[client] >= 6)
                {

                        CS_RespawnPlayer(client);

                        g_iCredits[client] -= 6;

                        decl String:nombre[32];
                        GetClientName(client, nombre, sizeof(nombre));

                        PrintToChatAll("\x04[!awards] \x05Der Spieler\x03 %s \x05wurde wiederbelebt!", nombre);
                        PrintCenterTextAll("Spieler %s wurde wiederbelebt!", nombre);

                }
                else
                {
                    PrintToChat(client, "\x04[!awards] \x05Deine Credits: %i (Du hast nicht genügend Credits, benötigt werden 6 Credits)", g_iCredits[client]);
                }
            }
            else
            {
                PrintToChat(client, "\x04[!awards] \x05Du musst tot sein, um Dich wiederbeleben zu können!");
            }
        }
        else
        {
            PrintToChat(client, "\x04[!awards] \x05Als Spectator kannst Du Dich nicht wiederbeleben!");
        }
}
2NASTY4U is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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