Raised This Month: $ Target: $400
 0% 

command for purchase only adm


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
klysman07
Senior Member
Join Date: Oct 2011
Old 06-19-2012 , 10:46   command for purchase only adm
Reply With Quote #1

I need a command to be placed in a case.

is a command that allows only Bus "b" can buy an item from the store

type: 500 for life (just adm)


thank you
klysman07 is offline
Waleed
Senior Member
Join Date: May 2012
Location: Pakistan
Old 06-19-2012 , 11:36   Re: command for purchase only adm
Reply With Quote #2

Untested,But worked for me many time,Tell me if something is wrong,I just showed you what to do,It is not properly coded.Next time ask this in suggestion(i guess)

PHP Code:
register_clcmd("say /Check""cmd_Check"// register a clientcommand,i.e /Check or anyother

public cmd_Check(id)
{
      if(
is_user_admin(id// Only admin can use this;
{
      
//Put your code here,Everytime you type /Check in game,It will execute this code only for admins.
      // use cstrike and fun module for items and health and other stuff 



}

__________________
Working On:
  1. Gameplay 1 - 0% [PAUSED]

Last edited by Waleed; 06-19-2012 at 11:38. Reason: left some braces
Waleed is offline
Send a message via Skype™ to Waleed
klysman07
Senior Member
Join Date: Oct 2011
Old 06-19-2012 , 11:40   Re: command for purchase only adm
Reply With Quote #3

I would like to place a command in a shop.
and that item posssa only be purchased by ADM

type:

Quote:
case 1:
{
set_user_health(id, 500)

client_print( id, print_chat, "Voce comprou 500 de Vida!!")
client_print( id, print_chat, "By:Klysman =] !!")
client_cmd(id, "speak sound/GagaSong/Si.wav");
}
klysman07 is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 06-19-2012 , 11:47   Re: command for purchase only adm
Reply With Quote #4

Check the user's access flag:
PHP Code:
if(get_user_flags(id) & ADMIN_RESERVATION// flag "b"
{
// ...

__________________
<VeCo> is offline
Waleed
Senior Member
Join Date: May 2012
Location: Pakistan
Old 06-19-2012 , 11:50   Re: command for purchase only adm
Reply With Quote #5

Use spk instead of speak,But if its working with "speak",Than you can use that;
PHP Code:
client_cmd(id"spk sound/GagaSong/Si.wav"); 
This checks that,If user is admin,The code or anything below that check will be executed only for admin,Don't need to define any flag for that(i think)

PHP Code:
if(is_user_admin(id))
{
   
//Anything here would be for admins only!
   //For example:

   
give_item(id"weapon_ak47"//Will give ak47 to admins only;
   
client_print(idprint_chat"You have been given ak47|Admin gift!"//This will print the message;
   

By the way,You will be needing fun module for "give_item"
Thanks;
__________________
Working On:
  1. Gameplay 1 - 0% [PAUSED]
Waleed is offline
Send a message via Skype™ to Waleed
klysman07
Senior Member
Join Date: Oct 2011
Old 06-19-2012 , 11:51   Re: command for purchase only adm
Reply With Quote #6

Quote:
Originally Posted by <VeCo> View Post
Check the user's access flag:
PHP Code:
if(get_user_flags(id) & ADMIN_RESERVATION// flag "b"
{
// ...



can you put the command ready to be placed please

I want to flag "b"

I place before or after?

set_user_health (id, 500)
klysman07 is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 06-19-2012 , 11:52   Re: command for purchase only adm
Reply With Quote #7

Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #define PLUGIN "Crappy Plugin" #define VERSION "1.0" #define AUTHOR "CrapperCoder420" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         register_concmd("buy", "CrappyBuyFunction", ADMIN_BAN, "buy [item] [ammount]") } public CrappybuyFunction(id, level, cid) {     // This checks to see if the person who executed the command     // is in fact an admin, and passed 3 arguments into console     // 0 = command; 1 = item; 2 = ammount     // if not it simply returns out of the plugin and goes on with tis day     if(!cmd_access(id, level, cid, 3)         return PLUGIN_HANDLED             // This grabs the first argument from the command passed     // and saves it to the defined sz_item     new sz_item[32]; read_argv(1, sz_item, charsmax(sz_item) )     // This grabs the second argument from the command line     // and saves it to the defined sz_ammount string     new sz_ammount[32]; read_argv(2, sz_ammount, charsmax(sz_ammount) )     // I ignore the item because i odn't know really what you want to do     // I set sz_ammount to the ammount variable     // this is saved as an int/number/decimal using str_to_num     // which takes a string, parses it into a number, and returns it     new ammount = str_to_num(sz_ammount)     // I then return the ammount; Just to show it did something.     return ammount }
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
Aooka
Veteran Member
Join Date: Aug 2011
Location: Villeurbanne
Old 06-19-2012 , 11:57   Re: command for purchase only adm
Reply With Quote #8

Try this :
Code:
#include < amxmodx > #include < fun > public plugin_init( ) {     register_plugin( "Test" , "1.0" , "Aooka" );         register_clcmd( "say /test" , "Cmd_Test" ); } public Cmd_Test( id ) {     if( is_user_alive( id ) )     {         if( get_user_flags( id ) & ADMIN_LEVEL_B )         {             set_user_health( id , 500 );             client_cmd( id , "spk sound/GagaSong/Si.wav" );                         client_print( id , print_chat , "Voce comprou 500 de Vida!!" );             client_print( id , print_chat , "By:Klysman =] !!" );         }         else         {             client_print( id , print_chat , "You must be an Admin with the flag B" );         }     } }
__________________
Pawn ? Useless
Aooka is offline
klysman07
Senior Member
Join Date: Oct 2011
Old 06-19-2012 , 12:05   Re: command for purchase only adm
Reply With Quote #9

erro Aooka


Error: Undefined symbol "Add_Item" on line 31
Error: Undefined symbol "Add_Item" on line 32
Error: Undefined symbol "Add_Item" on line 33
Error: Undefined symbol "Add_Item" on line 34
Error: Undefined symbol "Add_Item" on line 35
Error: Undefined symbol "Add_Item" on line 36
Error: Undefined symbol "Add_Item" on line 39
Error: Undefined symbol "Add_Item" on line 40
Error: Undefined symbol "Add_Item" on line 41
Error: Undefined symbol "Add_Item" on line 42
Error: Undefined symbol "Add_Item" on line 43
Error: Undefined symbol "Add_Item" on line 44
Error: Undefined symbol "Add_Item" on line 45
Error: Undefined symbol "Add_Item" on line 46
Error: Undefined symbol "Add_Item" on line 47
Error: Undefined symbol "Add_Item" on line 48
Error: Undefined symbol "Add_Item" on line 49
Error: Undefined symbol "Add_Item" on line 50
Error: Undefined symbol "Add_Item" on line 51
Error: Undefined symbol "Add_Item" on line 52
Error: Undefined symbol "Add_Item" on line 53
Error: Undefined symbol "Add_Item" on line 54
Error: Undefined symbol "Add_Item" on line 55
Error: Undefined symbol "remove_colorMenu" on line 87
Error: Number of arguments does not match definition on line 87
Warning: Loose indentation on line 365
Error: Only a single statement (or expression) can follow each "case" on line 368

Compilation aborted.
26 Errors.

Quote:
case 1:
{
if( is_user_alive( id ) )
{
if( get_user_flags( id ) & ADMIN_LEVEL_B )
{

set_user_health(id, 500)

client_print( id, print_chat, "Voce comprou 500 de Vida!!")
client_print( id, print_chat, "By:Klysman =] !!")
client_cmd(id, "speak sound/GagaSong/Si.wav");
}
klysman07 is offline
klysman07
Senior Member
Join Date: Oct 2011
Old 06-19-2012 , 12:07   Re: command for purchase only adm
Reply With Quote #10

Warning: Loose indentation on line 357
Error: Only a single statement (or expression) can follow each "case" on line 365
Error: Empty statement on line 365
Warning: Symbol is never used: "g_iSet" on line 428

2 Errors.
klysman07 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 06:06.


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