AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Need help with VIP Plugin. (https://forums.alliedmods.net/showthread.php?t=275153)

ITGurra 11-23-2015 10:49

Need help with VIP Plugin.
 
Hello all users on AlliedMods Forums!

I need some help with a vip plugin i am currently making.

I have this respawn feature and i would like all users to be able to respawn 3 times / map on my Jail CSGO Server. But right now all VIP's are sharing 3 respawns and it is does not reset respawns after map change.

I need help with:
  • Allow vip users to have 3 respawns each.
  • Reset respawns when mapchange!

Sorry for my bad English, i am from Sweden.

Help Much appreciated! Thanks!

Code:

#include <sourcemod>
#include <cstrike>
#include <sdktools>

#define VERSION        "1.0"
#define SPEC                1
#define TEAM1                2
#define TEAM2                3

new g_VipStatus[MAXPLAYERS+1] = 0;
new Handle:g_Health;
new Handle:g_Money;
new Handle:g_Armor;
PlayerRespawn = 3;

public Plugin:myinfo =
{
 name = "VIP Plugin",
 author = "ITGurra",
 description = "Vip Plugin that gives access to gravity and respawn!",
 version = 1.0,
 url = "http://mywebsite.nothing"
}

public OnPluginStart()
{
        HookEvent("player_spawn", PlayerSpawn);
        CreateConVar("sm_vip_version", VERSION, "VIP Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
        g_Health = CreateConVar("sm_vip_health", "120", "HP On Spawn");
        g_Money = CreateConVar("sm_vip_money", "1200", "Money On Spawn");
        g_Armor = CreateConVar("sm_vip_armor", "120", "Armor On Spawn");
        RegConsoleCmd("sm_vip", VIP);
        RegConsoleCmd("sm_vipres", VipRespawn, "VIP Respawn");
       
        AutoExecConfig(true, "sm_vip");
}

public OnClientDisconnect(client)
{
        g_VipStatus[client] = 0;
}

public Action:VIP(client, args)
{
        if (IsPlayerGenericAdmin(client))
        {
                new Handle:VMenu = CreateMenu(VipMenu);
                SetMenuTitle(VMenu, "VIP Menu");
                AddMenuItem(VMenu, "GRAVON", "Gravity On");
                AddMenuItem(VMenu, "GRAVOFF", "Gravity Off");
                SetMenuExitButton(VMenu, true);
                DisplayMenu(VMenu, client, 0);
                       
                return Plugin_Handled;
        }
        else
        {
                PrintToChat(client, "You are not a VIP member");
                return Plugin_Handled;
        }
}

public VipMenu(Handle:VMenu, MenuAction:action, client, position)
{
        if(action == MenuAction_Select)
        {
                decl String:item[20];
                GetMenuItem(VMenu, position, item, sizeof(item));
               
                if(StrEqual(item, "GRAVOFF"))
                {
                        SetEntityGravity(client, 0.0);
                        return;
                }       
                if(StrEqual(item, "GRAVON"))
                {
                        SetEntityGravity(client, 0.5);
                        return;
                }       
        }
        else if(action == MenuAction_End)
        {
                CloseHandle(VMenu)
        }
}
public Action:VipRespawn(client, args)
{
        if (IsPlayerGenericAdmin(client))
    {
                        if (PlayerRespawn > 0)
                        {
                                CS_RespawnPlayer(client);
                                PlayerRespawn--;
                        }
                        else
                        {
                                PrintToChat(client, "You have no respawns left.");
                        }
                }
    }
public Action:PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
        new client = GetClientOfUserId(GetEventInt(event, "userid"));
        if(IsPlayerGenericAdmin(client))
        {
                SetEntProp(client, Prop_Data, "m_iHealth", GetConVarInt(g_Health));
                SetEntProp(client, Prop_Send, "m_iAccount", GetConVarInt(g_Money));
                SetEntProp(client, Prop_Send, "m_ArmorValue", GetConVarInt(g_Armor));
        }
        else
        {
                return Plugin_Handled;
        }
        return Plugin_Handled;
}
bool:IsPlayerGenericAdmin(client)
{
        return CheckCommandAccess(client, "generic_admin", ADMFLAG_RESERVATION, false);
}


BYSergey 11-24-2015 11:24

Re: Need help with VIP Plugin.
 
i bad script,no understand this mod,no use csgo. But why no use
Code:

new PlayerRespawn[33]
                        if (PlayerRespawn[client] < 4)
                        {
                                CS_RespawnPlayer(client);
                                PlayerRespawn[client]++;
                        }else{
                                PrintToChat(client, "You have no respawns left.");
                        }



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

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