Raised This Month: $ Target: $400
 0% 

Not working correctly


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
abyssss
New Member
Join Date: Dec 2008
Old 05-16-2009 , 09:37   Not working correctly
Reply With Quote #1

I have some problems with that script. It is too laggy. Can someone can explain me what lines are doing the lag, why and how to solve it?
And my second question is, at
PHP Code:
show_hudmessage(0"%s - %i !n %s - %i /n %s - %i /n %s - %i /n %s - %i",rn[0], playerscore[teamred[0]], rn[1], playerscore[teamred[1]], rn[2], playerscore[teamred[2]], rn[3], playerscore[teamred[3]], rn[4], playerscore[teamred[4]] ) 
How i can insert the %s - %i in a new line. I forgot the symbol, "/n" isn't..
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fun>

#define PLUGIN "Maze War Contest"
#define VERSION "1.0"
#define AUTHOR "abyss"

new team[32]
new 
playerscore[32]
new 
teamred[5], teamblue[5], teamglad[10],rfree 0bfree 0gfree 0
new rn[5][32], bn[5][32],gn[10][32]

//new roundcounter, gamestarted


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_concmd("amx_mzred""mzred"ADMIN_KICK"<target name> - Transfer to [RED] Team ")
    
register_concmd("amx_mzblue""mzblue"ADMIN_SLAY"<target name> - Transfer to [BLUE] Team ")
    
register_concmd("amx_mzglad""mzglad"ADMIN_SLAY"<target name> - Transfer to [GLADIATOR] Team ")
    
//register_concmd("amx_mzstart", "mzstart", ADMIN_SLAY, "Porneste jocul!")
    
register_event("DeathMsg""hook_death""a")
    
//register_event("SendAudio","roundend","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw")
    
new i
    
for(i=0i<32i++)
    {
        
playerscore[i] = 0
        team
[i] = 0
        
if(i>=&& i<=5)
        {
            
copy(rn[i], 31"                             ")
            
copy(bn[i], 31"                             ")
            
teamred[i] = 0
            teamblue
[i] = 0
        
}
        if(
i>=&& i<=10)
        {
            
copy(gn[i], 31"                             ")
            
teamglad[i] = 0
        
}
    }
}


public 
mzred(idlevelcid)    
{    
    if(!
cmd_access(idlevelcid1))    
        return 
PLUGIN_HANDLED    
    
    
new arg[24]    
    
read_argv(1arg23)   
    if (
strlen(arg) == 0)
    {
        
console_print(id"[amx_mzred] <target name> - Transfer to [RED] Team "arg)
        return 
PLUGIN_HANDLED 
    
}
    new 
cmd_target(idarg2)    
    if (!
t)    
    {    
        
console_print(id"[amx_mzred] ' %s ' do not exist. "arg)    
        return 
PLUGIN_HANDLED    
    
}     
    if(
team[t] != 0)
        return 
PLUGIN_HANDLED 
    
new cmd_name[32]    
    
get_user_name (tcmd_name31)
    
team[t] = 1
    copy
(rn[rfree], 31cmd_name)
    
teamred[rfree] = t
    rfree 
rfree 1
    set_user_rendering
(t,kRenderFxGlowShell,255,0,0,kRenderTransAlpha,150)     
    
client_cmd(t"name ^"(RED) %s^""cmd_name)    
    
console_print(id"[amx_mzred] DONE!")
    return 
PLUGIN_HANDLED        
}
public 
mzblue(idlevelcid)    
{    
    if(!
cmd_access(idlevelcid1))    
        return 
PLUGIN_HANDLED    
    
new arg[24]    
    
read_argv(1arg23)   
    if (
strlen(arg) == 0)
    {
        
console_print(id"[amx_mzblue] <target name> - Transfer to [BLUE] Team "arg)
        return 
PLUGIN_HANDLED 
    
}
    new 
cmd_target(idarg2)    
    if (!
t)    
    {    
        
console_print(id"[amx_mzblue] ' %s ' do not exist. "arg)    
        return 
PLUGIN_HANDLED    
    
}    
    if(
team[t] != 0)
        return 
PLUGIN_HANDLED 
    
new cmd_name[32]    
    
get_user_name (tcmd_name31)
    
team[t] = 2
    copy
(bn[bfree], 31cmd_name)
    
teamblue[bfree] = 
    bfree 
bfree 1
    set_user_rendering
(t,kRenderFxGlowShell,0,0,255,kRenderTransAlpha,150)     
    
client_cmd(t"name ^"(BLUE) %s^""cmd_name)     
    
console_print(id"[amx_mzblue] DONE!")
    return 
PLUGIN_HANDLED         
}
public 
mzglad(idlevelcid)    
{    
    if(!
cmd_access(idlevelcid1))    
        return 
PLUGIN_HANDLED    
    
new arg[24]    
    
read_argv(1arg23)   
    if (
strlen(arg) == 0)
    {
        
console_print(id"[amx_mzglad] <target name> - Transfer to [BLUE] Team "arg)
        return 
PLUGIN_HANDLED 
    
}
    new 
cmd_target(idarg2)    
    if (!
t)    
    {    
        
console_print(id"[amx_mzglad] ' %s ' do not exist. "arg)    
        return 
PLUGIN_HANDLED    
    
}     
    if(
team[t] != 0)
        return 
PLUGIN_HANDLED 
    
new cmd_name[32]    
    
get_user_name (tcmd_name31)
    
team[t] = 3
    copy
(gn[gfree], 31cmd_name)
    
teamglad[gfree] = t    
    gfree 
gfree 1
    set_user_rendering
(t,kRenderFxGlowShell,210,210,210,kRenderTransAlpha,150)     
    
client_cmd(t"name ^"(GLADIATOR) %s^""cmd_name)     
    
console_print(id"[amx_mzglad] DONE!")
    return 
PLUGIN_HANDLED        
}


public 
hook_death()
{
    new 
Killer read_data(1)
    new 
testteami
    
for(i=1<= rfreei++)
    {
        if(
teamred[i]==Killer)
            
testteam testteam 1
    
}
    for(
i=1<= bfreei++)
    {
        if(
teamblue[i]==Killer)
            
testteam testteam 1
    
}
    for(
i=1<= gfreei++)
    {
        if(
teamglad[i]==Killer)
            
testteam testteam 1
    
}
    if(
testteam 0)
        
playerscore[Killer] = playerscore[Killer] + 1
}

public 
client_PreThink(id)
{
    
set_hudmessage(2552552550.00.1500.0330.0330.0330.0331)
    
show_hudmessage(0"Contender's")
    
set_hudmessage(255000.00.2000.0330.0330.0330.0332)
    
show_hudmessage(0"%s - %i !n %s - %i /n %s - %i /n %s - %i /n %s - %i",rn[0], playerscore[teamred[0]], rn[1], playerscore[teamred[1]], rn[2], playerscore[teamred[2]], rn[3], playerscore[teamred[3]], rn[4], playerscore[teamred[4]] )
    
set_hudmessage(002550.00.4500.0330.0330.0330.0333)
    
show_hudmessage(0"%s - %i /n %s - %i /n %s - %i /n %s - %i /n %s - %i",bn[0], playerscore[teamblue[0]], bn[1], playerscore[teamblue[1]], bn[2], playerscore[teamblue[2]], bn[3], playerscore[teamblue[3]], bn[4], playerscore[teamblue[4]] )
    
    
}
//public client_connect(id)
//{
//}
//public  client_disconnect ( id )
//{
//    if(team[id] == 1)
//    {
//        redid[
//    }
//}
//public roundend()
//{
        
//}
//public mzstart()
//{
    
//} 
abyssss is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 05-16-2009 , 09:39   Re: Not working correctly
Reply With Quote #2

try \n
__________________
xPaw is offline
abyssss
New Member
Join Date: Dec 2008
Old 05-16-2009 , 09:46   Re: Not working correctly
Reply With Quote #3

Edit: found.. It was ^n

And plugin is still laggy

Edit2: I found the cause of big ping..

PHP Code:
public client_PreThink(id)
{
    
set_hudmessage(2552552550.00.1500.0330.0330.0330.0331)
    
show_hudmessage(0"Contender's")
    
set_hudmessage(255000.00.2000.0330.0330.0330.0332)
    
show_hudmessage(0" %s - %i ^n %s - %i ^n %s - %i ^n %s - %i ^n %s - %i",rn[0], playerscore[teamred[0]], rn[1], playerscore[teamred[1]], rn[2], playerscore[teamred[2]], rn[3], playerscore[teamred[3]], rn[4], playerscore[teamred[4]] )
    
set_hudmessage(002550.00.4500.0330.0330.0330.0333)
    
show_hudmessage(0" %s - %i ^n %s - %i ^n %s - %i ^n %s - %i ^n %s - %i",bn[0], playerscore[teamblue[0]], bn[1], playerscore[teamblue[1]], bn[2], playerscore[teamblue[2]], bn[3], playerscore[teamblue[3]], bn[4], playerscore[teamblue[4]] )
    
set_hudmessage(2552552550.690.1500.0330.0330.0330.0334)
    
show_hudmessage(id"Gladiator's ^n^n%s - %i ^n%s - %i ^n%s - %i ^n%s - %i ^n%s - %i ^n%s - %i ^n%s - %i ^n%s - %i ^n%s - %i ^n%s - %i",gn[0],playerscore[teamglad[0]],gn[1],playerscore[teamglad[1]],gn[2],playerscore[teamglad[2]],gn[3],playerscore[teamglad[3]],gn[4],playerscore[teamglad[4]],gn[5],playerscore[teamglad[5]],gn[6],playerscore[teamglad[6]],gn[7],playerscore[teamglad[7]],gn[8],playerscore[teamglad[8]],gn[9],playerscore[teamglad[9]])
    

Are there any good settings for set_hudmessage to stop that hud to lag?

Last edited by abyssss; 05-16-2009 at 10:40.
abyssss is offline
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 05-16-2009 , 14:58   Re: Not working correctly
Reply With Quote #4

Quote:
Originally Posted by abyssss View Post
Edit: found.. It was ^n

And plugin is still laggy

Edit2: I found the cause of big ping..

PHP Code:
public client_PreThink(id)
{
    
set_hudmessage(2552552550.00.1500.0330.0330.0330.0331)
    
show_hudmessage(0"Contender's")
    
set_hudmessage(255000.00.2000.0330.0330.0330.0332)
    
show_hudmessage(0" %s - %i ^n %s - %i ^n %s - %i ^n %s - %i ^n %s - %i",rn[0], playerscore[teamred[0]], rn[1], playerscore[teamred[1]], rn[2], playerscore[teamred[2]], rn[3], playerscore[teamred[3]], rn[4], playerscore[teamred[4]] )
    
set_hudmessage(002550.00.4500.0330.0330.0330.0333)
    
show_hudmessage(0" %s - %i ^n %s - %i ^n %s - %i ^n %s - %i ^n %s - %i",bn[0], playerscore[teamblue[0]], bn[1], playerscore[teamblue[1]], bn[2], playerscore[teamblue[2]], bn[3], playerscore[teamblue[3]], bn[4], playerscore[teamblue[4]] )
    
set_hudmessage(2552552550.690.1500.0330.0330.0330.0334)
    
show_hudmessage(id"Gladiator's ^n^n%s - %i ^n%s - %i ^n%s - %i ^n%s - %i ^n%s - %i ^n%s - %i ^n%s - %i ^n%s - %i ^n%s - %i ^n%s - %i",gn[0],playerscore[teamglad[0]],gn[1],playerscore[teamglad[1]],gn[2],playerscore[teamglad[2]],gn[3],playerscore[teamglad[3]],gn[4],playerscore[teamglad[4]],gn[5],playerscore[teamglad[5]],gn[6],playerscore[teamglad[6]],gn[7],playerscore[teamglad[7]],gn[8],playerscore[teamglad[8]],gn[9],playerscore[teamglad[9]])
 

Are there any good settings for set_hudmessage to stop that hud to lag?
Don't set up a hud in client_PreThink, because it's called 30 times per second.
__________________
Achievements API - a simple way for you to create your OWN custom achievements!
Xellath 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 01:30.


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