welp, hey, I have a little problem with a plugin.
I took PowerLord's plugin and did a little edit:
Code:
public OnPluginStart()
{
RegConsoleCmd("sm_count", Cmd_Count, "count");
RegConsoleCmd("sm_stop", StopCmd, "stop");
}
public Action:Cmd_Count(client, args)
{
if (args < 1)
{
PrintToChat(client, "[Count] Please enter a Number");
return Plugin_Handled;
}
if (g_Timer != INVALID_HANDLE)
{
return Plugin_Handled;
}
new String:arg1[4], arg1int;
GetCmdArg(1, arg1, sizeof(arg1));
arg1int = StringToInt(arg1);
PrintToChat(client, "[Count] Number %d as setted.", arg1int);
CreateTimer(1.0, TimerCallBack, arg1int, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
return Plugin_Handled;
}
public Action:StopCmd(client, args)
{
if (g_Timer != INVALID_HANDLE)
{
KillTimer(g_Timer);
g_Timer = INVALID_HANDLE;
}
}
public Action:TimerCallBack(Handle:timer, any:timerMaxTime)
{
static timePassed;
new timeRemaining = timerMaxTime - timePassed;
new minutes = (timeRemaining/60);
new seconds = timeRemaining - minutes * 60;
if (seconds < 10)
{
PrintCenterTextAll("Timer Countdown - %0d:0%d", minutes, seconds);
} else if (minutes < 10) {
PrintCenterTextAll("Timer Countdown - %0d:%d", minutes, seconds);
} else {
PrintCenterTextAll("Timer Countdown - %0d:%d", minutes, seconds);
}
if (timePassed++ >= timerMaxTime)
{
g_Timer = INVALID_HANDLE;
timePassed = 0;
switch(timeRemaining)
{
case 0:
{
PrintCenterTextAll("Time is Over!");
}
}
return Plugin_Stop;
}
return Plugin_Continue;
}
The problem is, that the sm_stop command isnt working. Can someone help me? thx
Have a great day!