Raised This Month: $ Target: $400
 0% 

in the first 3 minutes of the map


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ch3cker
Veteran Member
Join Date: Jun 2005
Location: Deutschland / Baden-Würt
Old 10-30-2006 , 09:45   in the first 3 minutes of the map
Reply With Quote #1

hi

i want to use only knife in the first 3 minutes of the map.

How can I make this. With set_task or with register_event

I only need to know the thing with the first 3 minutes.
__________________
SORRY 4 MY BAD ENGLISH
ch3cker is offline
Rolnaaba
Veteran Member
Join Date: May 2006
Old 10-30-2006 , 09:55   Re: in the first 3 minutes of the map
Reply With Quote #2

this may work, but it uses set_task which I dont like :
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
public plugin_init() {
 
register_plugin(PLUGINVERSIONAUTHOR)
 
register_event("HLTV""event_new_round""a""1=0""2=0")
}
public 
logevent_round_start() {
 for(new 
i=0;i<=get_maxplayers();i++) {
  new 
ammoclip
  
  
if(get_user_weapon(iammoclip) != CSW_KNIFE) {
   
strip_user_weapons(i)
   
give_item(iCSW_KNIFE)
   
set_task(180.0"END")
  }
 }
}
public 
END() {
 return 
PLUGIN_HANDLED

__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 10-30-2006 , 13:01   Re: in the first 3 minutes of the map
Reply With Quote #3

Here is a better script. The code Rolnaaba gave you will not work at all.

Code:
#include <amxmodx> #include <amxmisc> new bool:KnifeOnly; public plugin_init() {     register_plugin("", "", "");     register_event("HLTV", "event_new_round", "a", "1=0", "2=0");     register_event("CurWeapon", "hook_CurWeapon", "be", "1=1"); } public hook_CurWeapon(player) {     if(KnifeOnly && read_data(2) != CSW_KNIFE)     {         engclient_cmd(player, "weapon_knife");     } } // Also the HLTV event won't fire off until there are actually players on each team if IIRC correctly. // So if someone join your server like like 5 minute after the map started. // This won't turn off till 8 minutes in. public event_new_round() {     KnifeOnly = true;     set_task(180.0, "NoMoreKnife");     client_print(0, print_chat, "[KNIFE] 3 minutes of knife only."); } public NoMoreKnife() {     client_print(0, print_chat, "[KNIFE] No more knife only.");     KnifeOnly = false; }
__________________
No private support via Instant Message
GunGame:SM Released

Last edited by teame06; 10-30-2006 at 14:26.
teame06 is offline
Send a message via AIM to teame06
Nostrodamous
BANNED
Join Date: Oct 2006
Old 10-30-2006 , 16:53   Re: in the first 3 minutes of the map
Reply With Quote #4

Quote:
Originally Posted by Rolnaaba View Post
this may work, but it uses set_task which I dont like :

[/php]
Thank god someone fianlly feels teh same way as i do . you could also use a get_time and a reapeting while loop that breaks if(get_time)== map_start + 3min ) more complicated but possable
Nostrodamous is offline
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 10-30-2006 , 18:06   Re: in the first 3 minutes of the map
Reply With Quote #5

Quote:
Originally Posted by Nostrodamous View Post
Thank god someone fianlly feels teh same way as i do . you could also use a get_time and a reapeting while loop that breaks if(get_time)== map_start + 3min ) more complicated but possable
@ Nostrodamous

Let me get this straight... You wanted him to do this something like this. The problem with this is that when you do a that while loop. If I'm understand what you are saying. Is that this will lock up the server for about 3 minutes in a infinite loop till it reaches it time to break out of the loop.

Code:
#include <amxmodx> new TimeToStop; public plugin_init() {     TimeToStop = get_systime() + (3 * 60);     while(TimeToStop)     {         if(get_systime() >= TimeToStop)         {             break;         }     } }
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
Nostrodamous
BANNED
Join Date: Oct 2006
Old 10-30-2006 , 18:37   Re: in the first 3 minutes of the map
Reply With Quote #6

no , no no , notice i was speaking to rolnaaba. i was not suggesting that he used that method , i simply stated that that was an "option". but in this sitaution it would be better to use a set task function , set_task function are best for sitautions like this when you need to set an actaul time to do a function .
Nostrodamous is offline
MaximusBrood
Veteran Member
Join Date: Sep 2005
Location: The Netherlands
Old 10-31-2006 , 03:48   Re: in the first 3 minutes of the map
Reply With Quote #7

set_task() is just a legimate function that you need sometimes.
There is nothing bad about it other then being quite CPU intensive.
You can't just take a while loop and loop until the time reaches "map_start + 3min", it will lockup the server.
__________________
Released six formerly private plugins. Not active here since ages.
MaximusBrood is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 11-04-2006 , 19:42   Re: in the first 3 minutes of the map
Reply With Quote #8

Code:
#include <amxmodx> new bool:KnifeOnly; new bool:first = true; public plugin_init() {     register_plugin("", "", "");         register_event("HLTV", "event_new_round", "a", "1=0", "2=0");     register_event("CurWeapon", "hook_CurWeapon", "be", "1=1"); } public hook_CurWeapon(player) {     if ( KnifeOnly && read_data(2) != CSW_KNIFE )         engclient_cmd(player, "weapon_knife"); } public event_new_round() {     if ( ! first )         return;         KnifeOnly = true;     set_task(180.0, "NoMoreKnife");     client_print(0, print_chat, "[KNIFE] 3 minutes of knife only.");     first = false; } public NoMoreKnife() {     client_print(0, print_chat, "[KNIFE] No more knife only.");     KnifeOnly = false; }
[ --<-@ ] Black Rose is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 11-05-2006 , 02:42   Re: in the first 3 minutes of the map
Reply With Quote #9

Quote:
the HLTV event won't fire off until there are actually players on each team if IIRC correctly
No, HLTV is a global event and given params (0, 0) have nothing to do with a player so it will fire on every new round, not taking players in account.

Last edited by VEN; 11-05-2006 at 02:56.
VEN is offline
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 11-05-2006 , 05:11   Re: in the first 3 minutes of the map
Reply With Quote #10

Quote:
Originally Posted by VEN View Post
No, HLTV is a global event and given params (0, 0) have nothing to do with a player so it will fire on every new round, not taking players in account.
Yes it does. HLTV event will not fire off with the condition 1=0 and 2=0 when the server starts up with no players in the server. I have tested it just right now. The only time I see that event fire off is when the each team has a player or a single person on join a team and then kill himself or force a round restart.
__________________
No private support via Instant Message
GunGame:SM Released

Last edited by teame06; 11-05-2006 at 05:16.
teame06 is offline
Send a message via AIM to teame06
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 04:53.


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