Jump to content

System monet bez HUD


-_-
 Share

Recommended Posts

  • Root
Nazwa pluginu: System monet

Opis pluginu: Plugin dodaje monety na serwer, które można zdobyć po zabiciu gracza, splantowaniu paki, uratowaniu hostów, itd. W tej wersji usunięto HUD

Instalacja pluginu: Kompilacja pluginów i Instalacja

Cvary:

cod_coins_friendlyfire "0" // 0 - nie dodaje monet za TeamKill (zabicie swojego); 1 - dodaje monety za TeamKill (zabicie swojego)



cod_coins_kill "1" // ilosc monet do dodania za zabojstwo

cod_coins_kill_vip "2" // ilosc monet do dodania za zabojstwo dla vipa

cod_coins_kill_hs "3" // ilosc monet do dodania za zabojstwo z headshootem

cod_coins_kill_hs_vip "6" // ilosc monet do dodania za zabojstwo z headshootem dla vipa



cod_coins_planted "1" // ilosc monet do dodania za podlozenie bomby

cod_coins_planted_vip "2" // ilosc monet do dodania za podlozenie bomby dla vipa

cod_coins_defused "1" // ilosc monet do dodania za rozbrojenie bomby

cod_coins_defused_vip "2" // ilosc monet do dodania za rozbrojenie bomby dla vipa



cod_coins_rescue_hostage "1" // ilosc monet do dodania za uratowanie zakladnika

cod_coins_rescue_hostage_vip "2" // ilosc monet do dodania za uratowanie zakladnika dla vipa

cod_coins_kill_hostage "2" // ilosc monet do odjecia za zabicie zakladnika

cod_coins_kill_hostage_vip "1" // ilosc monet do odjecia za zabicie zakladnika dla vipa

cod_coins_minplayers "2" // ilosc graczy od ktorej nastepuje zliczanie monet

cod_savetype // korzysta z ustawien głównego CoDa



// by wylaczyc wiecej monet dla vipa ustawiamy cvar _vip tak samo jak jego odpowiednik dla zwyklego gracza

// by wylaczyc dostawanie monet za dana rzecz ustawiamy odpowiedni cvar na 0


Komendy: Brak

Dodatkowe informacje: Flaga VIP: ADMIN_LEVEL_D - "p"

Link do pobrania: 



/*
CHANGELOG:
* 1.0.0 - pierwsze wydanie
* 1.0.1 - naprawa: kopiowanie monet z jednego nicku na drugi
* 1.0.2 - dodanie: natywow
* 1.0.3 - dodanie: typu zapisu
* 1.0.4 - naprawa: dostawanie monet za wpisanie kill w konsoli (Podziekowania dla Szybcioor za wykrycie i dla Goliath za zalatanie :])
* 1.0.5 - dodanie: nowe eventy za ktore zdobywa sie monety
* 1.0.6 - dodanie: cvaru - wlacznie/wylaczenie monet za TeamKill
* 1.0.7 - naprawa: brak monet za zabicie
* 1.0.8 - naprawa: brak monet za uratowanie/zabicie hosta
* 1.1.0 - naprawa: zbyt maly rozmiar tablicy
- naprawa: problem z pobieraniem cvaru cod_savetype
- optymalizacja kodu
* 1.1.1 - dodanie: cvaru - ustawia minimalna ilosc graczy na serwerze, od ktorej mozliwe jest zdobywanie monet
*/

#include <amxmodx>
#include <amxmisc>
#include <nvault>

#define PLUGIN "System Monet"
#define AUTHOR "kisiel96"
#define VERSION "1.1.1"

#define TASK_SHOW_COINS 666
#define VIP ADMIN_LEVEL_D

enum events { kill = 0, kill_hs, defused, planted, rescue_hostage, kill_hostage };

new player_auth[33][64];
new player_coins[33];
new bool:player_vip[33];

new pcvar_coins[events];
new pcvar_coins_vip[events];
new cvar_coins[events];
new cvar_coins_vip[events];

new pcvar_coins_minplayers;
new pcvar_coins_ff;
new cvar_coins_minplayers;
new cvar_coins_ff;

new pcvar_savetype;
new vault;

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);

register_event("DeathMsg", "EnemyKilled", "a");
register_logevent("HostageRescued", 3, "1=triggered", "2=Rescued_A_Hostage");
register_logevent("HostageKilled", 3, "1=triggered", "2=Killed_A_Hostage");

pcvar_coins_ff = register_cvar("cod_coins_friendlyfire", "0");

pcvar_coins[kill] = register_cvar("cod_coins_kill", "1");
pcvar_coins_vip[kill] = register_cvar("cod_coins_kill_vip", "2");
pcvar_coins[kill_hs] = register_cvar("cod_coins_kill_hs", "3");
pcvar_coins_vip[kill_hs] = register_cvar("cod_coins_kill_hs_vip", "6");

pcvar_coins[planted] = register_cvar("cod_coins_planted", "1");
pcvar_coins_vip[planted] = register_cvar("cod_coins_planted_vip", "2");
pcvar_coins[defused] = register_cvar("cod_coins_defused", "1");
pcvar_coins_vip[defused] = register_cvar("cod_coins_defused_vip", "2");

pcvar_coins[rescue_hostage] = register_cvar("cod_coins_rescue_hostage", "1");
pcvar_coins_vip[rescue_hostage] = register_cvar("cod_coins_rescue_hostage_vip", "2");
pcvar_coins[kill_hostage] = register_cvar("cod_coins_kill_hostage", "2");
pcvar_coins_vip[kill_hostage] = register_cvar("cod_coins_kill_hostage_vip", "1");

pcvar_coins_minplayers = register_cvar("cod_coins_minplayers", "2");

pcvar_savetype = get_cvar_num("cod_savetype");

vault = nvault_open("monety");
if(vault == INVALID_HANDLE)
set_fail_state("Nie mozna otworzyc pliku");
}

public plugin_natives()
{
register_native("cod_get_user_coins", "GetCoins", 1);
register_native("cod_set_user_coins", "SetCoins", 1);
}

public client_authorized(id)
{
RemoveCoins(id);

switch(pcvar_savetype)
{
case 1: get_user_name(id, player_auth[id], 63);
case 2: get_user_authid(id, player_auth[id], 63);
case 3: get_user_ip(id, player_auth[id], 63);
}

if(get_user_flags(id) & VIP)
player_vip[id] = true;
else
player_vip[id] = false;

LoadCoins(id);
}

public client_connect(id)
LoadCoins(id);

public client_disconnect(id)
{
SaveCoins(id);
RemoveCoins(id)
}

public plugin_end()
nvault_close(vault);

// /-----------\ //
// |RESET MONET| //
// \-----------/ //

public RemoveCoins(id)
{
player_coins[id] = 0;
player_vip[id] = false;
}

// /--------------\ //
// |ZLICZNIE MONET| //
// \--------------/ //

public EnemyKilled()
{
cvar_coins_minplayers = get_pcvar_num(pcvar_coins_minplayers);
if(get_playersnum() < cvar_coins_minplayers)
return;

new kid = read_data(1);
new vid = read_data(2);
new hs = read_data(3);

if(kid == vid)
return;

cvar_coins_ff = get_pcvar_num(pcvar_coins_ff)

if(cvar_coins_ff == 0 && get_user_team(kid) == get_user_team(vid))
return;

cvar_coins[kill] = get_pcvar_num(pcvar_coins[kill]);
cvar_coins_vip[kill] = get_pcvar_num(pcvar_coins_vip[kill]);
cvar_coins[kill_hs] = get_pcvar_num(pcvar_coins[kill_hs]);
cvar_coins_vip[kill_hs] = get_pcvar_num(pcvar_coins_vip[kill_hs]);

if(player_vip[kid])
{
if(hs)
player_coins[kid] += cvar_coins_vip[kill_hs];
else
player_coins[kid] += cvar_coins_vip[kill];
}
else
{
if(hs)
player_coins[kid] += cvar_coins[kill_hs];
else
player_coins[kid] += cvar_coins[kill];
}
}

public BombPlanted(id)
{
cvar_coins_minplayers = get_pcvar_num(pcvar_coins_minplayers);
if(get_playersnum() < cvar_coins_minplayers)
return;

cvar_coins[planted] = get_pcvar_num(pcvar_coins[planted]);
cvar_coins_vip[planted] = get_pcvar_num(pcvar_coins_vip[planted]);

if(player_vip[id])
player_coins[id] += cvar_coins_vip[planted];
else
player_coins[id] += cvar_coins[planted];
}

public BombDefused(id)
{
cvar_coins_minplayers = get_pcvar_num(pcvar_coins_minplayers);
if(get_playersnum() < cvar_coins_minplayers)
return;

cvar_coins[defused] = get_pcvar_num(pcvar_coins[defused]);
cvar_coins_vip[defused] = get_pcvar_num(pcvar_coins_vip[defused]);

if(player_vip[id])
player_coins[id] += cvar_coins_vip[defused];
else
player_coins[id] += cvar_coins[defused];
}

public HostageRescued(id)
{
cvar_coins_minplayers = get_pcvar_num(pcvar_coins_minplayers);
if(get_playersnum() < cvar_coins_minplayers)
return;

new loguser[80], name[32];
read_logargv(0, loguser, 79);
parse_loguser(loguser, name, 31);

new id = get_user_index(name);

cvar_coins[rescue_hostage] = get_pcvar_num(pcvar_coins[rescue_hostage]);
cvar_coins_vip[rescue_hostage] = get_pcvar_num(pcvar_coins_vip[rescue_hostage]);

if(player_vip[id])
player_coins[id] += cvar_coins_vip[rescue_hostage];
else
player_coins[id] += cvar_coins[rescue_hostage];
}

public HostageKilled(id)
{
cvar_coins_minplayers = get_pcvar_num(pcvar_coins_minplayers);
if(get_playersnum() < cvar_coins_minplayers)
return;

new loguser[80], name[32];
read_logargv(0, loguser, 79);
parse_loguser(loguser, name, 31);

new id = get_user_index(name);

cvar_coins[kill_hostage] = get_pcvar_num(pcvar_coins[kill_hostage]);
cvar_coins_vip[kill_hostage] = get_pcvar_num(pcvar_coins_vip[kill_hostage]);

if(player_vip[id])
player_coins[id] -= cvar_coins_vip[kill_hostage];
else
player_coins[id] -= cvar_coins[kill_hostage];
}

// /------\ //
// |NATYWY| //
// \------/ //

public SetCoins(id, wartosc)
{
player_coins[id] = wartosc
}

public GetCoins(id)
return player_coins[id];

// /------\ //
// |NVAULT| //
// \------/ //

public SaveCoins(id)
{
new vaultkey[64], vaultdata[256];
formatex(vaultkey, 63, "%s-player_coins", player_auth[id]);
formatex(vaultdata, 255, "%d#", player_coins[id]);
nvault_set(vault, vaultkey, vaultdata);

return;
}

public LoadCoins(id)
{
new vaultkey[64], vaultdata[256];
formatex(vaultkey, 63, "%s-player_coins", player_auth[id]);
formatex(vaultdata, 255, "%d#", player_coins[id]);
nvault_get(vault, vaultkey, vaultdata,255);

replace_all(vaultdata, 255, "#", " ");

new temp_player_coins[33];
parse(vaultdata, temp_player_coins, 32);

player_coins[id] = str_to_num(temp_player_coins);

return;
}

// /-----------------\ //
// |ZEBY BYLO LADNIEJ| //
// \-----------------/ //

public bomb_planted(planter)
{
BombPlanted(planter);
}

public bomb_defused(defuser)
{
BombDefused(defuser);
}



  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site you agree to Privacy Policy