Jump to content

[Plugin-RF] Buy Respawn


LuK.ZEW #

Recommended Posts

Descriere: Cu acest plugin un player mort poate primi respawn contra cost .
Descarcare: Link AMXX - Link SMA

Nume: Buy Respawn
Versiune: 1.2
Autor: rodrigo286

Instalare:
1. Fisierul buy_respawn.sma il puneti in addons/amxmodx/scripting
2. Fisierul buy_respawn.amxx il puneti in addons/amxmodx/plugins
3. Intrati in fisierul addons/amxmodx/configs/plugins.ini si adaugati la urma:

buy_respawn

Cvars :

 

amxx_buyrespawn_enabled = 1/0 
  • Comanda pentru starea pluginului , 1 activat , respectiv 0 dezactivat
amxx_buyrespawn_cost = 0-16000 
  • Pretul folosirii acestei comenzi ( default 500 )
amxx_buyrespawn_per_round = 0-99 
  • Numarul maxim de respawn-uri pe tura de jucator (default 2 )
amxx_buyrespawn_message = 1/0
  • Mesajul cu detalii despre plugin activat (1) , respectiv dezactivat (0)

 

Comenzi publice :

  • !respawn
  • /respawn
  • Like 1
Link to comment
Share on other sites

 

/*

* Description *

 

Allows players to buy respawn to return to play again, it is possible to set the price.

 

Converted my plugin for Sourcemod:

 

 

 

* CVARs *

amxx_buyrespawn_enabled = 1/0 - plugin is enabled/disabled (def. 1)

amxx_buyrespawn_cost = 0-16000 - Set the price for the respawn (def. 500)

amxx_buyrespawn_per_round = 0-99 - Set the max respawns per round (def. 2)

amxx_buyrespawn_message = 1/0 plugin message is enabled/disabled (def. 1)

amxx_buyrespawn_version - current plugin version

 

* Commands *

!respawn

/respawn

 

* Changelog *

 

Version 1.0.0

Initial Release

 

Version 1.0.1

Updated with wickedd tips

Little clean code

 

Version 1.0.2

Now the plugin checks if the player is Spectator, to prevent bugs.

*/

 

/*

Libraries

*/

#include <amxmodx>

#include <hamsandwich>

#include <cstrike>

 

/*

Plugin info

*/

#define PLUGIN "Buy Respawn"

#define VERSION "1.0.2"

#define AUTHOR "Rodrigo286"

 

/*

Variables

*/

new gCost;

new gUses;

new gEnabled;

new gMessages;

new respawns[33];

 

public plugin_init()

{

register_plugin(PLUGIN, VERSION, AUTHOR)

 

/*

Cvars

*/

register_cvar("amxx_buy_respawn_version", VERSION, FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)

gEnabled = register_cvar("amxx_buy_respawn_enabled", "1") // Plugin is enbaled?

gCost = register_cvar("amxx_buy_respawn_cost", "500") // How much respawn cost?

gUses = register_cvar("amxx_buy_respawn_per_round", "2") // How many respawns allowed per round?

gMessages = register_cvar("amxx_buy_respawn_messages", "1") // Info messages enabled?

/*

Commands

*/

register_clcmd("say !respawn", "respawnCMD"); // Command to buy respawn

register_clcmd("say /respawn", "respawnCMD"); // Command to buy respawn

 

/*

Events

*/

register_event("HLTV", "LogEvent_RoundStart", "a", "1=0", "2=0");

}

 

public LogEvent_RoundStart()

{

arrayset(respawns, 0, sizeof(respawns));

}

 

public respawnCMD(client)

{

/*

Get player money

*/

new money = cs_get_user_money(client);

/*

Get respawn cost

*/

new cost = get_pcvar_num(gCost);

/*

Get respawn max uses allowed

*/

new uses = get_pcvar_num(gUses);

/*

Calculate payment value of respawn

*/

new payment = money - cost;

/*

Get message enabled cvar value

*/

new messages = get_pcvar_num(gMessages);

/*

Get if player is spector or unassigned

*/

if(get_user_team(client) == 3 || get_user_team(client) == 0)

{

if(messages != 0)

client_print(client, print_chat, "[AmxModX] Choose a team before purchasing a respawn.");

 

return PLUGIN_HANDLED;

}

 

if(get_pcvar_num(gEnabled) != 1)

{

if(messages != 0)

client_print(client, print_chat, "[AmxModX] Buy respawn is disabled at this time.");

 

return PLUGIN_HANDLED;

}

 

if(is_user_alive(client))

{

if(messages != 0)

client_print(client, print_chat, "[AmxModX] You need to be dead to buy a new life.");

 

return PLUGIN_HANDLED;

}

 

if(uses == respawns[client])

{

if(messages != 0)

client_print(client, print_chat, "[AmxModX] Have you ever reached the maximum usage released by round.");

 

return PLUGIN_HANDLED;

}

 

if(money < cost)

{

if(messages != 0)

client_print(client, print_chat, "[AmxModX] You dont have money to respawn, it costs $%d", cost);

 

return PLUGIN_HANDLED;

}

/*

Set user money to pay for respawn

*/

cs_set_user_money(client, payment);

/*

Spawn player using hamsandwich

*/

ExecuteHamB(Ham_CS_RoundRespawn, client);

/*

Add +1 to respawn uses

*/

respawns[client] += 1;

/*

Print message to player

*/

if(messages != 0)

client_print(client, print_chat, "[AmxModX] You bouth a new life for $%d of money", cost);

 

return PLUGIN_CONTINUE;

}

 

public client_connect(client)

{

/*

Reset respawn uses on player connect

*/

respawns[client] = 0;

}

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...