Raised This Month: $ Target: $400
 0% 

executing code in wrong order


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
karlos
Veteran Member
Join Date: Apr 2004
Location: Germany/Poland
Old 10-04-2004 , 03:08   executing code in wrong order
Reply With Quote #1

i have the following code (Natural-Selection)
Code:
public pugin_init(){     register_logevent("createcc",1) } public createcc(){     new i     ccindex[0] = 0     ccindex[1] = 0     ccindex[2] = 0     ccindex[3] = 0     // code part a     for ( i = 1; i <= ns_get_build("team_command",1,0); i++){         ccindex[pev(ns_get_build("team_command",1,i),pev_team)] = ns_get_build("team_command",1,i)     }     if (!ccindex[2]){         remove_entity(ccindex[2])     }         // code part b     pev(ccindex[3],pev_origin,cclocation)     entity_set_origin(ccindex[3],cclocation)     new Float:temporigin[3]={9999.9,9999.9,9999.9}     entity_set_origin(ccindex[3],temporigin)         ccindex[2] = create_entity("team_command")     spawn(ccindex[2])     copy_pev(ccindex[3],ccindex[2])     set_pev(ccindex[2],pev_team,2)     entity_set_origin(ccindex[2],cclocation) }
the problem is now that code part b is executed before code part a, but only when server loads (server start/mapchange plugin gets initialized)
than it works normal
why is it so?
__________________
alias White Panther
karlos is offline
fsfod
Junior Member
Join Date: Jul 2004
Location: UK
Old 10-04-2004 , 10:08  
Reply With Quote #2

ah mansawe's mvm fix script

maybe if you checked how many times it was called

Code:
L 10/04/2004 - 14:58:12: -------- Mapchange --------
[AMXX] Loaded 1 admin from file
L 10/04/2004 - 14:58:13: [mvm.amxx] enter initializecc
L 10/04/2004 - 14:58:13: [mvm.amxx] enter createcc
L 10/04/2004 - 14:58:13: [mvm.amxx] enter createcc
Executing AMX Mod X Configuration File
Scrolling message displaying frequency: 10:00 minutes
L 10/04/2004 - 14:58:13: [mvm.amxx] enter createcc
No auth servers parsed
Disabling Valve Authentication.
Adding master server 207.173.177.11:27010
Adding master server 69.28.151.178:27010
restart
L 10/04/2004 - 15:01:50: -------- Mapchange --------
[AMXX] Loaded 1 admin from file
L 10/04/2004 - 15:01:50: [mvm.amxx] enter initializecc
L 10/04/2004 - 15:01:50: [mvm.amxx] enter createcc
L 10/04/2004 - 15:01:50: [mvm.amxx] enter createcc
Executing AMX Mod X Configuration File
Scrolling message displaying frequency: 10:00 minutes
fsfod is offline
karlos
Veteran Member
Join Date: Apr 2004
Location: Germany/Poland
Old 10-04-2004 , 10:17  
Reply With Quote #3

its only a rip from mansawe's mvm fix
it should not matter how often it is called, cause with amxx 0.16 it worked
__________________
alias White Panther
karlos is offline
fsfod
Junior Member
Join Date: Jul 2004
Location: UK
Old 10-04-2004 , 11:20  
Reply With Quote #4

ns_get_build("team_command",1,0)
did you ever think that cc may not be set to built when the map starts up
and there was no ns_get_build in 0.16 or ns module, so this script would not work in amxx 0.16
fsfod is offline
karlos
Veteran Member
Join Date: Apr 2004
Location: Germany/Poland
Old 10-04-2004 , 11:45  
Reply With Quote #5

i fixed it by calling this func lfrom another func

i used ns2amx for 0.16, it has this command (called get_ent(classname[],Value) [ here i used get_ent("team_command",0) ])

also with amx i could use this in plugin_precache()
Code:
if ( is_combat() && ( get_ent("team_command",0) > 1 ) )
with amxx 0.16 and 0.2 only is_combat() works
__________________
alias White Panther
karlos is offline
fsfod
Junior Member
Join Date: Jul 2004
Location: UK
Old 10-04-2004 , 16:52  
Reply With Quote #6

i find this works better than "register_logevent("createcc",1)"

Code:
public plugin_log(){
  
  if(!Is_MvM)return

  new szArg1[32]
  	
  	read_logargv(0,szArg1,31)

	if(equali(szArg1, "Game reset complete.") == 1){
	  //log_amx("enter plugin_log with agumanet Game reset complete.")
	  createcc()
	}
}
fsfod 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 17:24.


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