Skocz do zawartości

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Zdjęcie

C4 timer + tutor


  • Zamknięty Temat jest zamknięty
Brak odpowiedzi do tego tematu

#1 Wojtek Piasecki

    Nowy

  • Użytkownik

Reputacja: 6
Nowy

  • Postów:9
  • Imię:Wojtek
  • Lokalizacja:Łódź
Offline

Napisano 26.10.2010 11:58

Witam. Mam następujący problem. Zgodnie z tutorialem Tutor czyli informacje jak w condition zero. - Nieoficjalny polski support AMX Mod X chciałem przerobić C4timer na taki tutorowy.
SMA c4 timera
/* 
Bomb Countdown HUD Timer v0.2 by SAMURAI

* Plugin Details
With this plugin enabled, you can see an colored Hud Message with the c4 time left, until explode
Remeber : if until explode remains less than 8 seconds, hudmessage color will be red, if > 7 will be yellow and > 13 will be green.

* Required Modules:
- CSX

* Credits:
- Emp` for various indicates
- Alka for full tests

* Changelog
- Fixed Events problems
- Pcvars
- Fixed any bug on plugin

*/


#include <amxmodx>
#include <amxmisc>
#include <csx>

#define PLUGIN "Bomb Countdown HUD Timer"
#define VERSION "0.2"
#define AUTHOR "SAMURAI"

new g_c4timer, pointnum;
new bool:b_planted = false;

new g_msgsync;


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

pointnum = get_cvar_pointer("mp_c4timer");

register_logevent("newRound", 2, "1=Round_Start");
register_logevent("endRound", 2, "1=Round_End");
register_logevent("endRound", 2, "1&Restart_Round_");

g_msgsync = CreateHudSyncObj();
}

public newRound()
{
g_c4timer = -1;
remove_task(652450);
b_planted = false;
}

public endRound()
{
g_c4timer = -1;
remove_task(652450);
}

public bomb_planted()
{
b_planted = true;
g_c4timer = get_pcvar_num(pointnum);
dispTime()
set_task(1.0, "dispTime", 652450, "", 0, "b");
}

public bomb_defused()
{
if(b_planted)
{
remove_task(652450);
b_planted = false;
}

}

public bomb_explode()
{
if(b_planted)
{
remove_task(652450);
b_planted = false;
}

}

public dispTime()
{
if(!b_planted)
{
remove_task(652450);
return;
}


if(g_c4timer >= 0)
{
if(g_c4timer > 13) set_hudmessage(0, 150, 0, -1.0, 0.80, 0, 1.0, 1.0, 0.01, 0.01, -1);
else if(g_c4timer > 7) set_hudmessage(150, 150, 0, -1.0, 0.80, 0, 1.0, 1.0, 0.01, 0.01, -1);
else set_hudmessage(150, 0, 0, -1.0, 0.80, 0, 1.0, 1.0, 0.01, 0.01, -1);

ShowSyncHudMsg(0, g_msgsync, "C4: %d", g_c4timer);

--g_c4timer;
}

}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/


Wymodziłem z tego:
/* 
Bomb Countdown HUD Timer v0.2 by SAMURAI

* Plugin Details
With this plugin enabled, you can see an colored Hud Message with the c4 time left, until explode
Remeber : if until explode remains less than 8 seconds, hudmessage color will be red, if > 7 will be yellow and > 13 will be green.

* Required Modules:
- CSX

* Credits:
- Emp` for various indicates
- Alka for full tests

* Changelog
- Fixed Events problems
- Pcvars
- Fixed any bug on plugin

*/


#include <amxmodx>
#include <csx>

#define PLUGIN "Bomb Countdown HUD Timer"
#define VERSION "0.2"
#define AUTHOR "SAMURAI"
#define TUTORIAL 1001
#define TASK_TUT 1111

#define MSOUND "items/nvg_off.wav"

enum { RED = 1, BLUE, YELLOW, GREEN }

new const g_TutorPrecache[][] = { "gfx/career/icon_!.tga", "gfx/career/icon_!-bigger.tga", "gfx/career/icon_i.tga", "gfx/career/icon_i-bigger.tga", "gfx/career/icon_skulls.tga", "gfx/career/round_corner_ne.tga", "gfx/career/round_corner_nw.tga", "gfx/career/round_corner_se.tga", "gfx/career/round_corner_sw.tga", "resource/TutorScheme.res", "resource/UI/TutorTextWindow.res" }

new g_MsgTutor
new g_MsgTutClose
new g_c4timer, pointnum;
new bool:b_planted = false;

new g_msgsync;


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

pointnum = get_cvar_pointer("mp_c4timer");

register_logevent("newRound", 2, "1=Round_Start");
register_logevent("endRound", 2, "1=Round_End");
register_logevent("endRound", 2, "1&Restart_Round_");

g_msgsync = CreateHudSyncObj();
}

public plugin_precache()
{
precache_sound(MSOUND)

new i

for(i = 0; i < sizeof g_TutorPrecache; i++)
{
precache_generic(g_TutorPrecache[i])
}
}
MakeTutor(id,Text[],Color,Float:Time = 0.0){
if(is_user_connected( id ))
{
if(!id){
message_begin(MSG_ALL,g_MsgTutor)
write_string(Text)
write_byte(0)
write_short(0)
write_short(0)
write_short(1<<Color)
message_end()
}
else
{

message_begin(MSG_ONE_UNRELIABLE,g_MsgTutor,_,id)
write_string(Text)
write_byte(0)
write_short(0)
write_short(0)
write_short(1<<Color)
message_end()
}
}
if(Time != 0.0)
{

if( task_exists( id + TASK_TUT ) )
{
remove_task( id + TASK_TUT )
}
set_task(Time,"RemoveTutor",id + TASK_TUT)
}
}
public RemoveTutor(taskID)
{
new id = taskID - TASK_TUT
if(!id){
message_begin(MSG_ALL,g_MsgTutClose,_,id)
message_end()
}
else
{
message_begin(MSG_ONE_UNRELIABLE,g_MsgTutClose,_,id)
message_end()
}
}

public newRound()
{
g_c4timer = -1;
remove_task(652450);
b_planted = false;
}

public endRound()
{
g_c4timer = -1;
remove_task(652450);
}

public bomb_planted()
{
b_planted = true;
g_c4timer = get_pcvar_num(pointnum);
dispTime()
set_task(1.0, "dispTime", 652450, "", 0, "b");
}

public bomb_defused()
{
if(b_planted)
{
remove_task(652450);
b_planted = false;
}

}

public bomb_explode()
{
if(b_planted)
{
remove_task(652450);
b_planted = false;
}

}

public dispTime()
{
if(!b_planted)
{
remove_task(652450);
return;
}


if(g_c4timer >= 0)
{
new Text[ 100 ]
formatex(Text,191,"Bomba wybuchnie za %d", g_c4timer)
MakeTutor(0,Text,GREEN,3.0)

--g_c4timer;
}

}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/

Plugin kompiluje, jednak nic się nie dzieje. Logi:
L 10/26/2010 - 12:53:04: Plugin called message_begin with an invalid message id (0).
L 10/26/2010 - 12:53:04: [AMXX] Run time error 10 (plugin "c4.amxx") (native "message_begin")

Prosił bym o wskazanie co zrobiłem żle. Jestem mocno początkujący także proszę o wyrozumiałość.

Użytkownik Wojtek Piasecki edytował ten post 26.10.2010 12:10

  • +
  • -
  • 0

Od 2006 niezmiennie dla graczy, REKSIO FFA
Reksio FFA - 193.33.177.14:27051
by Serwery CS





Użytkownicy przeglądający ten temat: 0

0 użytkowników, 0 gości, 0 anonimowych