I'm going to try to explain you part by part (heh my english is very bad so you can don't understand) (it's not rare for me to getting wrong, so I can be wrong) :
First :
You mixed old synthax and new synthax (int = new synthax) (public Action:start_no_spread(client) = old synthax and public Action start_no_spread(int client) = new synthax)
Second :
Code:
#include <sourcemod>
public Public:myinfo =
{
name = "Vote No Spread",
autour = "GetRektByNoob",
description = " No Spread Plugin",
url = ""
};
Some typo, it should be :
Code:
#include <sourcemod>
#define PLUGIN_VERSION "1.0" //for the plugin version
public Plugin:myinfo = //It's not public "Public" but "Plugin" and please choose between old or new synthax ( public Plugin myinfo = { } )
{
name = "Vote No Spread", //That's good, the error come from the line above
author = "GetRektByNoob", //Typo, it's not autour but author
description = " No Spread Plugin", //That's good
version = PLUGIN_VERSION, //You forgot the plugin version
url = "" //That's good
};
Third :
Code:
public OnPluginStart()
{
new servername = "Gamers-Il";
RegAdminCmd("sm_startnp", start_no_spread , ADMFLAG_SLAY, " Start Vote No Spread Plugin")
new bool:StopAction = false;
int yes = 0;
int no = 0;
int total = 0;
int percintage = 0;
}
some errors :
Code:
//don't do that on "OnPluginStart", just do like this
new bool:StopAction = false; //it can be "bool StopAction = false;"
int yes = 0;
int no = 0;
int total = 0;
int percintage = 0; //Shouldn't be percentage ?
public OnPluginStart() //You can do "public void OnPluginStart()" for the new synthax
{
new servername = "Gamers-Il"; //???? new and int ??? also Integer = for number, not for letters just remove this
RegAdminCmd("sm_startnp", start_no_spread , ADMFLAG_SLAY, " Start Vote No Spread Plugin") // that's good
}
now it should look like this for the moment :
Code:
#pragma semicolon 1 //Userful
#include <sourcemod>
#pragma newdecls required //this is for new synthax. Note : always after include files
#define PLUGIN_VERSION "1.0" //for the plugin version
#define servername "Gamers-Il" //for your thing that come from "new servername = "Gamers-Il""
public Plugin myinfo =
{
name = "Vote No Spread",
author = "GetRektByNoob",
description = " No Spread Plugin",
version = PLUGIN_VERSION,
url = ""
};
bool StopAction = false;
int yes = 0;
int no = 0;
int total = 0;
int percentage = 0;
public void OnPluginStart()
{
RegAdminCmd("sm_startnp", start_no_spread , ADMFLAG_SLAY, " Start Vote No Spread Plugin")
}
Fourth :
Code:
public Action:start_no_spread(client)
{
if (!StopAction)
{
Menu start = new Menu(Handle_VoteMenu);
start.SetTitle("Enable No Spread");
start.AddItem("yes", "Yes");
start.AddItem("no", "No");
start.ExitButton = false;
start.DisplayVoteToAll(20);
yes = 0;
no = 0;
total = 0;
percintage = 0;
return Plugin_Handled;
}
else
{
PrintToChat(client,"\0x0704f448[%s] \0x07ffffff There is already vote running.",servername);
return Plugin_Handled;
}
}
errors :
Code:
public Action:start_no_spread(client, args) //You forgot args. New synthax = public Action start_no_spread(int client, int args)
{
if (!StopAction) //Heh it's useless because StopAction is always false, you didn't make StopAction set true; when the menu start
{
Menu start = new Menu(Handle_VoteMenu); //that's good, note : "new" for this line is not an old synthax, so you can still use it
start.SetTitle("Enable No Spread"); //good
start.AddItem("yes", "Yes");//Good
start.AddItem("no", "No");//Good
start.ExitButton = false;//Good
start.DisplayVoteToAll(20);//I have no experiences about vote menu so I can't tell if it's true or false, so ask someone else. But it seems good because I saw it on menu.inc
yes = 0;
no = 0;
total = 0;
percentage =0
return Plugin_Handled; //Remove this, useless
}
else
{
PrintToChat(client,"\0x0704f448[%s] \0x07ffffff There is already vote running.",servername);
return Plugin_Handled;
}
return Plugin_Handled; //You forgot this, it's very important because if you don"t do that, when you run the command, it will run but it will also send you "Unknow command : sm_startnp"
}
now the code should look like this :
Code:
#pragma semicolon 1
#include <sourcemod>
#pragma newdecls required
#define PLUGIN_VERSION "1.0"
#define servername "Gamers-Il"
public Plugin myinfo =
{
name = "Vote No Spread",
author = "GetRektByNoob",
description = " No Spread Plugin",
version = PLUGIN_VERSION,
url = ""
};
bool StopAction = false;
int yes = 0;
int no = 0;
int total = 0;
int percentage = 0;
public void OnPluginStart()
{
RegAdminCmd("sm_startnp", start_no_spread , ADMFLAG_SLAY, " Start Vote No Spread Plugin")
}
public Action start_no_spread(int client, int args)
{
if (!StopAction)
{
Menu start = new Menu(Handle_VoteMenu);
start.SetTitle("Enable No Spread");
start.AddItem("yes", "Yes");
start.AddItem("no", "No");
start.ExitButton = false;
start.DisplayVoteToAll(20);
yes = 0;
no = 0;
total = 0;
percentage = 0;
}
else
{
PrintToChat(client,"\0x0704f448[%s] \0x07ffffff There is already vote running.",servername);
return Plugin_Handled;
}
return Plugin_Handled;
}
Fifth :
Code:
public int Handle_VoteMenu(Menu menu, MenuAction action, int client, int item)
{
switch(action)
{
case MenuAction_Select:
{
switch(item)
{
case 0:
{
yes++;
total++;
}
case 1:
{
no++;
total++;
}
}
}
case MenuAction_End:
{
percintage = yes / total * 100;
if (percintage >= 60) {
PrintToChat(client,"\0x0704f448[%s] \0x07e8aaef No Spread \0x07ffffff Has Been \0x0704f448 Enabled\0x07ffffff.", servername);
}
else {
PrintToChat(client,"\0x0704f448[%s] \0x07e8aaef No Spread \0x07ffffff Has Been \0x0704f448 D\0x07ffffff.", servername);
}
delete menu;
}
}
}
It should be :
Code:
public int Handle_VoteMenu(Menu menu, MenuAction action, int client, int item) //It's not always client or item, it depend of the MenuAction, replace by param1 and param2
{
switch(action) //Good
{
case MenuAction_Select: //Good
{
switch(item)//Remove this
{//Remove this
case 0://Remove this
{//Remove this
yes++;//Remove this
total++;//Remove this
}//Remove this
case 1://Remove this
{//Remove this
no++;//Remove this
total++;//Remove this
}//Remove this
}//Remove this
//Replace by this
char info[32];
menu.GetItem(param2, info, sizeof(info));
if(StrEqual(info, "yes", false))
{
yes++ //Don't know if it's good, please ask to someone
total++ //Don't know if it's good, please ask to someone
}
else if(StrEqual(info, "no", false))
{
no++ //Don't know if it's good, please ask to someone
total++ //Don't know if it's good, please ask to someone
}
}
case MenuAction_End:
{
percentage = (yes / total * 100); // replaced to "percentage" it's better to do "result = (operations)". Wait, where is "no" ? is it useless ?
if (percentage >= 60) {
PrintToChat(client,"\0x0704f448[%s] \0x07e8aaef No Spread \0x07ffffff Has Been \0x0704f448 Enabled\0x07ffffff.", servername);//In this case, MenuAction End, there is no client index so remove it by PrintToChatAll
}
else {
PrintToChat(client,"\0x0704f448[%s] \0x07e8aaef No Spread \0x07ffffff Has Been \0x0704f448 D\0x07ffffff.", servername); //In this case, MenuAction End, there is no client index so remove it by PrintToChatAll
}
delete menu;
}
}
}
The final code should look like this :
Code:
#pragma semicolon 1
#include <sourcemod>
#pragma newdecls required
#define PLUGIN_VERSION "1.0"
#define servername "Gamers-Il"
public Plugin myinfo =
{
name = "Vote No Spread",
author = "GetRektByNoob",
description = " No Spread Plugin",
version = PLUGIN_VERSION,
url = ""
};
bool StopAction; // Sorry forgot to say but StopAction by default is on false value so don't need
int yes = 0;
int no = 0;
int iTotal = 0; // Sorry forgot to say but I changed for not having an error compiling
int percentage = 0;
public void OnPluginStart()
{
RegAdminCmd("sm_startnp", start_no_spread, ADMFLAG_SLAY, " Start Vote No Spread Plugin");
}
public Action start_no_spread(int client, int args)
{
if (!StopAction)
{
Menu start = new Menu(Handle_VoteMenu);
start.SetTitle("Enable No Spread");
start.AddItem("yes", "Yes");
start.AddItem("no", "No");
start.ExitButton = false;
start.DisplayVoteToAll(20);
StopAction = true; // Sorry forgot this
yes = 0;
no = 0;
iTotal = 0;
percentage = 0;
}
else
{
PrintToChat(client,"\0x0704f448[%s] \0x07ffffff There is already vote running.",servername);
return Plugin_Handled;
}
return Plugin_Handled;
}
public int Handle_VoteMenu(Menu menu, MenuAction action, int param1, int param2)
{
switch(action)
{
case MenuAction_Select:
{
char info[32];
menu.GetItem(param2, info, sizeof(info));
if(StrEqual(info, "yes", false))
{
yes++;
iTotal++;
}
else if(StrEqual(info, "no", false))
{
no++;
iTotal++;
}
}
case MenuAction_End:
{
percentage = (yes / iTotal * 100);
if (percentage >= 60) {
PrintToChatAll("\0x0704f448[%s] \0x07e8aaef No Spread \0x07ffffff Has Been \0x0704f448 Enabled\0x07ffffff.", servername);
}
else {
PrintToChatAll("\0x0704f448[%s] \0x07e8aaef No Spread \0x07ffffff Has Been \0x0704f448 D\0x07ffffff.", servername);
}
yes = 0; // Sorry forgot this
no = 0; // Sorry forgot this
iTotal = 0; // Sorry forgot this
percentage = 0; // Sorry forgot this
StopAction = false; // Sorry forgot this
delete menu;
}
}
}
[EDIT]
I don't know if it will works
[EDIT #2]
ALSO, after the menu end, it will only print messages, so it useless.
[EDIT #3]
Corrected missing semicolons, only fixed on the final code part. Just copy the final code, because my others codes have so much errors that I'm too lazy to fix
__________________