Commands not working! afk system!
#1

Hello again, I'm using this filterscript: https://sampforum.blast.hk/showthread.php?tid=325889

Yes, it's an AFK system like it says in the title. The problem is, when I do /afk, the command doesn't work it just says "SERVER: Unknown Command". Here is the whole script:
Код:
#include <a_samp>
#include <foreach>
#include <sscanf2>
#include <YSI\y_commands>

#define COLOR_WHITE 0xFFFFFFFF

#define WHITE   "{FFFFFF}"
#define LBLUE   "{347CCF}"

forward AFK_Seconds(playerid);

new Text3D:AFK_Label[MAX_PLAYERS];
new IsPlayerAFK[MAX_PLAYERS];
new AFK_Timer[MAX_PLAYERS];
new AFK_Reason[MAX_PLAYERS];

main()
{
	print("\n----------------------------------");
	print("      Afk system    ");
	print("----------------------------------\n");
}

public OnPlayerConnect(playerid)
{
	IsPlayerAFK[playerid] = 0;
	return 1;
}

YCMD:afk(playerid, params[], help)
{
	new reason[64], strtext[64];
	if(IsPlayerAFK[playerid] == 1) return SendClientMessage(playerid, COLOR_WHITE, "You are alredy AFK.");
	if(sscanf(params,"s[64]", reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /afk [reason]");
    IsPlayerAFK[playerid] = 1;
	TogglePlayerControllable(playerid, false);
	new string[64], plname[MAX_PLAYER_NAME];
	GetPlayerName(playerid, plname, MAX_PLAYER_NAME);
	format(string, sizeof(string), ""WHITE"%s "LBLUE"is now AFK", plname);
	SendClientMessageToAll(COLOR_WHITE, string);
	format(AFK_Reason[playerid],64,"%s", reason);
	format(strtext, sizeof(strtext), ""LBLUE"Player is AFK\n"WHITE"Reason: %s\nTime: 0", reason);
	AFK_Label[playerid] = Create3DTextLabel(strtext,COLOR_WHITE,30.0,40.0,50.0,40.0,0);
	Attach3DTextLabelToPlayer(AFK_Label[playerid], playerid, 0.0, 0.0, 0.3);
	SendClientMessage(playerid, COLOR_WHITE, "You are now AFK,tyre "LBLUE"/back "WHITE"when you come back.");
	SetTimer("AFK_Seconds", 1000, true);
	return 1;
}
YCMD:back(playerid, params[], help)
{
    if(IsPlayerAFK[playerid] == 0) return SendClientMessage(playerid, COLOR_WHITE, "You are not AFK.");
    IsPlayerAFK[playerid] = 0;
    TogglePlayerControllable(playerid, true);
	new string[64], plname[MAX_PLAYER_NAME];
	GetPlayerName(playerid, plname, MAX_PLAYER_NAME);
	format(string, sizeof(string), ""WHITE"%s "LBLUE"is no longer AFK", plname);
	SendClientMessageToAll(COLOR_WHITE, string);
	Delete3DTextLabel(Text3D:AFK_Label[playerid]);
    SendClientMessage(playerid, COLOR_WHITE, "You are no longer AFK.");
	return 1;
}

public AFK_Seconds(playerid)
{
	foreach (Player, i)
	{
		AFK_Timer[i] += 1;
		new string[64];
		format(string, sizeof(string), ""LBLUE"Player is AFK\n"WHITE"Reason: %s\nTime: %d", AFK_Reason[playerid], AFK_Timer[i]);
		Update3DTextLabelText(AFK_Label[i], COLOR_WHITE, string);
	}
}
And I get this when I compile:


Код:
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\ROLEPL~4\FILTER~1\afk.pwn(31) : warning 203: symbol is never used: "help"
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\ROLEPL~4\FILTER~1\afk.pwn(50) : warning 203: symbol is never used: "help"
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\ROLEPL~4\FILTER~1\afk.pwn(50) : warning 203: symbol is never used: "params"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Warnings.
Even though it is a warning, the commands will not work. But when I take a look in the server log, it says the script has loaded:

Код:
[19:12:03] 
[19:12:03] Filterscripts
[19:12:03] ---------------
[19:12:03]   Loading filterscript 'afk.amx'...
[19:12:03]   Loading filterscript 'test1.amx'...
[19:12:03]   Loading filterscript 'testingdonutuse(foresampforumshelp).amx'...
[19:12:03]   Loading filterscript 'gl_actions.amx'...
[19:12:03]   Loading filterscript 'gl_property.amx'...
[19:12:03]
I do not a see a reason why it should not work, even though it just compiles as warnings, and warnings are harmless and they just simply point out that I have not used something.


I hope you could help me!
Reply
#2

Please help
Reply
#3

Help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)