Senior Member
Join Date: Dec 2012
Location: Portugal
|
06-23-2016
, 07:39
[CS:GO] VIP menu spawn problem
|
#1
|
So i find this plugin in AlliedModders and i decided to correct it myself, but i found a problem that i can't find the solution.
The plugin is a VIP menu which has 5 choices, to have an m4a4+deagle in the round start, m4a1-S+deagle, awp+deagle or ak47+deagle. the 5th choice is to use the command !vipres for respawn.
The problem is that when vip's respawn, they can use the menu again, and they can respawn all the time.
Code:
Code:
#include <sourcemod>
#include <cstrike>
#include <sdktools>
#include <sdkhooks>
#pragma tabsize 0
#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;
new g_PlayerRespawn[MAXPLAYERS+1] = 0;
public Plugin:myinfo =
{
name = "VIP Plugin",
author = "ITGurra",
description = "Vip Plugin that gives access to gravity and respawn!",
version = "2.0",
url = ""
}
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, "[ HouseGaming ]\n.::VIP MENU::.");
AddMenuItem(VMenu, "M4A4", "m4a4");
AddMenuItem(VMenu, "M4A1", "m4a1")
AddMenuItem(VMenu, "AK47", "ak47");
AddMenuItem(VMenu, "AWP", "awp");
AddMenuItem(VMenu, "RESPAWN", "+1 respawn");
SetMenuExitButton(VMenu, true);
DisplayMenu(VMenu, client, 0);
return;
return Plugin_Handled;
}
else
{
PrintToChat(client, "\x04[ HouseGaming ]\x01 Tu não es \x03VIP\x01.");
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, "M4A4"))
{
GivePlayerItem(client, "weapon_m4a1");
GivePlayerItem(client, "weapon_deagle");
return;
}
else if(StrEqual(item, "M4A1"))
{
GivePlayerItem(client, "weapon_m4a1_silencer");
GivePlayerItem(client, "weapon_deagle");
return;
}
else if(StrEqual(item, "AK47"))
{
GivePlayerItem(client, "weapon_ak47");
GivePlayerItem(client, "weapon_deagle");
return;
}
else if(StrEqual(item, "AWP"))
{
GivePlayerItem(client, "weapon_awp");
GivePlayerItem(client, "weapon_deagle");
return;
}
else if(StrEqual(item, "RESPAWN"))
{
g_PlayerRespawn[client] == 1;
return;
}
}
else if(action == MenuAction_End)
{
CloseHandle(VMenu)
}
}
public Action:VipRespawn(client, args)
{
if (IsPlayerGenericAdmin(client))
{
if (g_PlayerRespawn[client] > 0)
{
CS_RespawnPlayer(client);
g_PlayerRespawn[client] == 0;
}
else
{
PrintToChat(client, "\x04[ HouseGaming ]\x01 Não tens mais \x04respawn's\x01 , espera te ao proximo mapa.");
}
}
}
public Action:PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if(GetClientTeam(client) > CS_TEAM_SPECTATOR && IsPlayerGenericAdmin(client))
{
if(GameRules_GetProp("m_totalRoundsPlayed") > 0) // show menu on third round ?
{
VIP(client, 0); // Use console command callback
}
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));
}
return Plugin_Handled;
}
bool:IsPlayerGenericAdmin(client)
{
return CheckCommandAccess(client, "generic_admin", ADMFLAG_RESERVATION, false);
}
__________________
Last edited by andrept4; 06-23-2016 at 07:41.
|
|