Command are not working?
#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:
Code:

Код:
#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.
Reply
#2

sorry i dont know how to use YCMDS :P ask from ******
Reply
#3

pawn Код:
#pragma unused params
#pragma unused help
How about this? afterall it is just warnings
Reply
#4

Quote:
Originally Posted by dr.lozer
Посмотреть сообщение
sorry i dont know how to use YCMDS :P ask from ******
Then why did you post?

OT - Do you use any other command processors alongside in your gamemode?
Reply
#5

When I put,

Код:
#pragma unused params
#pragma unused help
This comes up,

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


2 Errors.
Reply
#6

Quote:
Originally Posted by Goldino
Посмотреть сообщение
When I put,

Код:
#pragma unused params
#pragma unused help
This comes up,

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


2 Errors.
You are supposed to put them in the command thats giving you the warnings, my mistake for not making it more clear

heres an example

pawn Код:
cmd(nos, playerid, params[])
{
#pragma unused playerid
#pragma unused params
// Rest of command here
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)