AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   weapon don't change (https://forums.alliedmods.net/showthread.php?t=187389)

yamin 06-12-2012 14:52

weapon don't change
 
why this engclient_cmd( id, "weapon_usp" ); don't work?

Exolent[jNr] 06-12-2012 15:02

Re: weapon don't change
 
You need to stop making a hundred topics for this 1 plugin.

ConnorMcLeod 06-12-2012 16:58

Re: weapon don't change
 
PHP Code:

 register_clcmd"amx_knife","giveweapon");
 
register_concmd("amx_knife""ConCmd_BlockBuy"ADMIN_MAP);
 
register_clcmd"amx_knife""ClientCommand_Knife",ADMIN|SILVER|GOLDEN"- start knife round" ); 

I think it could be a problem to register same command with 3 different handlers, depending on what you return in them.
Make only 1 callback.

yamin 06-13-2012 07:06

Re: weapon don't change
 
how will i do it on 1 callback?

Backstabnoob 06-13-2012 07:07

Re: weapon don't change
 
Remove the second and third command and change the content of the "giveweapon" handler.

You can check the flags there with get_user_flags.

yamin 06-13-2012 07:44

Re: weapon don't change
 
can you add here?
PHP Code:

#include < amxmodx >
#include < amxmisc >
#include < hamsandwich >
#include < fun >
#include < cstrike >
#include <fakemeta_util>
#define ADMIN   ADMIN_RCON 
#define SILVER  ADMIN_LEVEL_G 
#define GOLDEN  ADMIN_LEVEL_H 
#define SetUserAdmin(%0)      ( gBitAdmin |= ( 1 << ( %0 & 31 ) ) )
#define ClearUserAdmin(%0)    ( gBitAdmin &= ( ~( 1 << ( %0 & 31 ) ) ) )
#define IsAdmin(%0)           ( gBitAdmin & ( 1 << ( %0 & 31 ) ) )
enum ChatColor 

CHATCOLOR_NORMAL 1
CHATCOLOR_GREEN
CHATCOLOR_TEAM_COLOR
CHATCOLOR_GREY,      
CHATCOLOR_RED,    
CHATCOLOR_BLUE,      
}
new 
bool:g_bBuyBlocked
new gBlocked;
new 
gBitAdmin;
new 
uflags[33];
public 
client_putinserver(id){ 
if(
get_user_flags(id)&ADMIN
 
uflags[id] = ADMIN 
 
else if(get_user_flags(id)&GOLDEN
  
uflags[id] = GOLDEN 
 
else if(get_user_flags(id)&SILVER
  
uflags[id] = SILVER 
 
else 
  
uflags[id] = 

public 
plugin_init( )
{
 
register_event"CurWeapon""eCurWeapon""be""1=1""2!29" );
 
register_event"HLTV""eNewRound""a""1=0""2=0" );
 
register_event("HLTV""Event_HLTV_New_Round""a""1=0""2=0");
 
 
register_concmd("amx_knife""ConCmd_BlockBuy"ADMIN_MAP);
 
register_clcmd"amx_knife""ClientCommand_Knife",ADMIN|SILVER|GOLDEN"- start knife round" );
}
public 
ClientCommand_Knifeidlevelcid )
{
 if( !
cmd_accessidlevelcid) )
  return 
PLUGIN_HANDLED;
 
 if( 
gBlocked )
  return 
PLUGIN_HANDLED;
   
   
 
 
gBlocked true;    
 new 
szName[32],level[10];
 
get_user_nameidszName31 );
 
get_level_by_flag(id,level);
 
 
 
colorChat(0,CHATCOLOR_NORMAL,"$g[$tSoloGunner$g]$n SoloGunner activated by $g%s$n $g[$t%s$g]",szName,level
 return 
PLUGIN_HANDLED
}
public 
eCurWeaponid )
{
 if( 
gBlocked )
 {
  if(!
IsAdmin(id))
  {
   
engclient_cmdid"weapon_usp" );
  }
  
  else
  {
   if( 
read_data) != CSW_USP )
   {
    
engclient_cmdid"weapon_knife" );
   }
  }
 }
}
public 
ConCmd_BlockBuy(idlvlcid

    if( 
cmd_access(idlvlcid0) ) 
{
    
engclient_cmdid"weapon_usp" );
    
fm_give_itemid,"weapon_usp" );
    
cs_set_user_bpammo(id,CSW_USP,12);
   }    

        
g_bBuyBlocked true 
    

    return 
PLUGIN_HANDLED 


public 
Event_HLTV_New_Round() 

    if( 
g_bBuyBlocked 
    { 
        
g_bBuyBlocked false 
    



public 
client_buy(iditem

    if( 
g_bBuyBlocked 
    { 
        
client_print(idprint_chat"*** Buy is restricted for this round"
        return 
PLUGIN_HANDLED 
    

    return 
PLUGIN_CONTINUE 
}
public 
eNewRound( )
{
 
gBlocked false;
}
get_level_by_flag(id,level[]){ 
 switch(
uflags[id]){ 
  case 
ADMINcopy(level,9,"ADMIN"
   case 
SILVERcopy(level,9,"SILVER"
   case 
GOLDENcopy(level,9,"GOLDEN"
  } 

colorChat(idChatColor:color, const msg[], {Float,Sql,Result,_}:...) 

new 
teamindexMSG_Type 
new bool:teamChanged false 
static message[192
switch(
color

 case 
CHATCOLOR_NORMAL// Normal 
 

  
message[0] = 0x01
 } 
 case 
CHATCOLOR_GREEN// Green 
 

  
message[0] = 0x04
 } 
 default: 
// Grey, Red, Blue 

 
message[0] = 0x03


vformat(message[1], 190msg4); 
replace_all(message190"$g""^x04"
replace_all(message190"$n""^x01"
replace_all(message190"$t""^x03"
if(
id == 0

index findAnyPlayer() 
MSG_Type MSG_ALL

else 

index id
MSG_Type MSG_ONE

if(
index != 0

team get_user_team(index);     
if(
color == CHATCOLOR_RED && team != 1

 
messageTeamInfo(indexMSG_Type"TERRORIST"
 
teamChanged true 

else 
 if(
color == CHATCOLOR_BLUE && team != 2
 { 
  
messageTeamInfo(indexMSG_Type"CT"
  
teamChanged true 
 

 else 
  if(
color == CHATCOLOR_GREY && team != 0
  { 
   
messageTeamInfo(indexMSG_Type,""
   
teamChanged true 
  
}
messageSayText(indexMSG_Typemessage);
if(
teamChanged
  { 
   
messageTeamInfo(indexMSG_Type"SPECTATOR")  
  } 
 } 

messageSayText(idtypemessage[]) 

message_begin(typeget_user_msgid("SayText"), _id
write_byte(id)     
write_string(message
message_end() 

messageTeamInfo(idtypeteam[]) 

message_begin(typeget_user_msgid("TeamInfo"), _id
write_byte(id
write_string(team
message_end() 

findAnyPlayer() 

static 
players[32], inumpid 
get_players
(playersinum"ch"
for (new 
0inuma++) 

pid players[a
if(
is_user_connected(pid)) 
return 
pid 

return 




wickedd 06-13-2012 11:11

Re: weapon don't change
 
Post in the request section.


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

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