Raised This Month: $ Target: $400
 0% 

Help with cvar


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
pagey
Junior Member
Join Date: Oct 2012
Old 10-27-2012 , 05:26   Help with cvar
Reply With Quote #1

So i have been googleing searching on forums for like 3 hours now
and it won't work ..
so what i am doing is a plugin that blocks WTJ (winning team join) usally used in Hide N Seek
so i made so it blocked so that you cant type jointeam 1,2,3,4,5,6 (i have a plugin that makes you join a team directly on join) and i have done so that when you type it a message in chat appears and you get kicked but i want to make a cvar so i can change the reason when kicked. this is the code

Code:
public plugin_init() {
	
	register_plugin("AntiWTJ", "1.1", "Pagey")
	
	register_clcmd("jointeam 1", "jointeam")
	register_clcmd("jointeam 2", "jointeam")
	register_clcmd("jointeam 5", "jointeam")
	register_clcmd("jointeam 6", "jointeam")
	register_srvcmd ("awtj_reason" , "Do not WTJ")
}


public jointeam(id)
{
	new cReason[32]
	
	new szName[32];
	get_user_name(id, szName, charsmax(szName)); //sizeof (szName - 1)
	get_cvar_string ( "awtj_reason" , cReason, 31 )
	server_cmd("kick %s %s", szName, cReason );
	
	
	set_hudmessage(49, 172, 8, 0.32, 0.40, 0, 6.0, 12.0)
	ColorChat(0, GREY, "^x01**^x04JoinTeam: ^x03 %s Got kicked for trying to WTJ", szName);
	
	
}
I cant get it to work.. :/
i am very new to this:p

Last edited by pagey; 10-27-2012 at 05:26.
pagey is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 10-27-2012 , 05:35   Re: Help with cvar
Reply With Quote #2

Quote:
Originally Posted by pagey View Post
So i have been googleing searching on forums for like 3 hours now
and it won't work ..
so what i am doing is a plugin that blocks WTJ (winning team join) usally used in Hide N Seek
so i made so it blocked so that you cant type jointeam 1,2,3,4,5,6 (i have a plugin that makes you join a team directly on join) and i have done so that when you type it a message in chat appears and you get kicked but i want to make a cvar so i can change the reason when kicked. this is the code

Code:
public plugin_init() {
	
	register_plugin("AntiWTJ", "1.1", "Pagey")
	
	register_clcmd("jointeam 1", "jointeam")
	register_clcmd("jointeam 2", "jointeam")
	register_clcmd("jointeam 5", "jointeam")
	register_clcmd("jointeam 6", "jointeam")
	register_srvcmd ("awtj_reason" , "Do not WTJ")
}


public jointeam(id)
{
	new cReason[32]
	
	new szName[32];
	get_user_name(id, szName, charsmax(szName)); //sizeof (szName - 1)
	get_cvar_string ( "awtj_reason" , cReason, 31 )
	server_cmd("kick %s %s", szName, cReason );
	
	
	set_hudmessage(49, 172, 8, 0.32, 0.40, 0, 6.0, 12.0)
	ColorChat(0, GREY, "^x01**^x04JoinTeam: ^x03 %s Got kicked for trying to WTJ", szName);
	
	
}
I cant get it to work.. :/
i am very new to this:p
PHP Code:
register_cvar"awtj_reason""" );

new 
String512 ];
get_cvar_string"awtj_reason"String511 ); 
__________________
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
pagey
Junior Member
Join Date: Oct 2012
Old 10-27-2012 , 05:42   Re: Help with cvar
Reply With Quote #3

Thank you so much claudiuhks!
you are awesome dude

Last edited by pagey; 10-27-2012 at 05:43.
pagey is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 10-27-2012 , 07:22   Re: Help with cvar
Reply With Quote #4

PHP Code:
server_cmd("kick %s %s"szNamecReason ); 
Should be:

PHP Code:
message_beginMSG_ONE_UNRELIABLESVC_DISCONNECT_id );
write_stringcReason );
message_end( ); 
Or:

PHP Code:
server_cmd"kick #%d  %s"get_user_useridid ), cReason ); 
__________________

Last edited by claudiuhks; 10-27-2012 at 07:23.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
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 20:27.


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