Oto te pluginy i błędy:
1 plugin:
Spoiler
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <engine>
#include <cstrike>
#define PLUGIN "Ammo"
#define VERSION "1.0"
#define AUTHOR "DarkGL"
#define fm_create_entity(%1) engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, %1))
new const model[] = "models/zombie_plague/w_ammo.mdl"
new const classname[] = "paczkuszka_ammo"
new pcvar_time,pcvar_model
new const maxAmmo[31]={0,52,0,90,1,32,1,100,90,1,120,100,100,90,90,90,100,120,30,120,200,32,90,120,90,2,35,90,90,0,100};
new const maxClip[31] = { -1, 13, -1, 10, 1, 7, 1, 30, 30, 1, 30, 20, 25, 30, 35, 25, 12, 20,
10, 30, 100, 8, 30, 30, 20, 2, 7, 30, 30, -1, 50 };
new g_msgCurWeapon;
new gMaxPlayers;
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_touch(classname,"player","ammo_touched")
pcvar_model = register_cvar("ammo_model","2")
register_event("DeathMsg", "deatha", "a");
register_logevent("round_start", 2, "1=Round_Start");
gMaxPlayers = get_maxplayers();
g_msgCurWeapon = get_user_msgid("CurWeapon")
}
public plugin_precache()
{
precache_model(model)
}
public ammo_touched(touched,toucher){
if(pev_valid(touched) && is_user_alive(toucher) && fm_is_entity_visible(touched)){
if(give_user_ammo(toucher)){
fm_set_entity_visibility(touched,0);
set_task(float(get_pcvar_num(pcvar_time)),"ammo_set_visible",touched)
set_pev(touched,pev_solid,SOLID_NOT)
}
}
}
stock bool:give_user_ammo(id){
if(!is_user_alive(id)){
return false;
}
new wpn = get_user_weapon(id)
new clip,ammo
get_user_ammo(id,wpn,clip,ammo)
if(clip == maxClip[wpn] && ammo == maxAmmo[wpn]){
return false;
}
cs_set_user_bpammo(id, wpn, maxAmmo[wpn]);
FX_UpdateClip(id,wpn,maxClip[wpn]);
return true;
}
stock FX_UpdateClip(id, wpnid, clip){
if(!is_user_alive(id)) return;
message_begin( MSG_ONE, g_msgCurWeapon, _, id);
write_byte(1);
write_byte(wpnid);
write_byte(max( min( clip, 128 ), 0 ));
message_end()
}
public ammo_set_visible(ent){
if(pev_valid(ent)){
fm_set_entity_visibility(ent,1);
set_pev(ent,pev_solid,SOLID_SLIDEBOX)
}
}
public deatha(id)
{
postaw_paczuszke(id);
}
public round_start()
{
for(new id = 0; id <= gMaxPlayers; id++)
{
usun_all(id);
}
}
public postaw_paczuszke(id){
new ent = fm_create_entity("info_target")
if(pev_valid(ent)){
set_pev(ent,pev_classname,classname)
engfunc(EngFunc_SetModel,ent,model)
new vOrigin[3],Float:fOrigin[3]
get_user_origin(id,vOrigin,3)
IVecFVec(vOrigin,fOrigin)
set_pev(ent,pev_origin,fOrigin)
engfunc(EngFunc_SetSize, ent, {-16.0, -16.0, 0.0}, {16.0, 16.0, 12.0})
set_pev(ent, pev_solid, SOLID_SLIDEBOX)
set_pev(ent, pev_movetype, MOVETYPE_TOSS)
set_pev(ent, pev_rendermode, kRenderNormal)
set_pev(ent, pev_body,get_pcvar_num(pcvar_model))
}
}
public usun_all(id){
remove_entity_name(classname);
set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 6.0, 4.0)
show_hudmessage(id, "Usunelismy all")
}
public create_ammo(const Float:fOrigin[3]){
new ent = fm_create_entity("info_target")
if(pev_valid(ent)){
set_pev(ent,pev_classname,classname)
engfunc(EngFunc_SetModel,ent,model)
set_pev(ent,pev_origin,fOrigin)
engfunc(EngFunc_SetSize, ent, {-16.0, -16.0, 0.0}, {16.0, 16.0, 12.0})
set_pev(ent, pev_solid, SOLID_SLIDEBOX)
set_pev(ent, pev_movetype, MOVETYPE_TOSS)
set_pev(ent, pev_rendermode, kRenderNormal)
set_pev(ent, pev_body,get_pcvar_num(pcvar_model))
}
}
stock fm_set_entity_visibility(index, visible = 1) {
set_pev(index, pev_effects, visible == 1 ? pev(index, pev_effects) & ~EF_NODRAW : pev(index, pev_effects) | EF_NODRAW);
return 1;
}
stock bool:fm_is_entity_visible(entity){
if ((pev(entity, pev_effects) & EF_NODRAW))
return false
return true
}
Błędy:
Spoiler
L 01/07/2007 - 10:53:19: Invalid player id 0 L 01/07/2007 - 10:53:19: [AMXX] Displaying debug trace (plugin "ammo.amxx") L 01/07/2007 - 10:53:19: [AMXX] Run time error 10: native error (native "get_user_origin") L 01/07/2007 - 10:53:19: [AMXX] [0] ammo.sma::postaw_paczuszke (line 106) L 01/07/2007 - 10:53:19: [AMXX] [1] ammo.sma::deatha (line 89)
2 plugin:
Spoiler
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <colorchat>
#define PLUGIN "Easy End Round Sounds"
#define VERSION "0.1"
#define AUTHOR "DarkGL"
enum (+=200){
TASK_SHOW=200,
TASK_INFORMATION,
TASK_TUT
}
#define INFORMATION_CENTER 1
#define INFORMATION_HUD 2
#define INFORMATION_STATUSTEXT 4
new Array:ct_sounds;
new Array:tt_sounds;
new bool:all_ok = true;
new TAG[64];
new pinf;
new menuplaylist;
new playlist
new roundsound;
new bool:play[33];
new g_max_players;
new plosowo;
new tt_ktora;
new ct_ktora;
new menuroundsound;
new gmsgStatusText;
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
if(!all_ok){
return PLUGIN_CONTINUE;
}
register_event( "SendAudio", "T_win" , "a", "2&%!MRAD_terwin");
register_event( "SendAudio", "CT_win", "a", "2&%!MRAD_ctwin");
plosowo = register_cvar("roundsound_mode","0")
new sinf = register_cvar("roundsound_information_show","300");
if(get_pcvar_num(sinf)){
set_task(float(get_pcvar_num(sinf)),"information_show",TASK_INFORMATION,_,_,"b")
}
gmsgStatusText = get_user_msgid("StatusText")
g_max_players = get_maxplayers();
return PLUGIN_CONTINUE;
}
public client_connect(id)
{
play[id] = true;
}
public roundsound_on(id){
menu_display(id,menuroundsound)
return PLUGIN_HANDLED;
}
public roundsound_handle(id,menu,item){
if(item == MENU_EXIT){
return PLUGIN_CONTINUE;
}
switch(item){
case 0:
{
ColorChat(id,GREEN,"[%s] Wlaczyles roundsounda",TAG)
play[id] = true;
}
case 1:
{
play[id] = false;
ColorChat(id,GREEN,"[%s] Wylaczyles roundsounda",TAG)
}
}
return PLUGIN_CONTINUE;
}
public playlist_show(id){
menu_display(id,menuplaylist);
return PLUGIN_HANDLED;
}
public information_show(id){
static send=0;
switch(send){
case 0:
{
if(!get_pcvar_num(playlist)){
if(get_pcvar_num(roundsound)){
ColorChat(0,TEAM_COLOR,"[%s] W celu wlaczenia/wylaczenie roundsounda napisz na czacie /roundsound",TAG)
}
}
else
{
ColorChat(0,TEAM_COLOR,"[%s] Jesli chcesz przejrzec playliste napisz na czacie /playlista",TAG)
send++;
}
}
case 1:
{
send--;
if(!get_pcvar_num(roundsound)){
if(get_pcvar_num(playlist)){
ColorChat(0,TEAM_COLOR,"[%s] Jesli chcesz przejrzec playliste napisz na czacie /playlista",TAG)
}
}
else
{
ColorChat(0,TEAM_COLOR,"[%s] W celu wlaczenia/wylaczenie roundsounda napisz na czacie /roundsound",TAG)
}
}
}
}
public playlist_show_handle(id,menu,item){
if(item == MENU_EXIT){
return PLUGIN_CONTINUE;
}
new szConfDir[128];
get_configsdir(szConfDir,charsmax(szConfDir));
switch(item){
case 0:
{
format(szConfDir,charsmax(szConfDir),"%s/ctplaylist.txt",szConfDir);
show_motd(id,szConfDir,"PlayLista CT")
}
case 1:
{
format(szConfDir,charsmax(szConfDir),"%s/ttplaylist.txt",szConfDir);
show_motd(id,szConfDir,"PlayLista TT")
}
}
playlist_show(id)
return PLUGIN_CONTINUE;
}
public T_win(){
if(ArraySize(tt_sounds)-1 >= 0){
new szPath[256];
if(get_pcvar_num(plosowo)){
ArrayGetString(tt_sounds,random_num(0,ArraySize(tt_sounds)-1),szPath,sizeof szPath)
}
else
{
if(tt_ktora>=ArraySize(tt_sounds)-1){
tt_ktora = 0;
}
ArrayGetString(tt_sounds,tt_ktora++,szPath,charsmax(szPath))
}
play_sound(szPath)
}
}
public CT_win(){
if(ArraySize(ct_sounds)-1 >= 0){
new szPath[256];
if(get_pcvar_num(plosowo)){
ArrayGetString(ct_sounds,random_num(0,ArraySize(ct_sounds)-1),szPath,sizeof szPath)
}
else
{
if(ct_ktora>=ArraySize(tt_sounds)-1){
ct_ktora = 0;
}
ArrayGetString(ct_sounds,ct_ktora++,szPath,charsmax(szPath))
}
play_sound(szPath)
}
}
public plugin_precache(){
ct_sounds = ArrayCreate(256,1)
tt_sounds = ArrayCreate(256,1)
new ptag = register_cvar("roundsound_tag","AMXX.PL");
pinf = register_cvar("roundsound_information_play","abc"); // a - center b - hud c - statustext
new ct = register_cvar("roundsound_ct_path","misc/NaMaxxxaCT")
new tt = register_cvar("roundsound_tt_path","misc/NaMaxxxaTT")
playlist = register_cvar("roundsound_playlist_on","1");
roundsound = register_cvar("roundsound_roundsound_on","1");
get_pcvar_string(ptag,TAG,charsmax(TAG))
if(get_pcvar_num(playlist)){
register_clcmd("say /playlist","playlist_show")
register_clcmd("say playlist","playlist_show")
register_clcmd("say_team /playlist","playlist_show")
register_clcmd("say_team playlist","playlist_show")
register_clcmd("say /playlista","playlist_show")
register_clcmd("say playlista","playlist_show")
register_clcmd("say_team /playlista","playlist_show")
register_clcmd("say_team playlista","playlist_show")
menuplaylist = menu_create("Playlista","playlist_show_handle")
menu_additem(menuplaylist,"PlayLista CT")
menu_additem(menuplaylist,"PlayLista TT")
menu_setprop(menuplaylist,MPROP_EXITNAME,"Wyjscie")
menu_setprop(menuplaylist,MPROP_NUMBER_COLOR,"\r")
}
if(get_pcvar_num(roundsound)){
register_clcmd("say /roundsound","roundsound_on")
register_clcmd("say roundsound","roundsound_on")
register_clcmd("say_team /roundsound","roundsound_on")
register_clcmd("say_team roundsound","roundsound_on")
new formats[256];
formatex(formats,charsmax(formats),"[%s] Easy End Round Sound",TAG);
menuroundsound = menu_create(formats,"roundsound_handle");
menu_additem(menuroundsound,"Wlacz roundsound")
menu_additem(menuroundsound,"wyłącz roundsound")
menu_setprop(menuroundsound,MPROP_EXITNAME,"Wyjscie")
menu_setprop(menuroundsound,MPROP_NUMBER_COLOR,"\r")
}
new bool:track = false
new szPath[128],szFullPath[256],szFullDir[256],szConfDir[128]
new szFile[64];
if(get_pcvar_num(playlist) == 1){
get_configsdir(szConfDir,charsmax(szConfDir));
format(szConfDir,charsmax(szConfDir),"%s/ctplaylist.txt",szConfDir);
if(file_exists(szConfDir)){
delete_file(szConfDir);
}
}
get_pcvar_string(ct,szPath,charsmax(szPath))
formatex(szFullDir,charsmax(szFullDir),"sound/%s",szPath)
new dp = open_dir(szFullDir, szFile, charsmax(szFile));
if(dp){
if(get_pcvar_num(playlist) == 1){
write_file(szConfDir,"<html><head><title>PlayLista CT</title></head><body bgcolor='black'><font color='white'>",-1)
}
while(next_file(dp, szFile, charsmax(szFile))){
if(strlen(szFile) < 5){
continue;
}
if(is_valid(szFile) ){
track = true;
formatex(szFullPath,charsmax(szFullPath),"%s/%s",szFullDir,szFile)
is_wav(szFile) ? precache_sound(szFullPath[6]) : precache_generic(szFullPath);
ArrayPushString(ct_sounds,szFullPath)
log_amx("Zaladowano : %s",szFullPath);
if(get_pcvar_num(playlist) == 1){
clean_path(szFile)
write_file(szConfDir,szFile)
write_file(szConfDir,"<br />")
}
}
}
write_file(szConfDir,"</font></body></html>",-1)
}
else
{
all_ok = false;
log_amx("Brak folderu z muzyka dla ct")
log_amx("%s",szPath)
}
close_dir(dp);
if(!track){
all_ok = false;
return PLUGIN_CONTINUE;
}
track = false;
get_pcvar_string(tt,szPath,charsmax(szPath))
formatex(szFullDir,charsmax(szFullDir),"sound/%s",szPath)
if(get_pcvar_num(playlist) == 1){
get_configsdir(szConfDir,charsmax(szConfDir));
format(szConfDir,charsmax(szConfDir),"%s/ttplaylist.txt",szConfDir);
if(file_exists(szConfDir)){
delete_file(szConfDir);
}
}
dp = open_dir(szFullDir, szFile, charsmax(szFile));
if(dp){
if(get_pcvar_num(playlist) == 1){
write_file(szConfDir,"<html><head><title>PlayLista TT</title></head><body bgcolor='black'><font color='white'>",-1)
}
while(next_file(dp, szFile, charsmax(szFile))){
if(strlen(szFile) < 5){
continue;
}
if(is_valid(szFile) ){
track = true;
formatex(szFullPath,charsmax(szFullPath),"%s/%s",szFullDir,szFile)
is_wav(szFile) ? precache_sound(szFullPath[6]) : precache_generic(szFullPath);
ArrayPushString(tt_sounds,szFullPath)
log_amx("Zaladowano : %s",szFullPath);
if(get_pcvar_num(playlist) == 1){
clean_path(szFile)
write_file(szConfDir,szFile)
write_file(szConfDir,"<br />")
}
}
}
write_file(szConfDir,"</font></body></html>",-1)
}
else
{
all_ok = false;
log_amx("Brak folderu z muzyka dla tt")
}
close_dir(dp);
if(!track){
all_ok = false;
return PLUGIN_CONTINUE;
}
return PLUGIN_CONTINUE;
}
play_sound(file[]){
for(new i = 1;i<=g_max_players;i++){
if(!is_user_connected(i) || !play[i]){
continue;
}
client_cmd(i,"%s%s^"",is_wav(file) ? "spk ^"":"mp3 play ^"sound/",file[6])
}
new szFile[256]
remove_filepath(file,szFile,charsmax(szFile))
clean_path(szFile)
new formats[256];
formatex(formats,charsmax(formats),"[%s] Obecnie Gramy %s",TAG,szFile)
if(getFlags()&INFORMATION_CENTER){
set_task(1.0,"show_center",TASK_SHOW,formats,sizeof(formats))
}
if(getFlags()&INFORMATION_HUD){
show_hud(formats);
}
if(getFlags()&INFORMATION_STATUSTEXT){
show_statustext(formats);
}
}
public show_center(szFile[]){
for(new i = 1;i<=g_max_players;i++){
if(!is_user_connected(i) || !play[i]){
continue;
}
client_print(i,print_center,szFile)
}
}
public show_hud(szFile[]){
for(new i = 1;i<=g_max_players;i++){
if(!is_user_connected(i) || !play[i]){
continue;
}
set_hudmessage(0, 255, 42, -1.0, 0.2, 0, 6.0, 12.0)
show_hudmessage(i, szFile)
}
}
public show_statustext(szFile[]){
for(new i = 1;i<=g_max_players;i++){
if(!is_user_connected(i) || !play[i]){
continue;
}
message_begin(MSG_ONE_UNRELIABLE, gmsgStatusText, {0,0,0}, i)
write_byte(0)
write_string(szFile)
message_end()
}
}
bool:is_wav(file[]){
new iSize = strlen(file) - 4;
if(iSize > 0 ){
if(equali(file[iSize], ".wav")){
return true;
}
}
return false;
}
getFlags()
{
static flags[27]
get_pcvar_string(pinf, flags, 26)
return read_flags(flags)
}
bool:is_valid(szFilename[]){
new iSize = strlen(szFilename) - 4;
if(iSize > 0){
if(equali(szFilename[iSize], ".mp3") || equali(szFilename[iSize], ".wav")){
return true;
}
}
return false
}
clean_path(szFileName[]){
for(new iPos = strlen(szFileName)-4;iPos < strlen(szFileName);iPos++){
szFileName[iPos] = ' ';
}
}
Błędy:
Spoiler
L 01/07/2007 - 10:52:57: Start of error session. L 01/07/2007 - 10:52:57: Info (map "de_dust2") (file "addons/amxmodx/logs/error_20070107.log") L 01/07/2007 - 10:52:57: Couldn't write file "cstrike\" L 01/07/2007 - 10:52:57: [AMXX] Displaying debug trace (plugin "roundsound.amxx") L 01/07/2007 - 10:52:57: [AMXX] Run time error 10: native error (native "write_file") L 01/07/2007 - 10:52:57: [AMXX] [0] roundsound.sma::plugin_precache (line 252)
Proszę o szybką odpowiedz wynagrodzę za rozwiązanie i pomoc.


Dodatki SourceMod



Temat jest zamknięty









