Raised This Month: $ Target: $400
 0% 

Need help with VIP Plugin.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ITGurra
Junior Member
Join Date: Nov 2015
Old 11-23-2015 , 10:49   Need help with VIP Plugin.
Reply With Quote #1

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);
}

Last edited by ITGurra; 11-23-2015 at 15:35. Reason: Updated!
ITGurra is offline
BYSergey
Member
Join Date: Dec 2010
Location: Doneck City
Old 11-24-2015 , 11:24   Re: Need help with VIP Plugin.
Reply With Quote #2

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.");
			}

Last edited by BYSergey; 11-24-2015 at 11:25.
BYSergey is offline
Send a message via Skype™ to BYSergey
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:07.


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