AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Error... (https://forums.alliedmods.net/showthread.php?t=8891)

skulldiggers 12-30-2004 01:23

Error...
 
Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>

new rdys=0, rdy[32], inmatch=0, ativo=0
new g_teamScore[2]
new cfg[128] = "cpl.cfg"

public ready_to_match(id)
{
      new kName[32]
      get_user_name(id,kName,31)
      new Float:minrdys= get_cvar_float("amx_rdys")

      if(inmatch)
      {
                client_print(id,print_chat,"** The Match Aready Started **")
                return PLUGIN_HANDLED
      }
      else
      {
      if(ativo)
      {
      if(!rdy[id])
      {
                client_print(0,print_chat,"** %s is Ready to match **", kName)
                rdy[id]=1
                rdys++
                return PLUGIN_HANDLED
      }
      else
      {
                client_print(id,print_chat,"** you aready say !rdy **")
                return PLUGIN_HANDLED
      }
      if(rdys>=minrdys)
      {
      inmatch=1
      rdys=0
      rdy[0]=0
      set_task(2.0, "start_the_match")
      }
      else
      {
      client_print(id,print_chat,"** CPL MATCH IS OFF **")
      }
      }
      }
      return PLUGIN_HANDLED
}

// linha 51

public restart_round(time[])
{
  server_cmd("sv_restartround %s",time)
  return PLUGIN_CONTINUE
}

public restart_msg2()
{
        new host[32]
        get_cvar_string("hostname",host,32)
        client_print(0,print_chat,"%s : [--- LIVE ON NEXT RESTART ---]", host)
        return PLUGIN_CONTINUE
}

public restart_msg3()
{
        new host[32]
        get_cvar_string("hostname",host,32)
        client_print(0,print_chat,"%s : [--- LIVE!! LIVE!! LIVE!! ---]", host)
        return PLUGIN_CONTINUE
}

public say_algo(msg[])
{
        new host[32]
        get_cvar_string("hostname",host,32)
        client_print(0,print_chat,"%s : %s", host, msg)
        return PLUGIN_HANDLED
}

public start_the_match()
{
        new host[32]
        get_cvar_string("hostname",host,32)
        client_print(0,print_chat,"%s : [--- LIVE IN 3 RESTARTS ---]", host)
        server_cmd("exec %s",cfg)
        restart_round("1")
        set_task(1.0, "restart_round",0,"1",2)
        set_task(2.5, "restart_msg2")
        set_task(2.0, "restart_round",0,"10",2)
        set_task(13.0, "restart_msg3")
}

public match_info(id)
{
if(inmatch)
{
        client_print(id,print_chat,"** The Match Aready Started **")
        return PLUGIN_HANDLED
}
else
{
if(ativo)
{
        new minrdys= get_cvar_num("amx_rdys")
        client_print(id,print_chat,"** Need %i players say !rdy to start the match **", minrdys - rdys)
}
else
{
client_print(id,print_chat,"** CPL MATCH IS OFF **")
}
}
return PLUGIN_HANDLED
}

// linha 110

public amx_match(id,level,cid)
{
        if (!cmd_access(id, level, cid, 1)) return PLUGIN_HANDLED

        new type[32]
        read_argv(1, type, 32)
        if (equal(type,"0")) {
        ativo=0
        rdys=0
        inmatch=0
        rdy[0]=0
        server_cmd("exec 4fun.cfg")
        server_cmd("sv_restartround 1")
        }
        if (equal(type,"1")) {
        ativo=1
        rdys=0
        rdy[0]=0
        inmatch=0
        cfg="cpl.cfg"
              client_print(0,print_chat,"** Match ON, say !rdy to start the match **")
        }
        if (equal(type,"2")) {
        ativo=1
        rdys=0
        rdy[0]=0
        inmatch=0
        cfg="cplot.cfg"
                client_print(0,print_chat,"** Match ON, say !rdy to start the match **")
        }
    return PLUGIN_HANDLED
}

public teamScore(id) {
    new team[2]
    read_data(1,team,1)
    g_teamScore[(team[0]=='C')? 0 : 1] = read_data(2)

    return PLUGIN_CONTINUE
}

public showthescore()
{
if (ativo)
{
new the_score[64]
format(the_score,1023,"CT %i x %i TR",g_teamScore[0], g_teamScore[1])
set_hudmessage(255, 0, 0, -1.0, 0.32, 0, 2.0, 6.0, 0.8, 0.8, 2)
show_hudmessage(0,the_score)
}
}


public plugin_init()
{
        register_plugin("Cpl Match auto prepare","1.0a","Tr4NInG")
        register_clcmd( "say !rdy", "ready_to_match", 0, "Ready to match" )
        register_clcmd( "say !ready", "ready_to_match", 0, "Ready to match" )
        register_clcmd( "say !info", "match_info", 0, "Info of number of readys" )
        register_concmd("amx_match", "amx_match",ADMIN_MAP,"Start or stop a match in server")
        register_cvar("amx_rdys","10")
        server_cmd("exec 4fun.cfg")
        register_event("TeamScore", "teamScore", "ab")
        register_event("ResetHUD", "showthescore", "b")
}

ok, i put in console amx_match 1..
all players say !rdy and the plugin start the match...
but, if i turn match OFF
and put in console amx_match 1 again
if anyone player say !rdy
the plugin say ** you aready say !rdy **
where are the fu**** error ?

thx

PS. i know, i need learn english fast :oops:

XxAvalanchexX 12-30-2004 01:47

In amx_match function you see this 3 times:

Code:
rdy[0]=0

Change to this all 3 times:

Code:
for(new i=0;i<sizeof(rdy);i++) { rdy[i] = 0; }


All times are GMT -4. The time now is 19:27.

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