Jump to content

[Plugin] Give/Take ammo.


SpyRexx

Recommended Posts

 

Descriere: Cu ajutorul acestui plugin puteti da/lua ammo packs unui jucator.

Nume: [ZP] Give/Take Ammo
Versiune: 1.2


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

zp_gt_ammo.amxx

Cvar-uri (se adauga in fisierul amxmodx\configs\amxx.cfg): 
-

Comenzi administrative (se tasteaza in consola si trebuie sa fiti administrator):
amx_give_packs <nume> <ammo> - Da ammo jucatorului
amx_take_packs <nume> <ammo> - Ia ammo jucatorului

Comenzi publice (se tasteaza in joc prin apasarea tastei Y):
-

Module Necesare (Se sterge ; din fata modulului de mai jos; acestea le gasiti in fisierul amxmodx\configs\modules.ini):

#include <amxmodx>
#include <amxmisc>
#include <zombieplague>
#include <zp50_colorchat>

Descarcare: Codul este urmatoarea.

#include <amxmodx>
#include <amxmisc>
#include <zombieplague>
#include <zp50_colorchat>

#define PLUGIN "Give/Take Ammo" // Nu e nici un sistem de ammo
#define VERSION "1.2"
#define AUTHOR "-" // Cineva de pe Alliedmods

new const FisierLogs[] = "gt_ammo.log";
new Packs[33]; // Nu are rost sa o creezi de 2 ori, o pui aici si ea devine globala

#pragma semicolon 1 // Fortam cate un ';' la fiecare capat de linie scrisa
#define ACCESS ADMIN_IMMUNITY

public plugin_init()
{

register_plugin ( PLUGIN, VERSION, AUTHOR );
register_concmd ( "amx_give_packs", "AMXX_GIVE_PACKS", ACCESS, "<nume> <ammo>" );
register_concmd ( "amx_take_packs", "AMXX_TAKE_PACKS", ACCESS, "<nume> <ammo>" );
}

public AMXX_GIVE_PACKS ( id, level, cid )
{
if ( !cmd_access ( id, level, cid, 2 ) )
{
return PLUGIN_HANDLED ;
}

new szArg [ 32 ], szArg2 [ 12 ];

read_argv( 1, sizeof ( szArg ) , 31 ) ;
read_argv( 2, sizeof ( szArg2 ), 11 ) ;

new Player = cmd_target( id, szArg, CMDTARGET_ALLOW_SELF ) ;

if ( !Player )
{
return PLUGIN_HANDLED ;
}


Packs[id] = str_to_num ( szArg2 ) ;

zp_set_user_ammo_packs ( Player, zp_get_user_ammo_packs(id) + Packs[id] ) ;

new szName [ 32 ], szPlayer [ 32 ] ; // // Variabila szName are 32 pozitii [ 32 jucatori max + 1 ]
get_user_name ( id, szName, charsmax ( szName ) ) ;
get_user_name ( Player, szPlayer, charsmax ( szPlayer ) ) ;
log_to_file ( FisierLogs, "[ZP] Adminul %s i-a dat %d packs lui %s.", szName, Packs[id], szPlayer );
zp_colored_print(0, "***^4POINTS^1***^3<-X-> ^1Adminul ^3..::^4%s^3::.. ^1i-a dat ^4%d ^1packs lui ^4%s", szName, Packs[id], szPlayer );

return PLUGIN_CONTINUE ;
}

public AMXX_TAKE_PACKS ( id, level, cid )
{
if ( !cmd_access (id, level, cid, 2 ) )
{
return PLUGIN_HANDLED ;
}

new szArg [ 32 ], szArg2 [ 12 ];

read_argv( 1, szArg, 31 ) ;
read_argv( 2, szArg2, 11 ) ;

new Player = cmd_target( id, szArg, CMDTARGET_ALLOW_SELF ) ;

if ( !Player )
{
return PLUGIN_HANDLED ;
}


Packs[id] = str_to_num ( szArg2 ) ;

zp_set_user_ammo_packs ( Player, zp_get_user_ammo_packs(id) - Packs[id] ) ;

new szName [ 32 ], szPlayer [ 32 ] ; // Variabila szName are 32 pozitii [ 32 jucatori max + 1 ]
get_user_name ( id, szName, charsmax ( szName ) ) ;
get_user_name ( Player, szPlayer, charsmax ( szPlayer ) ) ;
log_to_file ( FisierLogs, "[ZP] Adminul %s i-a sters %d packs lui %s.", szName, Packs[id], szPlayer );
zp_colored_print(0, "***^4POINTS^1***^3<-X-> ^1Adminul ^3..::^4%s^3::.. ^1i-a sters ^4%d ^1packs lui ^4%s", szName, Packs[id], szPlayer );

return PLUGIN_CONTINUE ;

Imagini:
-

ATENTIE ! In loc de zp50_colorchat puteti utiliza alt sistem cum ar fi ColorChat
 
Edited by SpyRexx
Link to comment
Share on other sites

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