Raised This Month: $ Target: $400
 0% 

Whats is better?


Post New Thread Closed Thread   
 
Thread Tools Display Modes
Author Message
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 03-24-2011 , 21:39   Whats is better?
#1

Please, explain what is better script (Remember: the plugins have the same function).

cvar: pug_warmup is created by other plugin

PHP Code:
public CHECAR()
{
get_players(USERS,TRs,"e","TERRORIST")
get_players(USERS,CTs,"e","CT")
TOTAL get_playersnum()

new 
WARMUP get_cvar_num("pug_warmup")

if(
WARMUP == 1)
return 
PLUGIN_HANDLED

else if(WARMUP == && TOTAL <= MINIMOGH)
{
client_print(0,3,"%s Faltam %d jogadores para continuar. (Reiniciando em %d segundos)",HEADER,(10 TOTAL),TEMPO)
set_task(float(TEMPO),"RESTART")
return 
PLUGIN_HANDLED
}
else if(
WARMUP == && TRs <= MINIMO)
{
client_print(0,3,"%s Reiniciando sistema em %d segundos. (Faltando: %d TRs - %d CTs)",HEADER,TEMPO,(TRs),(CTs))
set_task(float(TEMPO),"RESTART")
return 
PLUGIN_HANDLED
}
else if(
WARMUP == && CTs <= MINIMO)
{
client_print(0,3,"%s Reiniciando sistema em %d segundos. (Faltando: %d TRs - %d CTs)",HEADER,TEMPO,(TRs),(CTs))
set_task(float(TEMPO),"RESTART")
return 
PLUGIN_HANDLED
}
return 
PLUGIN_HANDLED

Or:

PHP Code:
public CHECAR()
{
get_players(USERS,TRs,"e","TERRORIST")
get_players(USERS,CTs,"e","CT")
TOTAL get_playersnum()

new 
WARMUP get_cvar_num("pug_warmup")

switch(
WARMUP)
{
case 
0:
{
if(
TRs <= MINIMO)
{
client_print(0,3,"%s Reiniciando sistema em %d segundos. (Faltando: %d TRs - %d CTs)",HEADER,TEMPO,(TRs),(CTs))
set_task(float(TEMPO),"RESTART")
return 
PLUGIN_HANDLED
}
else if(
CTs <= MINIMO)
{
client_print(0,3,"%s Reiniciando sistema em %d segundos. (Faltando: %d TRs - %d CTs)",HEADER,TEMPO,(TRs),(CTs))
set_task(float(TEMPO),"RESTART")
return 
PLUGIN_HANDLED
}
}
case 
1:
{
return 
PLUGIN_HANDLED
}
case 
2:
{
if(
TOTAL <= MINIMOGH)
{
client_print(0,3,"%s Faltam %d jogadores para continuar. (Reiniciando em %d segundos)",HEADER,(10 TOTAL),TEMPO)
set_task(float(TEMPO),"RESTART")
return 
PLUGIN_HANDLED
}
}
}
return 
PLUGIN_HANDLED

Ps. If it is not no, explain more
The beginning of the code:

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define HEADER "[PUG]"

new USERS[32],TRs,CTs,TOTAL
new MINIMO 3
new MINIMOGH 5
new TEMPO 10

public plugin_init()
{
register_plugin("Minplayers",AMXX_VERSION_STR ,"SmileY")
register_logevent("CHECAR",2,"1=Round_Start")
}

public 
RESTART()
{
server_cmd("pug_votemap_enabled 1")
     
set_cvar_num("pug_votemap",1)
      
server_cmd("restart")

__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 

Last edited by ConnorMcLeod; 03-25-2011 at 03:11.
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-24-2011 , 21:52   Re: Whats is better?
#2

The 2nd because it only checks WARMUP once when it is 0.
Also, switch statements should be used when checking a variable for multiple values.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 03-24-2011 , 22:06   Re: Whats is better?
#3

Quote:
Originally Posted by Exolent[jNr] View Post
The 2nd because it only checks WARMUP once when it is 0.
Also, switch statements should be used when checking a variable for multiple values.
thanks
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Old 03-24-2011, 23:30
^SmileY
This message has been deleted by ^SmileY. Reason: Ops
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-25-2011 , 03:01   Re: Whats is better?
#4

Restored your original post and lock so you can trash it anymore.
If you don't want the code to be public don't ask help on public forum thanks.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 03-25-2011 at 03:12.
ConnorMcLeod is offline
Old 03-25-2011, 03:14
Hawk552
This message has been deleted by Hawk552.
Closed Thread



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 14:34.


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