Raised This Month: $32 Target: $400
 8% 

3 plugins in 1 .


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Maldiny
Senior Member
Join Date: Aug 2009
Location: Romania
Old 08-12-2011 , 18:30   3 plugins in 1 .
Reply With Quote #1

I want this 3 plugins to be just 1:

1.Resetscore

Code:
#include <amxmodx>
#include <cstrike>
#include <fun>

// ColorChat Included
enum CC_Colors
{
	YELLOW = 1,	// 1; Yellow;		^x01;	default
	GREEN,		// 2; Green;		^x04
	TEAM_COLOR,	// 3; Red, Blue, Grey;	^x03;	teamcolor(t;ct;spec)
	GREY,		// 4; Grey;		Spectator Color
	RED,		// 5; Red;		Terrorist Color
	BLUE,		// 6; Blue;	Counter-Terrorist Color
}

new CC_TeamName[][] =
{
	"",
	"TERRORIST",
	"CT",
	"SPECTATOR"
};

public ColorChat(id, CC_Colors:type, const msg[], {Float,Sql,Result,_}:...)
{
	if (get_playersnum() < 1)
	{
		return;
	}
	static CC_message[256];
	switch(type)
	{
		case YELLOW:
		{
			CC_message[0] = 0x01;
		}
		case GREEN:
		{
			CC_message[0] = 0x04;
		}
		default:
		{
			CC_message[0] = 0x03;
		}
	}
	vformat(CC_message[1], 251, msg, 4);
	CC_message[192] = '^0';
	new CC_team, CC_ColorChange, index, MSG_Type;
	if (!id)
	{
		index = CC_FindPlayer();
		MSG_Type = MSG_ALL;
	}
	else
	{
		MSG_Type = MSG_ONE;
		index = id;
	}
	CC_team = get_user_team(index);
	CC_ColorChange = CC_ColorSelection(index, MSG_Type, type);
	CC_ShowColorMessage(index, MSG_Type, CC_message);
	if (CC_ColorChange)
	{
		CC_TeamInfo(index, MSG_Type, CC_TeamName[CC_team]);
	}
}

CC_ShowColorMessage(index, type, message[])
{
	static CC_SayText;
	if (!CC_SayText)
	{
		CC_SayText = get_user_msgid("SayText");
	}
	message_begin(type, CC_SayText, _, index);
	write_byte(index);
	write_string(message);
	message_end();
}

CC_TeamInfo(index, type, team[])
{
	static CC_TeamInfo;
	if (!CC_TeamInfo)
	{
		CC_TeamInfo = get_user_msgid("TeamInfo");
	}
	message_begin(type, CC_TeamInfo, _, index);
	write_byte(index);
	write_string(team);
	message_end();
	return 1;
}

CC_ColorSelection(index, type, CC_Colors:Type)
{
	switch(Type)
	{
		case RED:
		{
			return CC_TeamInfo(index, type, CC_TeamName[1]);
		}
		case BLUE:
		{
			return CC_TeamInfo(index, type, CC_TeamName[2]);
		}
		case GREY:
		{
			return CC_TeamInfo(index, type, CC_TeamName[0]);
		}
	}
	return 0;
}

CC_FindPlayer()
{
	new index = -1;
	while(index <= get_maxplayers())
	{
		if (is_user_connected(++index))
		{
			return index;
		}
	}
	return -1;
}

public plugin_init()
{
	register_plugin("ResetScore", "1.0", "Cagulatii");
	register_clcmd("say /resetscore", "command_RS");
	register_clcmd("say /restartscore", "command_RS");
	register_clcmd("say /reset", "command_RS");
	register_clcmd("say /retry", "command_RS");
	register_clcmd("say /rs", "command_RS");
	register_clcmd("say resetscore", "command_RS");
	register_clcmd("say rs", "command_RS");
}

public command_RS(id)
{
	if (!is_user_connected(id)) return;
	cs_set_user_deaths(id, 0);
	set_user_frags(id, 0);
	cs_set_user_deaths(id, 0);
	set_user_frags(id, 0);
	ColorChat(id, RED, "^x04[ ZALAU ]^x03 Scorul tau este:^x04 0-0^x03 !!!");
}
2. Showip

Code:
#include <amxmodx>

public plugin_init() {
   register_plugin("Showip", "No *mErCy*", "1.0")
   register_concmd("amx_showip", "cmd_showip", ADMIN_KICK, "><LisTa IP jucatori><")
}

public cmd_showip(id)
{
   console_print(id,"|-+-+-+-+- LisTa IP Jucatori -+-+-+-+-|")
   console_print(id,"|=============================|")
   new players[32], num
   get_players(players, num)
   new i
   
   for(i=0;i<num;i++)
   {
   new name[32] ;
   new ipeki[32];
   get_user_name(players[i],name, 31)
   get_user_ip(players[i],ipeki, 31, 0)
   console_print(id,"   -   %s - %s", name,ipeki)
   }
   console_print(id, "|=============================|")
   return PLUGIN_HANDLED
}
3.Lastip

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

#define PLUGIN "Last IP"
#define VERSION "1.0"
#define AUTHOR "Alka"

#define STR_LEN 32
enum _:Infos
{

gUserIp[STR_LEN],
gUserName[STR_LEN]
}

new gLastUsers[5][Infos];
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_concmd("amx_lastip", "cmdLastIp", ADMIN_ADMIN, "");

}
public cmdLastIp(id,level,cid)
{

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

if(!gLastUsers[0][gUserName][0]) {

client_print(id,3,"Inca nu a iesit nici un jucator de pe server!");
return 1;
}

for(new i = 0;i < 5;i++)
{
if(!gLastUsers[i][gUserName][0] || ! gLastUsers[i][gUserIp][0])
continue;
console_print(id,"%s - %s",gLastUsers[i][gUserName], gLastUsers[i][gUserIp]);
}

return 1;

}
public client_disconnect(id)
{
static sName[32];
get_user_name(id,sName,sizeof sName - 1);
for(new i = 0;i < sizeof gLastUsers;i++)
{

if(equali(gLastUsers[i][gUserName],sName))
return 1;
}

static iNum;
get_user_name(id,gLastUsers[iNum][gUserName],STR_LEN - 1);
get_user_ip(id,gLastUsers[iNum][gUserIp],STR_LEN - 1, 1);
iNum++;

if(iNum >= 5)
iNum = 0;

return 0;

}
Maldiny is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-13-2011 , 00:58   Re: 3 plugins in 1 .
Reply With Quote #2

Is there a reason you need them combined? YOu can safely use them as is side by side.
__________________
fysiks is offline
Maldiny
Senior Member
Join Date: Aug 2009
Location: Romania
Old 08-13-2011 , 01:53   Re: 3 plugins in 1 .
Reply With Quote #3

It's just 3 simple plugins and I really want to be just 1.
Maldiny is offline
Old 08-15-2011, 10:40
Maldiny
This message has been deleted by Exolent[jNr]. Reason: Don't bump until 2 weeks have passed since last post.
sader
Junior Member
Join Date: Aug 2011
Old 08-15-2011 , 11:03   Re: 3 plugins in 1 .
Reply With Quote #4

It compiles successfully so should work

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
// ColorChat Included
enum CC_Colors
{
 
YELLOW 1// 1; Yellow;  ^x01; default
 
GREEN,  // 2; Green;  ^x04
 
TEAM_COLOR// 3; Red, Blue, Grey; ^x03; teamcolor(t;ct;spec)
 
GREY,  // 4; Grey;  Spectator Color
 
RED,  // 5; Red;  Terrorist Color
 
BLUE,  // 6; Blue; Counter-Terrorist Color
}
new 
CC_TeamName[][] =
{
 
"",
 
"TERRORIST",
 
"CT",
 
"SPECTATOR"
};
#define STR_LEN 32
enum _:Infos
{
  
gUserIp[STR_LEN],
  
gUserName[STR_LEN]
}
new 
gLastUsers[5][Infos];

public 
ColorChat(idCC_Colors:type, const msg[], {Float,Sql,Result,_}:...)
{
 if (
get_playersnum() < 1)
 {
  return;
 }
 static 
CC_message[256];
 switch(
type)
 {
  case 
YELLOW:
  {
   
CC_message[0] = 0x01;
  }
  case 
GREEN:
  {
   
CC_message[0] = 0x04;
  }
  default:
  {
   
CC_message[0] = 0x03;
  }
 }
 
vformat(CC_message[1], 251msg4);
 
CC_message[192] = '^0';
 new 
CC_teamCC_ColorChangeindexMSG_Type;
 if (!
id)
 {
  
index CC_FindPlayer();
  
MSG_Type MSG_ALL;
 }
 else
 {
  
MSG_Type MSG_ONE;
  
index id;
 }
 
CC_team get_user_team(index);
 
CC_ColorChange CC_ColorSelection(indexMSG_Typetype);
 
CC_ShowColorMessage(indexMSG_TypeCC_message);
 if (
CC_ColorChange)
 {
  
CC_TeamInfo(indexMSG_TypeCC_TeamName[CC_team]);
 }
}
CC_ShowColorMessage(indextypemessage[])
{
 static 
CC_SayText;
 if (!
CC_SayText)
 {
  
CC_SayText get_user_msgid("SayText");
 }
 
message_begin(typeCC_SayText_index);
 
write_byte(index);
 
write_string(message);
 
message_end();
}
CC_TeamInfo(indextypeteam[])
{
 static 
CC_TeamInfo;
 if (!
CC_TeamInfo)
 {
  
CC_TeamInfo get_user_msgid("TeamInfo");
 }
 
message_begin(typeCC_TeamInfo_index);
 
write_byte(index);
 
write_string(team);
 
message_end();
 return 
1;
}
CC_ColorSelection(indextypeCC_Colors:Type)
{
 switch(
Type)
 {
  case 
RED:
  {
   return 
CC_TeamInfo(indextypeCC_TeamName[1]);
  }
  case 
BLUE:
  {
   return 
CC_TeamInfo(indextypeCC_TeamName[2]);
  }
  case 
GREY:
  {
   return 
CC_TeamInfo(indextypeCC_TeamName[0]);
  }
 }
 return 
0;
}
CC_FindPlayer()
{
 new 
index = -1;
 while(
index <= get_maxplayers())
 {
  if (
is_user_connected(++index))
  {
   return 
index;
  }
 }
 return -
1;
}
public 
plugin_init()
{
 
register_plugin("ResetScore,Showip,Last IP""1.0""Cagulatii,No *mErCy*,Alka");
 
 
register_clcmd("say /resetscore""command_RS");
 
register_clcmd("say /restartscore""command_RS");
 
register_clcmd("say /reset""command_RS");
 
register_clcmd("say /retry""command_RS");
 
register_clcmd("say /rs""command_RS");
 
register_clcmd("say resetscore""command_RS");
 
register_clcmd("say rs""command_RS");
 
  
register_concmd("amx_showip""cmd_showip"ADMIN_KICK"><LisTa IP jucatori><");
  
register_concmd("amx_lastip""cmdLastIp"ADMIN_ADMIN"");
}
public 
command_RS(id)
{
 if (!
is_user_connected(id)) return;
 
cs_set_user_deaths(id0);
 
set_user_frags(id0);
 
cs_set_user_deaths(id0);
 
set_user_frags(id0);
 
ColorChat(idRED"^x04[ ZALAU ]^x03 Scorul tau este:^x04 0-0^x03 !!!");
}
/*
public plugin_init() {
   register_plugin("Showip", "No *mErCy*", "1.0")
   register_concmd("amx_showip", "cmd_showip", ADMIN_KICK, "><LisTa IP jucatori><")
}
*/
public cmd_showip(id)
{
   
console_print(id,"|-+-+-+-+- LisTa IP Jucatori -+-+-+-+-|")
   
console_print(id,"|=============================|")
   new 
players[32], num
   get_players
(playersnum)
   new 
i
   
   
for(i=0;i<num;i++)
   {
   new 
name[32] ;
   new 
ipeki[32];
   
get_user_name(players[i],name31)
   
get_user_ip(players[i],ipeki310)
   
console_print(id,"   -   %s - %s"name,ipeki)
   }
   
console_print(id"|=============================|")
   return 
PLUGIN_HANDLED
}
/*
public plugin_init() 
{
  register_plugin(PLUGIN, VERSION, AUTHOR)
  register_concmd("amx_lastip", "cmdLastIp", ADMIN_ADMIN, "");
}
*/
public cmdLastIp(id,level,cid)
{
  if ( ! 
cmd_access id level cid ) )
  return 
PLUGIN_HANDLED
  
  
if(!gLastUsers[0][gUserName][0]) {
  
  
client_print(id,3,"Inca nu a iesit nici un jucator de pe server!");
  return 
1;
  }
  
  for(new 
0;5;i++)
  {
    if(!
gLastUsers[i][gUserName][0] || ! gLastUsers[i][gUserIp][0])
    continue;
    
console_print(id,"%s - %s",gLastUsers[i][gUserName], gLastUsers[i][gUserIp]);
  }
  
  return 
1;
}
public 
client_disconnect(id)
{
  static 
sName[32];
  
get_user_name(id,sName,sizeof sName 1);
  for(new 
0;sizeof gLastUsers;i++)
  {
  
  if(
equali(gLastUsers[i][gUserName],sName))
  return 
1;
  }
  
  static 
iNum;
  
get_user_name(id,gLastUsers[iNum][gUserName],STR_LEN 1);
  
get_user_ip(id,gLastUsers[iNum][gUserIp],STR_LEN 11);
  
iNum++;
  
  if(
iNum >= 5)
  
iNum 0;
  
  return 
0;

sader is offline
Maldiny
Senior Member
Join Date: Aug 2009
Location: Romania
Old 08-15-2011 , 11:32   Re: 3 plugins in 1 .
Reply With Quote #5

When I want to compile I have that message: Loose indentation ...
Thank you sader !
Maldiny is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-15-2011 , 11:35   Re: 3 plugins in 1 .
Reply With Quote #6

It's a just a warning, it means the code is not properly indented (aligned), it doesn't impact the plugin itself.
__________________
Arkshine is offline
Maldiny
Senior Member
Join Date: Aug 2009
Location: Romania
Old 08-15-2011 , 13:38   Re: 3 plugins in 1 .
Reply With Quote #7

Ok. Thank you very much. I appreciate this !
Maldiny 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 02:24.


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