Raised This Month: $51 Target: $400
 12% 

[CSGO] !ak47 for counter-terrorists. Need help.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Pinto
New Member
Join Date: Jun 2020
Old 09-06-2020 , 09:24   [CSGO] !ak47 for counter-terrorists. Need help.
Reply With Quote #1

This is my code but it has a lot of errors.
What I want is the plugin to remove 2700$ from the person who used the command and give the person an Ak-47, being this a VIP exclusive command.

Code:
#pragma semicolon 1

#define DEBUG

#define PLUGIN_AUTHOR ""
#define PLUGIN_VERSION "0.00"

#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike>

#pragma newdecls required

public Plugin myinfo = 
{
	name = "",
	author = PLUGIN_AUTHOR,
	description = "",
	version = PLUGIN_VERSION,
	url = ""
};

public void OnPluginStart()
{
	RegConsoleCmd("sm_ak47", Cmd_Ak47, "VIP AK.");
}

public Action Cmd_Ak47(int client, int args)
{
   if(CheckCommandAccess(client, "", ADMFLAG_CUSTOM1, false))
   {
   	ReplyToCommand("\x01[\x09Anubis\x10Community\x01] Vip only command.")
   }
   
   if(CheckCommandAccess(client, "", ADMFLAG_CUSTOM1, true))
   {
   	new clientMoney = GetEntProp(client, Prop_Send, "m_iAccount"); // Get player's current cash
   	if (clientMoney = 2700)
	   GivePlayerItem(client, "weapon_ak47");
	   ReplyToCommand("\x01[\x09Anubis\x10Community\x01] Bought an ak -2700$.")
	if (clientMoney != 2700)
	  {
	   ReplyToCommand("\x01[\x09Anubis\x10Community\x01] No enough money \x01.")
	  }
   }   
}
Pinto is offline
SSheriFF
AlliedModders Donor
Join Date: May 2020
Location: Israel
Old 09-06-2020 , 09:35   Re: [CSGO] !ak47 for counter-terrorists. Need help.
Reply With Quote #2

Quote:
Originally Posted by Pinto View Post
This is my code but it has a lot of errors.
What I want is the plugin to remove 2700$ from the person who used the command and give the person an Ak-47, being this a VIP exclusive command.

Code:
#pragma semicolon 1

#define DEBUG

#define PLUGIN_AUTHOR ""
#define PLUGIN_VERSION "0.00"

#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike>

#pragma newdecls required

public Plugin myinfo = 
{
	name = "",
	author = PLUGIN_AUTHOR,
	description = "",
	version = PLUGIN_VERSION,
	url = ""
};

public void OnPluginStart()
{
	RegConsoleCmd("sm_ak47", Cmd_Ak47, "VIP AK.");
}

public Action Cmd_Ak47(int client, int args)
{
   if(CheckCommandAccess(client, "", ADMFLAG_CUSTOM1, false))
   {
   	ReplyToCommand("\x01[\x09Anubis\x10Community\x01] Vip only command.")
   }
   
   if(CheckCommandAccess(client, "", ADMFLAG_CUSTOM1, true))
   {
   	new clientMoney = GetEntProp(client, Prop_Send, "m_iAccount"); // Get player's current cash
   	if (clientMoney = 2700)
	   GivePlayerItem(client, "weapon_ak47");
	   ReplyToCommand("\x01[\x09Anubis\x10Community\x01] Bought an ak -2700$.")
	if (clientMoney != 2700)
	  {
	   ReplyToCommand("\x01[\x09Anubis\x10Community\x01] No enough money \x01.")
	  }
   }   
}
Use smlib include
PHP Code:
#pragma semicolon 1

#define DEBUG

#define PLUGIN_AUTHOR ""
#define PLUGIN_VERSION "0.00"

#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike>
#include <smlib>
#pragma newdecls required

public Plugin myinfo 
{
    
name "",
    
author PLUGIN_AUTHOR,
    
description "",
    
version PLUGIN_VERSION,
    
url ""
};

public 
void OnPluginStart()
{
    
RegConsoleCmd("sm_ak47"Cmd_Ak47"VIP AK.");
}

public 
Action Cmd_Ak47(int clientint args)
{
    if(!
CheckCommandAccess(client""ADMFLAG_CUSTOM1true))
    {
        
ReplyToCommand(client"\x01[\x09Anubis\x10Community\x01] Vip only command.");
    }
   else if(!
IsPlayerAlive(client))
    {
        
ReplyToCommand(client"\x01[\x09Anubis\x10Community\x01] Tens que estar vivo para executar este comando.");
    }
    else
    {
           if (
Client_GetMoney(client) >= 2700)
           {
               
GivePlayerItem(client"weapon_ak47");
               
ReplyToCommand(client"\x01[\x09Anubis\x10Community\x01] Bought an ak -2700$.");
               
Client_SetMoney(clientClient_GetMoney(client) - 2700);
           }
        else 
          {
               
ReplyToCommand(client"\x01[\x09Anubis\x10Community\x01] No enough money \x01.");
          }
   }   

__________________
Taking small private requests (Free) and big private requests (Paid).
Contact me via Discord: WilDick#1524

My Plugins:

Last edited by SSheriFF; 09-06-2020 at 11:23.
SSheriFF is offline
Pinto
New Member
Join Date: Jun 2020
Old 09-06-2020 , 10:05   Re: [CSGO] !ak47 for counter-terrorists. Need help.
Reply With Quote #3

Thanks for the help
@SSheriFF, I understood what I was doing wrong and you were a great guy helping aside via discord pm.

Problem Solved.
Pinto 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 10:42.


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