Raised This Month: $51 Target: $400
 12% 

Admin Mark (marks admins with beret or helmet)


Post New Thread Reply   
 
Thread Tools Display Modes
hackziner
Senior Member
Join Date: Sep 2006
Location: France
Old 06-22-2007 , 13:56   Re: Admin Mark
Reply With Quote #11

Hum, really nice plugin
__________________
hackziner is offline
Send a message via ICQ to hackziner Send a message via AIM to hackziner Send a message via MSN to hackziner Send a message via Yahoo to hackziner Send a message via Skype™ to hackziner
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 06-23-2007 , 11:27   Re: Admin Mark
Reply With Quote #12

Code:
    if (equali(modelStr,"gign") )     {         modelID = 0     }     else if (equali(modelStr,"gsg9") )     {         modelID = 1     }     else if (equali(modelStr,"sas") )     {         modelID = 2     }     else if (equali(modelStr,"urban") )     {         modelID = 3     }     else if (equali(modelStr,"vip") )     {         modelID = 4     }     else if (equali(modelStr,"arctic") )     {         modelID = 5     }     else if (equali(modelStr,"guerilla") )     {         modelID = 6     }     else if (equali(modelStr,"leet") )     {         modelID = 7     }     else if (equali(modelStr,"terror") )     {         modelID = 8     }     else         modelID = 9

Terrible. Make a global array which stores all these names, then run a loop checking if it's each one. If it is, set model ID to the iterator's value.

I'm willing to hold this back for this optimization alone. Please do it within a week or I will unapprove this.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
kaloszyfer
Member
Join Date: Mar 2007
Location: Poland
Old 06-24-2007 , 10:12   Re: Admin Mark
Reply With Quote #13

OK, I'll try.
kaloszyfer is offline
kmal2t
BANNED
Join Date: Apr 2006
Old 06-24-2007 , 15:10   Re: Admin Mark
Reply With Quote #14

Why not just make it as a stock? like:

Code:
switch(get_model(id)) {     case 1: blah blah     case 2: blah blah } stock get_model(id) {     new model[10];     cs_get_user_model(id, model, 9);     if(equal(model, "blahblah"))         return 1;     if(equal(model, "blahblah"))         return 2;     if(equal(model, "blahblah"))         return 3;     return 0; }

btw, the beret looks like a seat cushion on their head lol.

Last edited by kmal2t; 06-24-2007 at 15:12.
kmal2t is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-24-2007 , 17:05   Re: Admin Mark
Reply With Quote #15

Because this would not optimize the code.
ConnorMcLeod is offline
sawce
The null pointer exception error and virtual machine bug
Join Date: Oct 2004
Old 06-24-2007 , 21:36   Re: Admin Mark
Reply With Quote #16

Quote:
Originally Posted by kaloszyfer View Post
OK, I'll try.
Just butting in here, I really don't see the need to put that function in prethink to begin with.

I would assume just making an array of what model ID they have at the round start would suffice. It might temporarily display the wrong helmet for the remainder of a round if an admin uses a command to force a model change, but that'd be a small price to pay for the overhead reduction.
__________________
fyren sucks
sawce is offline
Lee
AlliedModders Donor
Join Date: Feb 2006
Old 06-24-2007 , 21:53   Re: Admin Mark
Reply With Quote #17

Quote:
Originally Posted by kmal2t View Post
Why not just make it as a stock?
To see what stocks actually are - as you evidently have no idea - read this.
Lee is offline
kmal2t
BANNED
Join Date: Apr 2006
Old 06-24-2007 , 22:55   Re: Admin Mark
Reply With Quote #18

Eh fine then you can do it like this too:

Code:
#define myNum 3 public myFunc(id) {     new const array[myNum][] = {         "shit0",         "shit1",         "shit2"         };     for(new i=0;i<myNum;i++) {         if(equal(tuna, array[i])) {             shit;         }     } }

This also begs the question, as a GENERAL rule how many ifs would it be before it's a better idea to use a loop instead?
kmal2t is offline
kaloszyfer
Member
Join Date: Mar 2007
Location: Poland
Old 06-25-2007 , 06:28   Re: Admin Mark
Reply With Quote #19

Plugin updated!
kaloszyfer is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 06-25-2007 , 07:18   Re: Admin Mark
Reply With Quote #20

1.Don't use "stock" at get_model(id).
2.like sawce said
Quote:
Originally Posted by sawce
Just butting in here, I really don't see the need to put that function in prethink to begin with.
EDIT:Yes public !
__________________
Still...lovin' . Connor noob! Hello

Last edited by Alka; 06-25-2007 at 07:58.
Alka 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 19:50.


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