I have recently decided to give making Sourcemod plugins a go so I have been following a youtube series on it but I have ran into a problem. The code is meant to take an input from the player, store it in an array and then recall the number when the player requests it. I copied exactly what was happening in the tutorial but for some reason when I go to compile it throws errors
The Code:
Code:
#include <sourcemod>
new Items[32];
public Plugin:myinfo = {
name = "Array Tutorial",
author = "me",
description = "Derp",
url = "http://youtube.com"
};
public OnPluginStart()
{
RegConsoleCmd("sm_setnum", CommandSetNum, "");
RegConsoleCmd("sm_getnum", CommandGetNum, "");
}
Public OnClientPutInServer(client)
{
Items[client] = -1;
}
Public Action:CommandSetNum(client, args)
{
if(args < 1)
{
PrintToChat(client, "Please Enter a Number!");
return Plugin_Handled
}
new String:arg1[3], arg1int;
GetCmdArg(1, arg1, sizeof(arg1));
arg1int = StringToInt(arg1);
if (arg1int < 0) return Plugin_Handled; //Checking for neg numbers
Items[client] = arg1int;
PrintToChat(client, "Number: %d has been stored!", Items[client]);
return Plugin_Handled;
}
Public Action:CommandGetNum(client, args)
{
if(Items[client] < 0)
{
PrintToChat(client, "Please Enter a Number!");
return Plugin_Handled;
} else {
PrintToChat(client, "Your saved number is: %d", Items[client]);
return Plugin_Handled;
}
}
The Errors:
Code:
// C:\srcds\CSS\cstrike\addons\sourcemod\scripting\jc_array.sp(54) : error 010:
invalid function or declaration
// C:\srcds\CSS\cstrike\addons\sourcemod\scripting\jc_array.sp(3) : warning 203:
symbol is never used: "Items"
// C:\srcds\CSS\cstrike\addons\sourcemod\scripting\jc_array.sp(31) : warning 203
: symbol is never used: "arg1"
// C:\srcds\CSS\cstrike\addons\sourcemod\scripting\jc_array.sp(31) : warning 203
: symbol is never used: "arg1int"
//
// 17 Errors.
//
// Compilation Time: 0.06 sec
// ----------------------------------------
Press enter to exit ...
If someone could explain what's wrong with the code I would really appreciate it.