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

[HELP] : Team Locker - Run Problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GX_JazZ
Member
Join Date: Dec 2014
Old 12-08-2014 , 09:22   [HELP] : Team Locker - Run Problem
Reply With Quote #1

Hey , Guys
Can someone help me in the problem ?

Code:
new const PLUGIN[]  = "Team Locker";
new const VERSION[] = "1.0"
new const AUTHOR[]  = "JazZ";

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

#define TE 0
#define CT 1
#define AUTO 4
#define SPEC 5

new const Teamnames[6][] = {
"Terrorists",
"Counter-Terrorists",
"",
"",
"Auto",
"Spectator"
}

new bool:blockjoining[6] 

new amx_show_activity

public plugin_init() { 
register_plugin(PLUGIN, VERSION, AUTHOR);
register_dictionary("teamlocker.txt")

register_cvar("teamlocker",VERSION,FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY);	
register_menucmd(register_menuid("Team_Select",1), (1<<0)|(1<<1)|(1<<4)|(1<<5), "team_select"); 

register_clcmd("jointeam", "join_team");

register_concmd("amxx_lockit", "admin_lock", ADMIN_BAN,"- <CT/T/Auto/Spec> Locks a team");
}
public plugin_cfg()
{
amx_show_activity = get_cvar_pointer("amx_show_activity");
}

public admin_lock(id, level, cid)
{
if(!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED

new Arg1[6]

read_argv(1, Arg1, 5)

if(!equali(Arg1, "T") && !equali(Arg1, "CT") && !equali(Arg1, "Auto") && !equali(Arg1, "Spec"))
{
client_print(id, print_console, "%L", LANG_PLAYER, "TEAM_INVALID")
return PLUGIN_HANDLED
}

new team

if(equali(Arg1, "T"))
team = TE
else if(equali(Arg1, "CT"))
team = CT
else if(equali(Arg1, "Auto"))
team = AUTO
else if(equali(Arg1, "Spec"))
team = SPEC

blockjoining[team] = true

new name[32], steamid[38]

get_user_name(id, name, 31)
get_user_authid(id, steamid, 37)

switch(get_pcvar_num(amx_show_activity)) {
case 2:	client_print(0,print_chat,"%L", LANG_PLAYER, "TEAM_LOCK_CASE2",name,Teamnames[team])
case 1:	client_print(0,print_chat,"%L", LANG_PLAYER, "TEAM_LOCK_CASE1",Teamnames[team])
}

console_print(id,"%L", LANG_PLAYER, "TEAM_LOCK_CONSOLE",Teamnames[team])
log_amx("%L", LANG_SERVER, "LOCK_TEAMS_LOG", name,steamid,Teamnames[team])

return PLUGIN_HANDLED
}

public team_select(id, key) 
{ 
if ( blockjoining[key] == true && get_players2() >= 1 )
{
engclient_cmd(id, "chooseteam") 
return PLUGIN_HANDLED 
} 		

return PLUGIN_CONTINUE 
} 

get_players2()
{ 
static Players_Activos, CsTeams:Team
Players_Activos = 0 
new Maxplayers = get_maxplayers()
for(new i = 1; i <= Maxplayers; i++) 
{ 
if(!is_user_connected(i)) continue  

Team = cs_get_user_team(i) 

if(Team == CS_TEAM_CT) 
{ 
Players_Activos++ 
} 

} 
return Players_Activos 

}

public join_team(id) 
{
if (is_user_admin(id))
{
remove_task(id)
return PLUGIN_CONTINUE
}
if( get_players2() == 0 )
{
remove_task(id)
return PLUGIN_CONTINUE
}

if(!is_user_connected(id))
{
remove_task(id)
return PLUGIN_CONTINUE
}

new arg[2] 
read_argv(1, arg, 1)

if (blockjoining[str_to_num(arg)-1] == true)
{
remove_task(id)
return PLUGIN_HANDLED 
} 

return PLUGIN_CONTINUE 
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1252\\ deff0\\ deflang1036{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
*/
Code:
L 12/08/2014 - 13:50:44: [AMXX] Displaying debug trace (plugin "Team-Locker.amxx")
L 12/08/2014 - 13:50:44: [AMXX] Run time error 4: index out of bounds 
L 12/08/2014 - 13:50:44: [AMXX]    [0] Team-Locker.sma::join_team (line 141)
Attached Files
File Type: sma Get Plugin or Get Source (Team-Locker.sma - 563 views - 3.0 KB)
GX_JazZ is offline
Send a message via Skype™ to GX_JazZ
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 05:35.


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