Tez bym porsil o ustawienie aby gdy wyswietla mi sie info o sprzedazy zeby bylo kolorowe.
Spoiler
/*
Sell Weapons
By Deviance - www.the-place.co.nr
.:about:.
Ever wanted to sell that Deagle you never use?
Tired of never having cash when you need it?
Well, then Sell Weapons is something for you
When you sell a weapon, you get back the cost of the weapon divided with SW_divide.
At the moment you can only sell primary and secondary weapons, nade support will be added.
.:Cvars:.
SW_enabled (D: 1) - Enables/Disables the plugin
SW_buyzone (D: 0) - If nonzero, the players need to be in a buyzone to sell weapons
SW_annonce (D: 120) - Time before it prints an annonce message, set to 0 to disable
SW_divide (D: 2) - Do not set to 0. Sets how much of the money you'll get when you sell a weapon (1 for the whole sum, 2 for half the money, 3 for third of the money ect ect)
.:Commands:.
Say /sell - Sells the weapon your currently holding.
.:Screenshots:.
http://www.youtube.com/watch?v=hRtLxXQSsD8 (Low Quality)
http://img250.imageshack.us/my.php?image=sell1fz4.png
.:To-Do:.
* Menu support [0% Done]
* Nade support [0% Done]
* Extra cash for ammo [0% Done]
.:F.A.Q:.
T.B.W
.:Version List:.
Quote:
* 1.0 - Original Version.
* 1.1 - Added SW_annonce and comments in code
* 1.2 - Added SW_divide
* 1.3 - Added so dead people can't sell weapons
* 1.4 - Changed the way of removing weapons (Thanks VEN)
.:Credits:.
Bo0m! - Original idea and code suggestions.
VEN - Weapon removing code.
*/
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <cstrike>
#define Plugin "Sell Weapons"
#define Version "1.4"
#define Author "Doombringer"
#define MAX_WEAPONS 33
new const g_prices[MAX_WEAPONS][] = {
"0",
"600",
"0",
"2750",
"0",
"3000",
"0",
"1400",
"3500",
"0",
"800",
"750",
"1700",
"4200",
"2000",
"2250",
"500",
"400",
"4750",
"1500",
"5750",
"1700",
"3100",
"1250",
"5000",
"0",
"650",
"3500",
"2500",
"0",
"2350",
"0",
"0"
}
new cvar, buyzone, annonce, divide //Pcvar stuff, makes life easier
public plugin_init() // Plugin_init(): Does all the "one-time" stuff. Called after plugin_precache().
{
register_plugin(Plugin, Version, Author) //Register's the plugin so it can be seen in amx_help
register_clcmd("say /sell", "cmd_sell") //Registers the command itself. So if someone say /sell the function will be executed
register_clcmd("say_team /sell", "cmd_sell") //Save as above but for team chat
cvar = register_cvar("SW_enabled", "1") //Registers the cvar SW_enabled, Default 1 (If nothing else is in server.cfg or any other .cfg file)
buyzone = register_cvar("SW_buyzone", "0") //Registers the cvar SW_buyzone, Default 0 (If nothing else is in server.cfg or any other .cfg file)
annonce = register_cvar("SW_annonce", "120") //Registers the cvar SW_annonce, Default 120 (If nothing else is in server.cfg or any other .cfg file)
divide = register_cvar("SW_divide", "2") //Registers the cvar SW_divide, Default 2 (If nothing else is in server.cfg or any other .cfg file)
if(get_pcvar_num(annonce) > 1) //If the pcvar annonce is higher then 1
set_task(get_pcvar_float(annonce), "print_annonce",_,_,_,"b") //Set a task to run the annonce function every get_pcvar_float(annonce) time
}
public print_annonce() //The function that shows the annonce
{
if(get_pcvar_num(annonce) < 1) //If it's lower then 1
return PLUGIN_CONTINUE //Make the plugin continue (Yes i know i should do remove_task() but this is better)
client_print(0, print_chat, "Want to sell your weapon? Say /sell") //Prints the message to everyones chat area
return PLUGIN_CONTINUE //Continue...
}
stock fm_find_ent_by_owner(index, const classname[], owner, jghgtype = 0) { // http://forums.alliedmods.net/showthread.php?t=28284
new strtype[11] = "classname", ent = index
switch (jghgtype) {
case 1: copy(strtype, 6, "target")
case 2: copy(strtype, 10, "targetname")
}
while ((ent = engfunc(EngFunc_FindEntityByString, ent, strtype, classname)) && pev(ent, pev_owner) != owner) {}
return ent
}
stock bool:fm_strip_user_gun(index, wid = 0, const wname[] = "") { // http://forums.alliedmods.net/showthread.php?t=28284
new ent_class[32]
if (!wid && wname[0])
copy(ent_class, 31, wname)
else {
new weapon = wid, clip, ammo
if (!weapon && !(weapon = get_user_weapon(index, clip, ammo)))
return false
get_weaponname(weapon, ent_class, 31)
}
new ent_weap = fm_find_ent_by_owner(-1, ent_class, index)
if (!ent_weap)
return false
engclient_cmd(index, "drop", ent_class)
new ent_box = pev(ent_weap, pev_owner)
if (!ent_box || ent_box == index)
return false
dllfunc(DLLFunc_Think, ent_box)
return true
}
public cmd_sell(id) //The whole main function
{
if(get_pcvar_num(cvar) < 1) //If the pcvar cvar is lower then one
return PLUGIN_CONTINUE //Continue...
if(get_pcvar_num(buyzone) == 1 && cs_get_user_buyzone(id) == 0) //If pcvar buyzone is equal to one and user is not in a buyzone
{
client_print(id, print_chat, "[Sell] You need to be in a buyzone to sell weapons!") //Prints a angry little message
return PLUGIN_HANDLED //And ends the function
}
if(!is_user_alive(id)) //Isn't he alive?!
{
client_print(id, print_chat, "[Sell] You need to be alive to sell weapons!") //Prints a angry little message
return PLUGIN_HANDLED //And ends the function
}
new temp, weapon = get_user_weapon(id, temp, temp) //Fills weapon with the current hold weapon (temp is a so called dummy)
new price = str_to_num(g_prices[weapon]) //Gets the price for the current weapon
if(price == 0) //If it's equal to zero
{
client_print(id, print_chat, "[Sell] Niemozesz tego sprzedac!") //Prints a angry little message
return PLUGIN_HANDLED //And ends the function
}
new weaponname[32] //Makes an array called weaponname, with a maximum of 32 - 1 chars
get_weaponname(weapon, weaponname, 31) //Gets the weapon name
new oldmoney = cs_get_user_money(id) //Gets the players money
new cash = clamp(oldmoney + (price / get_pcvar_num(divide)), 0, 16000) //clamps the total amount of cash, so it doesn't extend the 16000 limit
fm_strip_user_gun(id, weapon) //Calls the fm_strip_user_gun() stock
cs_set_user_money(id, cash) //Sets the money from cash
client_print(id, print_chat, "[Sell] You got %d$ for selling a %s", cs_get_user_money(id) - oldmoney, weaponname[7]) //Prints some info about what you got
return PLUGIN_HANDLED //Done
} //EOF
i [Sell] ma byc na zielono a reszta rółta
Prosil bym tez aby zostal dodane kolory do tego pluginu.
info bylo to w takim kolorze
[HPB] Gracze z pingiem wiekszym niz %sms zostana zbanowani! Czas bana aktualnie wynosi: %s minut
Spoiler
#include <amxmodx>
new HIGHPING_TIME = 1 // Czas po którym osoba z wysokim pingiem jest wyrzucana.
new HIGHPING_TESTS = 1 // Ilosc sprawdzen zanim cos zrobi.
new iNumTests[33], cvar_czasbana, cvar_pingmax
public plugin_init()
{
register_plugin("High Ping Baned PL","1.2","Mis")
cvar_czasbana = register_cvar("hpb_czasbana","5")
cvar_pingmax = register_cvar("hpb_pingmax","120")
if (HIGHPING_TIME < 2) HIGHPING_TIME = 1
if (HIGHPING_TESTS < 2) HIGHPING_TESTS = 1
return PLUGIN_CONTINUE
}
public client_disconnect(id)
{
remove_task(id)
return PLUGIN_CONTINUE
}
public client_putinserver(id)
{
iNumTests[id] = 0
if (!is_user_bot(id))
{
new param[1]
param[0] = id
set_task(30.0, "showWarn", id, param, 1)
}
return PLUGIN_CONTINUE
}
kickPlayer(id)
{
new czas = get_pcvar_num(cvar_czasbana)
new name[32]
get_user_name(id, name, 31)
new uID = get_user_userid(id)
server_cmd("amx_ban %s #%d Lagujesz", czas, uID)
client_cmd(id, "echo ^"[HPB] Przykro mi, masz zbyt wysoki ping. Sprobuj pozniej...^"; disconnect")
client_print(0, print_chat, "[HPB] %s zostal zbanowany za wysoki ping! Czas bana: %s minut", name, czas)
return PLUGIN_CONTINUE
}
public checkPing(param[])
{
new ping = get_pcvar_num(cvar_pingmax)
new id = param[0]
if ((get_user_flags(id) & ADMIN_IMMUNITY) || (get_user_flags(id) & ADMIN_RESERVATION))
{
remove_task(id)
client_print(id, print_chat, "[HPB] Masz Immunitet. Sprawdzanie pingu Cie nie obowiazuje.")
return PLUGIN_CONTINUE
}
new p, l
get_user_ping(id, p, l)
if (p > ping)
++iNumTests[id]
else
if (iNumTests[id] > 0) --iNumTests[id]
if (iNumTests[id] > HIGHPING_TESTS)
kickPlayer(id)
return PLUGIN_CONTINUE
}
public showWarn(param[])
{
new czas = get_pcvar_num(cvar_czasbana)
new ping = get_pcvar_num(cvar_pingmax)
client_print(param[0], print_chat, "[HPB] Gracze z pingiem wiekszym niz %sms zostana zbanowani! Czas bana aktualnie wynosi: %s minut", ping, czas)
set_task(float(HIGHPING_TIME), "checkPing", param[0], param, 1, "b")
return PLUGIN_CONTINUE
}
[warn=DarkGL]
Za zabawy reputacją - ![/warn]
Użytkownik DarkGL edytował ten post 03.11.2011 15:59