AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   How to forbid reviving for spectators (https://forums.alliedmods.net/showthread.php?t=237400)

2NASTY4U 03-23-2014 13:07

How to forbid reviving for spectators
 
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

Franc1sco 03-23-2014 14:55

Re: How to forbid reviving for spectators
 
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!");
        }
}


2NASTY4U 03-23-2014 17:34

Re: How to forbid reviving for spectators
 
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!");
        }
}



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

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