Покупка перерождения

Тема в разделе "Запросы", создана пользователем ProMT, 22 авг 2011.

  1. ProMT

    ProMT

    Сообщения:
    50
    Симпатии:
    0
    Кому не сложно слегка изменить плагин.
    Смысл этого плагина: Покупка перерождения, то есть после смерти ты можешь возрадиться за определённую сумму.

    Помогите кто может настроить его чтоб функцию(просто ведя команду в чате) перерождения мог использовать администратор с определённым уровнем один раз за раунд.

    Пожалуйста, кому не сложно.

    Код:
    #include <sourcemod>
    #include <cstrike>
    
    #define NAME "CSS: Buy relive"
    #define VERSION "1.0"
    
    new Handle:sm_buy_relive_enabled;
    new Handle:sm_buy_relive_cost;
    new Handle:sm_buy_relive_message;
    
    public Plugin:myinfo = {
    	name = NAME,
    	author = "Devzirom",
    	description = "Allows players to buy relive(respawn)",
    	version = VERSION,
    	url = "www.sourcemod.com"
    }
    
    public OnPluginStart() {
    	sm_buy_relive_enabled = CreateConVar("sm_buy_relive_enabled", "1", "\"1\" = \"Buy relive\" plugin is enabled, \"0\" = \"Buy relive\" plugin is disabled");
    	sm_buy_relive_cost = CreateConVar("sm_buy_relive_cost", "5000.0", "Set the price for the relive(respawn)", FCVAR_REPLICATED, true, 0.0, true, 16000.0);
    	sm_buy_relive_message = CreateConVar("sm_buy_relive_message", "1", "\"1\" = \"Buy relive\" message is enabled, \"0\" = \"Buy relive\" message is disabled");
    	
    	CreateConVar("sm_buy_relive_version", VERSION, NAME, FCVAR_PLUGIN|FCVAR_DONTRECORD|FCVAR_SPONLY|FCVAR_NOTIFY);
    	
    	RegConsoleCmd("say", Command_Say);
    	RegConsoleCmd("say_team", Command_Say);
    }
    
    public OnClientPutInServer(client) {
    	if(GetConVarInt(sm_buy_relive_message) == 1 && GetConVarInt(sm_buy_relive_enabled) == 1) {
    		PrintToChat(client, "[SM] To relive, write to the chat: relive/respawn/buyrelive/buyrespawn");
    		PrintToChat(client, "[SM] The price for the relive: %d$", RoundToCeil(GetConVarFloat(sm_buy_relive_cost)));
    	}
    }
    
    public Action:Command_Say(client, args) {
    	if(client == 0 && !IsDedicatedServer())
    		client = 1;
    	
    	if(client < 1 || GetConVarInt(sm_buy_relive_enabled) != 1)
    		return Plugin_Continue;
    		
    	decl String:command[32], String:value[32];
    	
    	GetCmdArg(0, command, sizeof(command));
    	GetCmdArg(1, value, sizeof(value));
    	
    	if(StrEqual(value, "relive") || StrEqual(value, "respawn")
    	|| StrEqual(value, "buyrespawn") || StrEqual(value, "buyrelive")) {
    		new team = GetClientTeam(client);
    		
    		if(team != CS_TEAM_CT && team != CS_TEAM_T) {
    			PrintToChat(client, "[SM] This command is not available to spectators");
    			return Plugin_Handled;
    		}
    		
    		if(IsPlayerAlive(client)) {
    			PrintToChat(client, "[SM] Life is short, try later");
    			return Plugin_Handled;
    		}
    		
    		new cost = RoundToCeil(GetConVarFloat(sm_buy_relive_cost));
    		new money = GetEntProp(client, Prop_Send, "m_iAccount");
    		
    		if(money < cost) {
    			PrintToChat(client, "[SM] You have insufficient funds. The price for the relive: %d$", cost);
    			return Plugin_Handled;
    		}
    		
    		SetEntProp(client, Prop_Send, "m_iAccount", money - cost);
    		CS_RespawnPlayer(client);
    		
    		return Plugin_Handled;
    	}
    	
    	return Plugin_Continue;
    }
     
  2. FrozDark

    FrozDark Команда сайта HLMod Модератор

    Сообщения:
    1.761
    Симпатии:
    1.916
    Re: Помогите слегка изменить плагин

    Код:
    #include <sourcemod>
    #include <cstrike>
    
    #define NAME "CSS: Buy relive"
    #define VERSION "1.0"
    
    new Handle:sm_buy_relive_enabled;
    new Handle:sm_buy_relive_cost;
    new Handle:sm_buy_relive_message;
    
    public Plugin:myinfo = {
    	name = NAME,
    	author = "Devzirom",
    	description = "Allows players to buy relive(respawn)",
    	version = VERSION,
    	url = "www.sourcemod.com"
    }
    
    public OnPluginStart() {
    	sm_buy_relive_enabled = CreateConVar("sm_buy_relive_enabled", "1", "\"1\" = \"Buy relive\" plugin is enabled, \"0\" = \"Buy relive\" plugin is disabled");
    	sm_buy_relive_cost = CreateConVar("sm_buy_relive_cost", "5000.0", "Set the price for the relive(respawn)", FCVAR_REPLICATED, true, 0.0, true, 16000.0);
    	sm_buy_relive_message = CreateConVar("sm_buy_relive_message", "1", "\"1\" = \"Buy relive\" message is enabled, \"0\" = \"Buy relive\" message is disabled");
    	
    	CreateConVar("sm_buy_relive_version", VERSION, NAME, FCVAR_PLUGIN|FCVAR_DONTRECORD|FCVAR_SPONLY|FCVAR_NOTIFY);
    	
    	RegConsoleCmd("sm_relive", Command_Relive);
    	RegConsoleCmd("sm_respawn", Command_Relive);
    	RegConsoleCmd("sm_buyrespawn", Command_Relive);
    	RegConsoleCmd("sm_buyrelive", Command_Relive);
    }
    
    public OnClientPutInServer(client) {
    	if(GetConVarInt(sm_buy_relive_message) == 1 && GetConVarInt(sm_buy_relive_enabled) == 1) {
    		PrintToChat(client, "[SM] To relive, write to the chat: !relive/!respawn/!buyrelive/!buyrespawn");
    		PrintToChat(client, "[SM] The price for the relive: %d$", GetConVarInt(sm_buy_relive_cost));
    	}
    }
    
    public Action:Command_Relive(client, args) {
    	if(!client || GetConVarInt(sm_buy_relive_enabled) != 1)
    		return Plugin_Continue;
    		
    	new team = GetClientTeam(client);
    		
    	if(team == CS_TEAM_SPECTATOR) {
    		PrintToChat(client, "[SM] This command is not available to spectators");
    		return Plugin_Handled;
    	};
    		
    	if(IsPlayerAlive(client)) {
    		PrintToChat(client, "[SM] Life is short, try later");
    		return Plugin_Handled;
    	}
    	
    	new money = GetEntProp(client, Prop_Send, "m_iAccount");
    	new cost = GetConVarInt(sm_buy_relive_cost);
    	if(money < cost) {
    		PrintToChat(client, "[SM] You have insufficient funds. The price for the relive: %d$", cost);
    		return Plugin_Handled;
    	}
    		
    	SetEntProp(client, Prop_Send, "m_iAccount", money - cost);
    	CS_RespawnPlayer(client);
    		
    	return Plugin_Handled;
    }
     
    ProMT и Andrey нравится это.
  3. ProMT

    ProMT

    Сообщения:
    50
    Симпатии:
    0
    Re: Помогите слегка изменить плагин

    [​IMG]
     
    Последнее редактирование: 22 авг 2011