Hey I am to get better in sourcepawn (as you may see) but i feel like I am doing terrible job. The source api not really helping because i need to know how to actually use these functions so I have no other chooise then to ask you.
I wanted to create a plugin that will spam "spam" in the chat. and added a color choose to the client.
for exaple he will write /spam r 5, this will print 5 times in red spam. (I am really trying to get better so i guess i need to practice in these nonesence plugins, If someone challange me to write a plugin for begginers ofc, i started learning only 3 days ago.. i will be more then happy to try) anyway, How bad is it?
Code:
public void OnPluginStart()
{
RegConsoleCmd("sm_spam", SPAM);
}
public Action SPAM (int client, int args)
{
if(args > 2)
{
ReplyToCommand(client, "[SM] spam <color> <amount of times>");
}
char colorchoose[3];
GetCmdArg(1, colorchoose, sizeof(colorchoose));
char Camount[4];
GetCmdArg(2, Camount, sizeof(Camount));
int iamount = StringToInt(Camount, 10);
if(iamount = 0)
{
ReplyToCommand(client, "[SM] Please enter a normal number");
}
if(StrEqual(colorchoose,"r"))
{
for (int i = 0; i < iamount; i++)
{
PrintToChatAll("\x03Spam");
}
}
else if(StrEqual(colorchoose,"g"))
{
for (int i = 0; i < iamount; i++)
{
PrintToChatAll("\x04Spam");
}
}