Raised This Month: $ Target: $400
 0% 

how?: execute once on mapchange


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Riddick51
BANNED
Join Date: Jul 2005
Location: Lincoln, Nebr US
Old 11-05-2005 , 12:36   how?: execute once on mapchange
Reply With Quote #1

here is what i want to do:

only 1 time, after map change:
Code:
    new mapname[24]     new tmapn[4]     get_mapname(mapname, 23)     copy(tmapn,3,mapname) . . .     if (tmapn=="de_")       //test for defuse map type         //execute this code
Riddick51 is offline
Send a message via AIM to Riddick51 Send a message via MSN to Riddick51 Send a message via Yahoo to Riddick51
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 11-05-2005 , 12:39  
Reply With Quote #2

Code:
// ... new bool:mapthing; // ... // ... checkmap("de_"); // ... public checkmap(arg[]) {     new mapname[64];     get_mapname(mapname,63);     if(containi(mapname,arg)!=-1)     {         mapthing = true;     }     return 0; }

EDIT:

Code:
public whatever_func() {     if(mapthing == true)     {         // do stuff     }     //...
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Riddick51
BANNED
Join Date: Jul 2005
Location: Lincoln, Nebr US
Old 11-05-2005 , 15:44  
Reply With Quote #3

Yes, Hawk, that got the job done --- Thanks a Mil! ;o
Riddick51 is offline
Send a message via AIM to Riddick51 Send a message via MSN to Riddick51 Send a message via Yahoo to Riddick51
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 11-05-2005 , 15:55  
Reply With Quote #4

Why do so much if he only wants to execute this code once?

Code:
public plugin_init() {     //...    set_task(0.1 , "CheckMap") } public CheckMap() {     new mapname[4]     get_mapname(mapname, 3)     if(!equali(mapname, "de_"))         return PLUGIN_HANDLED    //Put code here }

its simplier and has less variables. so uses less memory.

Yours has two functions and 3 variables(1 global). and this one has one function and one variable. with less code doing the same thing.
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 11-05-2005 , 15:57  
Reply With Quote #5

I usually do that stuff in plugin_cfg()
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 11-05-2005 , 19:51  
Reply With Quote #6

He can always just modify it to not use variables, and if he needs it more than once, my method is better. Come on, seriously, what would be the extra CPU and overhead? 0.0000001 for the split second it takes to calculate that, and maybe a few bytes.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Riddick51
BANNED
Join Date: Jul 2005
Location: Lincoln, Nebr US
Old 11-05-2005 , 20:47  
Reply With Quote #7

my solution involved combining elements from Hawk and Suicid3. The code was forwarded to BAILOPAN to be included in CSDM2.
Riddick51 is offline
Send a message via AIM to Riddick51 Send a message via MSN to Riddick51 Send a message via Yahoo to Riddick51
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 23:39.


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