Raised This Month: $32 Target: $400
 8% 

Building Plugins. Need Help on code.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
scarlxrd1734
Junior Member
Join Date: Jul 2018
Location: Portugal
Old 09-23-2018 , 07:07   Building Plugins. Need Help on code.
Reply With Quote #1

Hi guys. So today i started to make a plugin for VIP on my community servers.

So i want the plugin to give to the VIP player, for example, an AK47 and a Deagle if he does on chat !vipak. So i did my code like that and it shows me errors. If someone can help please reply.


// PLUGIN CODE //

#pragma semicolon 1

#define DEBUG

#define PLUGIN_AUTHOR "scarlxrd1734"
#define PLUGIN_VERSION "1.0.0"

#include <sourcemod>
#include <sdktools>
#include <sdktools_functions>

#pragma newdecls required

public Plugin myinfo =
{
name = "VIPKit",
author = PLUGIN_AUTHOR,
description = "VIPKit for MM, DM and C Servers",
version = PLUGIN_VERSION,
url = "http://steamcommunity.com/id/spirtbtx"
};

public void OnPluginStart()
{
RegAdminCmd("sm_vipak", Cmd_VIPAK, ADMFLAG_CUSTOM1, "VIP Kit for AK47 and Deagle");
}

public Action Cmd_VIPAK(int client, int args)
{
GivePlayerItem(int client, const[32] weapon_ak47, int iSubType = 1);
GivePlayerItem(int client, const[32] weapon_deagle, int iSubType = 1);
PrintToChat(client, "Great! You've got now an AK47 and a DEAGLE!");

return Plugin_Handled
}

// ERRORS //

Line 30 -> error invalid expression, assumed zero

Line 30 -> warning expression has no effect

Line 30 -> error invalid expression, assumed zero

Line 30 -> error invalid expression, assumed zero

Line 30 -> fatal error too many error messages on one line

Last edited by scarlxrd1734; 09-23-2018 at 07:10.
scarlxrd1734 is offline
PwnK
Junior Member
Join Date: Aug 2018
Old 09-23-2018 , 13:50   Re: Building Plugins. Need Help on code.
Reply With Quote #2

This is probably on wrong forum section but change line 30 to this:
Code:
GivePlayerItem(client, "weapon_ak47");
line 31 to this:
Code:
GivePlayerItem(client, "weapon_deagle");
and add semicolon to line 34.
PwnK is offline
sneaK
SourceMod Moderator
Join Date: Feb 2015
Location: USA
Old 09-23-2018 , 18:27   Re: Building Plugins. Need Help on code.
Reply With Quote #3

A couple things:

When posting code, please put it into code blocks.

Also, please be aware of the section you post in, I have moved this to the proper section.
__________________

Last edited by sneaK; 09-23-2018 at 18:27.
sneaK is offline
iskenderkebab33
Senior Member
Join Date: Jun 2018
Old 09-24-2018 , 03:39   Re: Building Plugins. Need Help on code.
Reply With Quote #4

PHP Code:
#pragma semicolon 1

#define DEBUG

#define PLUGIN_AUTHOR "scarlxrd1734"
#define PLUGIN_VERSION "1.0.0"

#include <sourcemod>
#include <sdktools>
#include <sdktools_functions>

#pragma newdecls required

public Plugin myinfo 
{
    
name "VIPKit",
    
author PLUGIN_AUTHOR,
    
description "VIPKit for MM, DM and C Servers",
    
version PLUGIN_VERSION,
    
url "http://steamcommunity.com/id/spirtbtx"
};

public 
void OnPluginStart()
{
    
RegAdminCmd("sm_vipak"Cmd_VIPAKADMFLAG_CUSTOM1"VIP Kit for AK47 and Deagle");
}

public 
Action Cmd_VIPAK(int clientint args)
{
    if (
IsClientInGame(client) && IsPlayerAlive(client)) 
    { 
        
GivePlayerItem(client"weapon_ak47");
        
GivePlayerItem(client"weapon_deagle");
        
PrintToChat(client"Great! You've got now an AK47 and a DEAGLE!");
    }
    else 
    { 
        
PrintToChat(client"You need to be alive to use this command."); 
    }


Last edited by iskenderkebab33; 09-24-2018 at 07:35.
iskenderkebab33 is offline
Reply


Thread Tools
Display Modes

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 23:19.


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