Cum pun un "timp" de folosire la o comanda

Discutii legate de instalarea, configurarea si modificarea unui server de Counter-Strike.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
PabuLetz
Membru, skill +1
Membru, skill +1
Posts: 116
Joined: 22 Jun 2011, 15:17
Detinator Steam: Nu
CS Status: Hns.OneGame.Ro
Has thanked: 1 time
Been thanked: 3 times
Contact:

10 Nov 2012, 09:44

Salutare,de ceva vreme m-am apucat sa creez un Vip System pentru HidenSeek dar am o problema,am adaugat totu-l meniul etc... dar problema este urmatoarea: Comanda o poti folosi de fiecare data cand dai /vipmenu ee... eu vreau sa o foloseasca o data pe runda sau mai usor o data la un minut,depinde cum puteti sa ma ajutati :)

Multumesc anticipat
RoyalServer 2
User avatar
oneeightone
Fost moderator
Fost moderator
Posts: 2547
Joined: 17 Jul 2009, 19:29
Detinator Steam: Da
Reputatie: Fost super moderator
Membru Club eXtreamCS (o luna)
Nick anterior : LiGHTERS
0.3 / 3
Has thanked: 68 times
Been thanked: 521 times

10 Nov 2012, 13:37

Posteaza .sma-ul.
PabuLetz
Membru, skill +1
Membru, skill +1
Posts: 116
Joined: 22 Jun 2011, 15:17
Detinator Steam: Nu
CS Status: Hns.OneGame.Ro
Has thanked: 1 time
Been thanked: 3 times
Contact:

10 Nov 2012, 15:51

Code: Select all

#include <amxmodx>
#include <fun>
#include <amxmisc>
#include <cstrike>
			
new plugin_on
enum Color
{
	NORMAL = 1, // clients scr_concolor cvar color
	GREEN, // Green Color
	TEAM_COLOR, // Red, grey, blue
	GREY, // grey
	RED, // Red
	BLUE, // Blue
}

new TeamName[][] = 
{
	"",
	"TERRORIST",
	"CT",
	"SPECTATOR"
}

public plugin_init(){

    register_plugin("VIP MENU", "1.1", "dragosh, MIk3")
    register_menucmd(register_menuid("VIP MENU"), 1023, "setoption") 
    plugin_on = register_cvar("amx_vipmenu", "1")	

    register_clcmd("say /vipmenu","vip_menu",ADMIN_CVAR)
    register_clcmd("say_team /vipmenu","vip_menu",ADMIN_CVAR)

    register_clcmd("say /vmenu","vip_menu",ADMIN_CVAR)
    register_clcmd("say_team /vmenu","vip_menu",ADMIN_CVAR)

  
}


public vip_menu(id,level,cid) 
{
	if ( !get_pcvar_num(plugin_on) ) 
	{	
		ColorChat(id, RED, "Vip Menu is currently disabled");
		return PLUGIN_HANDLED;
	}
 
        if(!cmd_access(id,level,cid,2))
		return PLUGIN_HANDLED
		
	chooseoption(id)
	
	return PLUGIN_HANDLED
       
}

public chooseoption(id) 
{
    new menu[192] 
    new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5
    format(menu, 191, "\yVIP MENU^n^n\r1.\w Gravity^n\r2.\w Health^n\r3.\w Vip Model^n\r4.\w Armor^n\r5.\w Exit") 
    show_menu(id, keys, menu)   
    return PLUGIN_CONTINUE
}

public setoption(id, key, menu)
{

    if(key == 0) {
         new name[17]
         get_user_name(id, name, 18)
         set_user_gravity(id,0.7)
         ColorChat(0, GREEN, "^x04[VIP] ^x03%s^x01 has purchased ^x04gravity^x01 (700)", name)
         return PLUGIN_HANDLED
    }

    if(key == 1) {
         new name[17]
         get_user_name(id, name, 18)
         set_user_health(id, 150)
         ColorChat(0, GREEN, "^x04[VIP] ^x03%s^x01 has purchased^x04 150hp", name)
         return PLUGIN_HANDLED

    }

    if(key == 2) {
         new name[17]
         get_user_name(id, name, 18)
         cs_set_user_model(id, "vip")
         ColorChat(id, TEAM_COLOR, "^x04[VIP] ^x03%s^x01 has set a ^x03VIP model", name)
         return PLUGIN_HANDLED
    }

    if(key == 4) {
         new name[17]
         get_user_name(id, name, 18)
         set_user_armor(id, 150)
         ColorChat(0, GREEN, "^x04[VIP] ^x03%s^x01 has purchased^x04 armor", name)
         return PLUGIN_HANDLED
    }

         
    else {
         return PLUGIN_HANDLED
    }

    return PLUGIN_HANDLED
}

public plugin_precache()
{
        precache_model("models/player/vip/vip.mdl")
	return PLUGIN_CONTINUE 

}

ColorChat(id, Color:type, const msg[], {Float,Sql,Result,_}:...)
{
	new message[256];

	switch(type)
	{
		case NORMAL: // clients scr_concolor cvar color
		{
			message[0] = 0x01;
		}
		case GREEN: // Green
		{
			message[0] = 0x04;
		}
		default: // White, Red, Blue
		{
			message[0] = 0x03;
		}
	}

	vformat(message[1], 251, msg, 4);

	// Make sure message is not longer than 192 character. Will crash the server.
	message[192] = '^0';

	new team, ColorChange, index, MSG_Type;
	
	if(id)
	{
		MSG_Type = MSG_ONE;
		index = id;
	} else {
		index = FindPlayer();
		MSG_Type = MSG_ALL;
	}
	
	team = get_user_team(index);
	ColorChange = ColorSelection(index, MSG_Type, type);

	ShowColorMessage(index, MSG_Type, message);
		
	if(ColorChange)
	{
		Team_Info(index, MSG_Type, TeamName[team]);
	}
}

ShowColorMessage(id, type, message[])
{
	static bool:saytext_used;
	static get_user_msgid_saytext;
	if(!saytext_used)
	{
		get_user_msgid_saytext = get_user_msgid("SayText");
		saytext_used = true;
	}
	message_begin(type, get_user_msgid_saytext, _, id);
	write_byte(id)		
	write_string(message);
	message_end();	
}

Team_Info(id, type, team[])
{
	static bool:teaminfo_used;
	static get_user_msgid_teaminfo;
	if(!teaminfo_used)
	{
		get_user_msgid_teaminfo = get_user_msgid("TeamInfo");
		teaminfo_used = true;
	}
	message_begin(type, get_user_msgid_teaminfo, _, id);
	write_byte(id);
	write_string(team);
	message_end();

	return 1;
}

ColorSelection(index, type, Color:Type)
{
	switch(Type)
	{
		case RED:
		{
			return Team_Info(index, type, TeamName[1]);
		}
		case BLUE:
		{
			return Team_Info(index, type, TeamName[2]);
		}
		case GREY:
		{
			return Team_Info(index, type, TeamName[0]);
		}
	}

	return 0;
}

FindPlayer()
{
	new i = -1;

	while(i <= get_maxplayers())
	{
		if(is_user_connected(++i))
			return i;
	}

	return -1;
}
PabuLetz
Membru, skill +1
Membru, skill +1
Posts: 116
Joined: 22 Jun 2011, 15:17
Detinator Steam: Nu
CS Status: Hns.OneGame.Ro
Has thanked: 1 time
Been thanked: 3 times
Contact:

10 Nov 2012, 20:18

Up... cineva?
vim
Programator eXtream
Programator eXtream
Posts: 853
Joined: 29 May 2009, 19:13
Detinator Steam: Da
CS Status: Trag cu praştia !
Reputatie: Fost programator web eXtreamCS
Administrator tehnic
Sysadmin
Location: Bucureşti
Has thanked: 2 times
Been thanked: 342 times

10 Nov 2012, 21:18

bla.sma | Afiseaza codul
#include <amxmodx>
#include <fun>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>
         
new plugin_on
enum Color
{
   NORMAL = 1, // clients scr_concolor cvar color
   GREEN, // Green Color
   TEAM_COLOR, // Red, grey, blue
   GREY, // grey
   RED, // Red
   BLUE, // Blue
}

new TeamName[][] = 
{
   "",
   "TERRORIST",
   "CT",
   "SPECTATOR"
}
new CmdUsed[33]

public plugin_init(){

    register_plugin("VIP MENU", "1.1", "dragosh, MIk3")
    register_menucmd(register_menuid("VIP MENU"), 1023, "setoption") 
    plugin_on = register_cvar("amx_vipmenu", "1")   

    register_clcmd("say /vipmenu","vip_menu",ADMIN_CVAR)
    register_clcmd("say_team /vipmenu","vip_menu",ADMIN_CVAR)

    register_clcmd("say /vmenu","vip_menu",ADMIN_CVAR)
    register_clcmd("say_team /vmenu","vip_menu",ADMIN_CVAR)

    RegisterHam(Ham_Spawn, "player", "FwdHamSpawn_Post", 1)
}

public FwdHamSpawn_Post(id) 
{ 
    if (!is_user_alive(id)) 
    { 
      return PLUGIN_CONTINUE; 
    }
    
    CmdUsed[id] = false; 
    return PLUGIN_CONTINUE; 
}

public vip_menu(id,level,cid) 
{
	if ( !get_pcvar_num(plugin_on) ) 
	{   
		ColorChat(id, RED, "Vip Menu is currently disabled");
		return PLUGIN_HANDLED;
	}

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

	if(CmdUsed[id]) 
	{ 
		ColorChat(id, RED, "Vip Menu can be used only one time per round."); 
		return PLUGIN_HANDLED; 
    }

	chooseoption(id)
   
	return PLUGIN_HANDLED
}

public chooseoption(id) 
{
    new menu[192] 
    new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5
    format(menu, 191, "\yVIP MENU^n^n\r1.\w Gravity^n\r2.\w Health^n\r3.\w Vip Model^n\r4.\w Armor^n\r5.\w Exit") 
    show_menu(id, keys, menu)   
    return PLUGIN_CONTINUE
}

public setoption(id, key, menu)
{

    if(key == 0) {
		new name[17]
		get_user_name(id, name, 18)
		set_user_gravity(id,0.7)
		ColorChat(0, GREEN, "^x04[VIP] ^x03%s^x01 has purchased ^x04gravity^x01 (700)", name)
		CmdUsed[id] = true;
		return PLUGIN_HANDLED
    }

    if(key == 1) {
		new name[17]
		get_user_name(id, name, 18)
		set_user_health(id, 150)
		ColorChat(0, GREEN, "^x04[VIP] ^x03%s^x01 has purchased^x04 150hp", name)
		CmdUsed[id] = true;
		return PLUGIN_HANDLED
    }

    if(key == 2) {
		new name[17]
		get_user_name(id, name, 18)
		cs_set_user_model(id, "vip")
		ColorChat(id, TEAM_COLOR, "^x04[VIP] ^x03%s^x01 has set a ^x03VIP model", name)
		CmdUsed[id] = true;
		return PLUGIN_HANDLED
    }

    if(key == 4) {
		new name[17]
		get_user_name(id, name, 18)
		set_user_armor(id, 150)
		ColorChat(0, GREEN, "^x04[VIP] ^x03%s^x01 has purchased^x04 armor", name)
		CmdUsed[id] = true;
		return PLUGIN_HANDLED
    }

         
    else {
         return PLUGIN_HANDLED
    }

    return PLUGIN_HANDLED
}

public plugin_precache()
{
	precache_model("models/player/vip/vip.mdl")
	return PLUGIN_CONTINUE 

}

ColorChat(id, Color:type, const msg[], {Float,Sql,Result,_}:...)
{
   new message[256];

   switch(type)
   {
      case NORMAL: // clients scr_concolor cvar color
      {
         message[0] = 0x01;
      }
      case GREEN: // Green
      {
         message[0] = 0x04;
      }
      default: // White, Red, Blue
      {
         message[0] = 0x03;
      }
   }

   vformat(message[1], 251, msg, 4);

   // Make sure message is not longer than 192 character. Will crash the server.
   message[192] = '^0';

   new team, ColorChange, index, MSG_Type;
   
   if(id)
   {
      MSG_Type = MSG_ONE;
      index = id;
   } else {
      index = FindPlayer();
      MSG_Type = MSG_ALL;
   }
   
   team = get_user_team(index);
   ColorChange = ColorSelection(index, MSG_Type, type);

   ShowColorMessage(index, MSG_Type, message);
      
   if(ColorChange)
   {
      Team_Info(index, MSG_Type, TeamName[team]);
   }
}

ShowColorMessage(id, type, message[])
{
   static bool:saytext_used;
   static get_user_msgid_saytext;
   if(!saytext_used)
   {
      get_user_msgid_saytext = get_user_msgid("SayText");
      saytext_used = true;
   }
   message_begin(type, get_user_msgid_saytext, _, id);
   write_byte(id)      
   write_string(message);
   message_end();   
}

Team_Info(id, type, team[])
{
   static bool:teaminfo_used;
   static get_user_msgid_teaminfo;
   if(!teaminfo_used)
   {
      get_user_msgid_teaminfo = get_user_msgid("TeamInfo");
      teaminfo_used = true;
   }
   message_begin(type, get_user_msgid_teaminfo, _, id);
   write_byte(id);
   write_string(team);
   message_end();

   return 1;
}

ColorSelection(index, type, Color:Type)
{
   switch(Type)
   {
      case RED:
      {
         return Team_Info(index, type, TeamName[1]);
      }
      case BLUE:
      {
         return Team_Info(index, type, TeamName[2]);
      }
      case GREY:
      {
         return Team_Info(index, type, TeamName[0]);
      }
   }

   return 0;
}

FindPlayer()
{
   new i = -1;

   while(i <= get_maxplayers())
   {
      if(is_user_connected(++i))
         return i;
   }

   return -1;
}
I'm not antisocial, I'm just not user friendly.
⎯ retired
PabuLetz
Membru, skill +1
Membru, skill +1
Posts: 116
Joined: 22 Jun 2011, 15:17
Detinator Steam: Nu
CS Status: Hns.OneGame.Ro
Has thanked: 1 time
Been thanked: 3 times
Contact:

10 Nov 2012, 22:48

Multumesc foarte mult:)
Post Reply

Return to “Probleme la servere dedicate de Counter-Strike”

  • Information