Raised This Month: $ Target: $400
 0% 

[REQ] Ask4Tag Modification


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
nikhilparab
Member
Join Date: Mar 2016
Old 05-07-2016 , 02:11   [REQ] Ask4Tag Modification
Reply With Quote #1

By default this ask for player to put tag when player connect to server. I want admins should not be asked for tag.

PHP Code:
#include < amxmisc > 
#include < cstrike > 

#define PREFIX "TAG*" 

public plugin_init() 

    
register_plugin("askfortag""1.3","pocoyo"
     


public 
client_putinserver(id

    
set_task(12.0"tagmenu"id


public 
name(id

    new 
pname[100
    new 
newname[70
     
    
get_user_info(id"name"pname49
     
    
format(newname69"%s %s"PREFIXpname)     
    
set_user_info(id"name"newname
    return 
PLUGIN_CONTINUE 


public 
tagmenu(id,level,cid

    if(!
cmd_access(id,level,cid,1)) 
        return 
PLUGIN_HANDLED 
     
    
new Menu menu_create("\yQueres usar a nossa tag?^n\rby pocoyo""showmenu"
    
menu_additem(Menu"\wSim""1"0
    
menu_additem(Menu"\wNao""2"0
    
menu_display(idMenu
    return 
PLUGIN_HANDLED 

public 
showmenu(idMenuitem

    if(
item == MENU_EXIT
        return 
PLUGIN_HANDLED 
    
new iData[6];   
    new 
iAccess;  
    new 
iCallback;  
    new 
iName[64];  
    
menu_item_getinfo(Menu item iAccess iData iName63 iCallback 
     
    switch (
str_to_num(iData))  
    {  
        case 
: {              
            
name(id
        } 
        case 
: { 
            
menu_destroy(Menu
        } 
    } 

nikhilparab is offline
GordonFreeman (RU)
Veteran Member
Join Date: Jan 2010
Location: Uzbekistan
Old 05-07-2016 , 03:13   Re: [REQ] Ask4Tag Modification
Reply With Quote #2

You can add is_user_admin check in client_putinserver.
__________________
The functional way is the right way
GordonFreeman (RU) is offline
nikhilparab
Member
Join Date: Mar 2016
Old 05-07-2016 , 04:07   Re: [REQ] Ask4Tag Modification
Reply With Quote #3

Quote:
Originally Posted by GordonFreeman (RU) View Post
You can add is_user_admin check in client_putinserver.
I am not a scripter still i tried editing plugin got compiled with two warnings and plugin is not working.

ERROR:
PHP Code:
//AMXXPC compile.exe
// by the AMX Mod X Dev Team


//// tag.sma
// J:\G Drive\Pranav\Backup CS1.6\amxmodx-1.8.2-base-windows\addons\amxmodx\scri
pting\tag.sma(22) : warning 209: function "client_putinserver" should return a v
alue
// J:\G Drive\Pranav\Backup CS1.6\amxmodx-1.8.2-base-windows\addons\amxmodx\scri
pting\tag.sma(66) : warning 209: function "showmenu" should return a value
// Header size:            544 bytes
// Code size:             2496 bytes
// Data size:              672 bytes
// Stack/heap size:      16384 bytes; max. usage is unknown, due to recursion
// Total requirements:   20096 bytes
//
// 2 Warnings.
// Done.
//
// Compilation Time: 0.08 sec
// ----------------------------------------

Press enter to exit ... 

CODE :
PHP Code:
#include < amxmisc > 
#include < cstrike > 

#define PREFIX "TAG*" 

public plugin_init() 

    
register_plugin("askfortag""1.3","pocoyo")
     


public 
client_putinserver(id)
{
   if(
is_user_admin(id) && (!access(idADMIN_KICK)))
     {
         
set_task(12.0"tagmenu"id)
     }
   else
     {
         return 
PLUGIN_HANDLED;
     }
}

public 
name(id

    new 
pname[100
    new 
newname[70
     
    
get_user_info(id"name"pname49
     
    
format(newname69"%s %s"PREFIXpname)     
    
set_user_info(id"name"newname
    return 
PLUGIN_CONTINUE 


public 
tagmenu(id,level,cid

    if(!
cmd_access(id,level,cid,1)) 
        return 
PLUGIN_HANDLED 
     
    
new Menu menu_create("\yQueres usar a nossa tag?^n\rby pocoyo""showmenu")  
    
menu_additem(Menu"\wSim""1"0)  
    
menu_additem(Menu"\wNao""2"0)  
    
menu_display(idMenu
    return 
PLUGIN_HANDLED 

public 
showmenu(idMenuitem

    if(
item == MENU_EXIT
        return 
PLUGIN_HANDLED 
    
new iData[6];   
    new 
iAccess;  
    new 
iCallback;  
    new 
iName[64];  
    
menu_item_getinfo(Menu item iAccess iData iName63 iCallback 
     
    switch (
str_to_num(iData))  
    {  
        case 
: {              
            
name(id
        } 
        case 
: { 
            
menu_destroy(Menu
        } 
    } 

nikhilparab is offline
GordonFreeman (RU)
Veteran Member
Join Date: Jan 2010
Location: Uzbekistan
Old 05-07-2016 , 04:55   Re: [REQ] Ask4Tag Modification
Reply With Quote #4

Code:
if(!is_user_admin(id))
{
    set_task(12.0, "tagmenu", id)
}
else
{
    return PLUGIN_HANDLED;
}
__________________
The functional way is the right way
GordonFreeman (RU) is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 05-12-2016 , 09:52   Re: [REQ] Ask4Tag Modification
Reply With Quote #5

PHP Code:
#include < amxmisc > 
#include < cstrike > 

#define PREFIX "TAG*" 

public plugin_init() 

    
register_plugin("askfortag""1.3","pocoyo"
     


public 
client_putinserver(id
{
    if(
is_user_admin(id)) {
        return 
PLUGIN_HANDLED
    
}
    
set_task(12.0"tagmenu"id


public 
name(id

    new 
pname[100
    new 
newname[70
     
    
get_user_info(id"name"pname49
     
    
format(newname69"%s %s"PREFIXpname)     
    
set_user_info(id"name"newname
    return 
PLUGIN_CONTINUE 


public 
tagmenu(id,level,cid

    if(!
cmd_access(id,level,cid,1)) 
        return 
PLUGIN_HANDLED 
     
    
new Menu menu_create("\yQueres usar a nossa tag?^n\rby pocoyo""showmenu"
    
menu_additem(Menu"\wSim""1"0
    
menu_additem(Menu"\wNao""2"0
    
menu_display(idMenu
    return 
PLUGIN_HANDLED 

public 
showmenu(idMenuitem

    if(
item == MENU_EXIT
        return 
PLUGIN_HANDLED 
    
new iData[6];   
    new 
iAccess;  
    new 
iCallback;  
    new 
iName[64];  
    
menu_item_getinfo(Menu item iAccess iData iName63 iCallback 
     
    switch (
str_to_num(iData))  
    {  
        case 
: {              
            
name(id
        } 
        case 
: { 
            
menu_destroy(Menu
        } 
    } 

This should do.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 05-12-2016 , 12:24   Re: [REQ] Ask4Tag Modification
Reply With Quote #6

Oh my godness, are you guys make bad jokes about him?
He clearly said that wants to be checked flag ADMIN_KICK and you are continuing to give code with is_user_admin.

This is the code he needs:

PHP Code:
#include <amxmodx> 

new const PREFIX[] = "TAG*"  

public plugin_init()  
{  
    
register_plugin("askfortag""1.3","pocoyo")  
}  

public 
client_putinserver(id

   if(!(
get_user_flags(id) & ADMIN_KICK)) 
      
set_task(12.0"tagmenu"id


public 
client_disconnect(id){

 if(
task_exists(id))
 
remove_task(id)
}

public 
name(id)  
{  
    new 
pname[100]  
    new 
newname[70]  
      
    
get_user_info(id"name"pname49)  
      
    
format(newname69"%s %s"PREFIXpname)      
    
set_user_info(id"name"newname)  
    return 
PLUGIN_CONTINUE  
}  

public 
tagmenu(id)  
{  
    new 
Menu menu_create("\yQueres usar a nossa tag?^n\rby pocoyo""showmenu")   
    
menu_additem(Menu"\wSim""1"0)   
    
menu_additem(Menu"\wNao""2"0)   
    
menu_display(idMenu)  
    return 
PLUGIN_HANDLED  
}  
public 
showmenu(idMenuitem)  
{  
    if(
item == MENU_EXIT){
    
menu_destroy(Menu)     
    return 
PLUGIN_HANDLED
    
}
    
    new 
iData[6];    
    new 
iAccess;   
    new 
iCallback;   
    new 
iName[64];   
    
menu_item_getinfo(Menu item iAccess iData iName63 iCallback )  
      
    if(
str_to_num(iData) == 1)
      
name(id)      
     
    
menu_destroy(Menu
    return 
PLUGIN_HANDLED    


And a tip: don't include modules if you don't use them in the plugin. (such amxmisc and cstrike)

Last edited by siriusmd99; 05-12-2016 at 12:25.
siriusmd99 is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 05-12-2016 , 16:23   Re: [REQ] Ask4Tag Modification
Reply With Quote #7

lol just copy pasted his code sorry mr.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
quark
Veteran Member
Join Date: Oct 2011
Location: Your mind.
Old 05-14-2016 , 09:27   Re: [REQ] Ask4Tag Modification
Reply With Quote #8

You shouldn't change the credits

__________________

Check out My Plugins:
qServerInfo ; ASKTAG
quark 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 14:55.


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