Raised This Month: $ Target: $400
 0% 

Several Easy Hl Coding Questions


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SickMothaF
New Member
Join Date: Jan 2006
Old 03-01-2006 , 03:11   Several Easy Hl Coding Questions
Reply With Quote #1

Hello everyone. I am new to the HL1 coding and I just want to ask you guys some easy (for you I guess) stuff that I want to achieve.

1. How to create a timer that is visible on screen that counts from 00:00:00 till the end of the level, and how to write that time out in log000001.txt for example. The next player that plays the level will have log000002.txt and so long.

2. How to disable mouse from the game, I just want the arrow keys and space key.

3. Before every level I want to have a black screen that tells you to press space to begin level 1, and a black screen after you finished the level that tells you to press space to go to level 2.

4. I want to have a time stamp when a weapon is picked up in the log000001.txt.

Thank you all that can help me in advance. I will really appreciate the help!
SickMothaF is offline
broertje
Senior Member
Join Date: Mar 2005
Old 03-01-2006 , 03:24  
Reply With Quote #2

i'm new to,but i think for (1) you need a get_timeleft and create a place with hudgenerator i think???
broertje is offline
broertje
Senior Member
Join Date: Mar 2005
Old 03-01-2006 , 03:40  
Reply With Quote #3

I tried something,got 6 warnings,so if anyone could help me a little bit.
Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN "New Plugin" #define VERSION "1.0" #define AUTHOR "Author" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         register_cvar("amx_counter", "1") }     public mess(id)     {         new timel         get_timeleft(timel,32)     if ( !get_cvar_num("amx_counter") )     {           set_hudmessage(255, 255, 255, 0.00, 0.00, 0, 6.0, 12.0)              show_hudmessage(id, "%s Remaining",timel)         return PLUGIN_HANDLED     } }
broertje is offline
SickMothaF
New Member
Join Date: Jan 2006
Old 03-01-2006 , 05:15  
Reply With Quote #4

Hello, thank you verry much. But I think that u've missunderstood me. I want to create not a time left, but a simple timer display starting from 00:00:00 and when you finish one level at the end of the level you will get on a black screen for example or in a logfile (the better) like Map1 finished in 00:024
Map2 finished in 00:14:22 total time 16 min and 56 sec.
SickMothaF is offline
MaximusBrood
Veteran Member
Join Date: Sep 2005
Location: The Netherlands
Old 03-01-2006 , 11:51  
Reply With Quote #5

Quote:
Originally Posted by SickMothaF
Hello, thank you verry much. But I think that u've missunderstood me. I want to create not a time left, but a simple timer display starting from 00:00:00 and when you finish one level at the end of the level you will get on a black screen for example or in a logfile (the better) like Map1 finished in 00:024
Map2 finished in 00:14:22 total time 16 min and 56 sec.
A logfile is a lot simpler

Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> new PLUGIN[] = "Maptime log" new VERSION[] = "0.1" new AUTHOR[] = "MaximusBrood" new beginTime public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         //Record the starting time     LogStartTime() } public LogStartTime() {     beginTime = get_systime()         return PLUGIN_HANDLED } public plugin_end() {     new endTime = get_systime()     new iseconds = beginTime - endTime     new iminutes = 0, ihours = 0             //Minutes     if(iseconds > 59)     {         iminutes = iseconds / 60         iseconds -= iminutes * 60     }         //Hours     if(iminutes > 59)     {         ihours = iminutes / 60         iminutes -= ihours * 60     }         new len = 0, result[128]     //Collect output     if(ihours != 0)     {         len += format(result[len], 127, "%d hours, ", ihours)     }     if(iminutes != 0)     {         len += format(result[len], 127, "%d minutes and", iminutes)     }         len += format(result[len], 127, "%d seconds", iseconds)         new mapname[64]     get_mapname(mapname, 63)         //Log output     log_amx("The map %s took %s", mapname, result)         return PLUGIN_HANDLED }

Compiles ok, but not tested

__________________
Released six formerly private plugins. Not active here since ages.
MaximusBrood is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 03-01-2006 , 12:01  
Reply With Quote #6

Code:
if(ihours != 0)         {         len += format(result[len], 127, "%d %s, ", ihours, ihours == 1 ? "hour" : "hours")     }     if(iminutes != 0)         {         len += format(result[len], 127, "%d %s and", iminutes, iminutes == 1 ? "minute" : "minutes")     }         len += format(result[len], 127, "%d %s", iseconds, iseconds == 1 ? "second" : "seconds")
would just look btr
[ --<-@ ] Black Rose is offline
MaximusBrood
Veteran Member
Join Date: Sep 2005
Location: The Netherlands
Old 03-01-2006 , 13:04  
Reply With Quote #7

No... it won't...

Thats a really 'hard to see' identing style

I think my style is much better

---

Look at these two examples

Code:
if(bla == blah) {     for(int a = 0; a < max; a++)     {         for(int b = 0; a < max2; b++)         {             if(something == something)             {                 DoThis();             } else             {                 if(anotherthing == something)                 {                     DoThat();                 } else                 {                     DoTheOtherThing();                 }             }                 //Add a thing             AddThing(thing);         }             ResetThis(value)     } } else {     EscapeSomeData('@', 127); }

Code:
if(bla == blah)     {     for(int a = 0; a < max; a++)         {         for(int b = 0; a < max2; b++)             {             if(something == something)                 {                 DoThis();             } else                 {                 if(anotherthing == something)                     {                     DoThat();                 } else                     {                     DoTheOtherThing();                 }             }                 //Add a thing             AddThing(thing);         }             ResetThis(value)     } } else     {     EscapeSomeData('@', 127); }

You can immidiatly see what piece of code is in what loop with the first style.
You can't really see with the seconds style
__________________
Released six formerly private plugins. Not active here since ages.
MaximusBrood is offline
SickMothaF
New Member
Join Date: Jan 2006
Old 03-01-2006 , 14:16  
Reply With Quote #8

Hi, thanks! But I have some problems with the mod. I compiled MaximusBrood's code and put it in to the plugins.ini . My liblist gam is

game "Maze rat"
startmap "maze1"
trainmap "t0a0"
mpentity "info_player_deathmatch"

cldll "cl_dlls\client.dll"
gamedll "addons\metamod\dlls\metamod.dll"
gamedll_linux "addons/metamod/dlls/metamod_i386.so"

The game crashesh every time I start new game (or load a map.) I thought that it was from the compiled plugin but when i removed it , it is the same - crash. May be something is wrong with amx ?
SickMothaF is offline
MaximusBrood
Veteran Member
Join Date: Sep 2005
Location: The Netherlands
Old 03-01-2006 , 14:59  
Reply With Quote #9

Look here, its perfectly explained

http://wiki.amxmodx.org/index.php/In...ally#Configure
__________________
Released six formerly private plugins. Not active here since ages.
MaximusBrood is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 03-01-2006 , 15:13  
Reply With Quote #10

lol i meant the
Code:
iseconds == 1 ? "second" : "seconds"
not the identing
i would have done it like so:
Code:
// if(ihours != 0) {     len += format(result[len], 127, "%d %s, ", ihours, ihours == 1 ? "hour" : "hours") } if(iminutes != 0) {     len += format(result[len], 127, "%d %s and", iminutes, iminutes == 1 ? "minute" : "minutes") } len += format(result[len], 127, "%d %s", iseconds, iseconds == 1 ? "second" : "seconds") //
[ --<-@ ] Black Rose is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:19.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode