ZCMD wont detect my commands
#1

I have a problem with ZCMD, no matter if i do CMD:, COMMAND:, or cmd(command,stuff) it wont detect my commands, it will always return 0. and if i try editing the callbacks to return 1 it doesnt send the message but also doesnt perform the command. i used the 3 possible formats so far with no errors. :/


i have Icognito's DNS and Streamer, and SSCANF2.
Reply
#2

Do you tried to redownload the zcmd include?
Reply
#3

Quote:
Originally Posted by henry jiggy
Посмотреть сообщение
I have a problem with ZCMD, no matter if i do CMD:, COMMAND:, or cmd(command,stuff) it wont detect my commands, it will always return 0. and if i try editing the callbacks to return 1 it doesnt send the message but also doesnt perform the command. i used the 3 possible formats so far with no errors. :/


i have Icognito's DNS and Streamer, and SSCANF2.
Do you have anything inside your OnPlayerCommandText?
Reply
#4

Quote:
Originally Posted by varthshenon
Посмотреть сообщение
Do you have anything inside your OnPlayerCommandText?
return 1;



And yeah i redownloaded it many times.
Reply
#5

Quote:
Originally Posted by henry jiggy
Посмотреть сообщение
return 1;

And yeah i redownloaded it many times.
Try by delete your OnPlayerCommandText I guess.
Reply
#6

Quote:
Originally Posted by varthshenon
Посмотреть сообщение
Try by delete your OnPlayerCommandText I guess.
Didn't work.
Reply
#7

Show us your Command, OnPlayerCommandReceived, and OnPlayerCommandPerformed.
Reply
#8

Oh hold on, i think i got why it isnt working. BASE FS is using OnPLayerCommandText. im gonna convert that. reporting sucess or fail as soon as i can.

EDIT: Ok i fail at converting. any alternate ways to do this?

EDIT2:i used OnPlayerCommandPerformed on the BASE filterscript and evetything inside it works now but the commands i made with ZCMD say Unknown Command. and if i set Return 1 at the end of BASE fs they wont say Unknown Command but also wont run my cmd. Help?

EDIT3:

BASE Filterscript code:

Код:
// Base FS
// Contains /pm /kick /ban commands.
// ADAPTED FOR AIRPORT TDM, small changes tho
#define YSI_IS_CLIENT
#include <a_samp>
#include "../include/gl_common.inc"
#include <zcmd>

#define ADMINFS_MESSAGE_COLOR 0xFF444499
#define PM_INCOMING_COLOR     0xFFFF22AA
#define PM_OUTGOING_COLOR     0xFFCC2299

//------------------------------------------------

public OnFilterScriptInit()
{
	print("\n--Base FS loaded.\n");
	return 1;
}

//------------------------------------------------

public OnPlayerCommandPerformed(playerid, cmdtext[],success)
{
    new cmd[128];
	new	tmp[256];
	new Message[256];
	new gMessage[256];
	new pName[MAX_PLAYER_NAME+1];
	new iName[MAX_PLAYER_NAME+1];
	new	idx;

	cmd = strtok(cmdtext, idx);

	// PM Command
 	if(strcmp("/pm", cmd, true) == 0)
	{
		tmp = strtok(cmdtext,idx);

		if(!strlen(tmp) || strlen(tmp) > 5) {
			SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /pm (id) (message)");
			return 1;
		}
		
		new id = strval(tmp);
        gMessage = strrest(cmdtext,idx);
        
		if(!strlen(gMessage)) {
			SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /pm (id) (message)");
			return 1;
		}
		
		if(!IsPlayerConnected(id)) {
			SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/pm : Bad player ID");
			return 1;
		}
		
		if(playerid != id) {
			GetPlayerName(id,iName,sizeof(iName));
			GetPlayerName(playerid,pName,sizeof(pName));
			format(Message,sizeof(Message),">> %s(%d): %s",iName,id,gMessage);
			SendClientMessage(playerid,PM_OUTGOING_COLOR,Message);
			format(Message,sizeof(Message),"** %s(%d): %s",pName,playerid,gMessage);
			SendClientMessage(id,PM_INCOMING_COLOR,Message);
			PlayerPlaySound(id,1085,0.0,0.0,0.0);
			
			printf("PM: %s",Message);
			
		}
		else {
			SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"You cannot PM yourself,Curious Nab.");
		}
		return 1;
	}

	//Kick Command
	if(strcmp("/kick", cmd, true) == 0)
	{
	    if(IsPlayerAdmin(playerid)) {
			tmp = strtok(cmdtext,idx);
			if(!strlen(tmp) || strlen(tmp) > 5) {
				return SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /kick (id) [reason]");
			}
			
			new id = strval(tmp);

			if(!IsPlayerConnected(id)) {
				SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/kick : Bad player ID");
				return 1;
			}
			
			gMessage = strrest(cmdtext,idx);
			
			GetPlayerName(id,iName,sizeof(iName));
			SendClientMessage(id,ADMINFS_MESSAGE_COLOR,"-- You have been kicked from Airport TDM. Relax, At least it wasnt a ban! Mwahaha.");

			if(strlen(gMessage) > 0) {
				format(Message,sizeof(Message),"Reason: %s",gMessage);
				SendClientMessage(id,ADMINFS_MESSAGE_COLOR,Message);
			}
			
			format(Message,sizeof(Message),">> %s(%d) has been kicked. Reason: %s",iName,id,gMessage);
			SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,Message);
			
			Kick(id);
			return 1;
		} else {
            SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/Kick : You are not an admin,Ass.");
			return 1;
		}
	}

	//Ban Command
	if(strcmp("/ban", cmd, true) == 0)
	{
	    if(IsPlayerAdmin(playerid))
		{
			tmp = strtok(cmdtext,idx);
			if(!strlen(tmp) || strlen(tmp) > 5)
			{
    		return SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /ban (id) [reason]");
			}

			new id = strval(tmp);

			if(!IsPlayerConnected(id))
			{
				SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/ban : Bad player ID");
				return 1;
			}

			gMessage = strrest(cmdtext,idx);

			GetPlayerName(id,iName,sizeof(iName));
			SendClientMessage(id,ADMINFS_MESSAGE_COLOR,"You have been banned from Airport TDM.");//Send ban message
			if(strlen(gMessage) > 0)
			{
			new banMessage[80];
			format(banMessage,sizeof(banMessage),">> %s(%d) Has been Banned by an Admin. Reason:%s",iName,id,gMessage);
      		SendClientMessageToAll(ADMINFS_MESSAGE_COLOR, banMessage);
      		}
   			

	       
			printf("WARNING,%s(%d) has been banned. Reason:%s",iName,id,gMessage);
			new BMessage[30];
            format(BMessage,sizeof(BMessage),"ABAN: %s",gMessage);
			BanEx(id, BMessage);
			return 1;
			}
			else {
            SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/Ban:You arent an admin,Bitch.");
			return 1;
		}
	}

	return 1;
}
Commands code of my gamemode:

Код:
cmd(Help,playerid, params[])
{
SendClientMessage(playerid,COLOR_WHITE,""#COL_LOGIN"» /Commands");
return 1;
}
cmd(Commands,playerid, params[])
{
SendClientMessage(playerid,COLOR_WHITE,""#COL_LOGIN"» ---/Help---/About---/Kill");
return 1;
}
cmd(About,playerid, params[])
{
//Sends ABOUT messages to playerid
return 1;
}
cmd(RestartServer,playerid, params[])
{
 if(IsPlayerAdmin(playerid))
 {
 new thunameh[30];
 GetPlayerName(playerid,thunameh,sizeof(thunameh));
 new RestartMSG[140];
 format(RestartMSG,sizeof(RestartMSG), "Admin %s(%d) Has restarted the server!",thunameh,playerid);
 printf("WARNING,%s has Restarted the server!",thunameh,playerid);
 SendClientMessageToAll(ADMINFS_MESSAGE_COLOR,RestartMSG);
 new INI:File = INI_Open(UserPath(playerid));
 INI_SetTag(File,"data");
 INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
 INI_WriteInt(File,"Kills",PlayerInfo[playerid][Kills]);
 INI_WriteInt(File,"Deaths",PlayerInfo[playerid][Deaths]);
 INI_WriteInt(File,"Adminlevel",PlayerInfo[playerid][Adminlevel]);
 INI_Close(File);
 SendClientMessageToAll(COLOR_RED, "SERVER IS NOW RESTARTING");
 GameTextForAll("Server Restarting",3000,0);
 SendRconCommand("gmx");
 return 1;
 }
 else return 0;
}
cmd(Respawnallvehicles,playerid, params[])
{
	if(IsPlayerAdmin(playerid))
	{
	new RESPMSG[170];
	new Adminame[24];
	GetPlayerName(playerid, Adminame, sizeof(Adminame));
	format(RESPMSG,sizeof(RESPMSG),"Admin %s(%d) Has Respaned all vehicles!",Adminame,playerid);
	SendClientMessageToAll(COLOR_RED,RESPMSG);
	for(new i = 0; i < MAX_VEHICLES; i++)
	{
	SetVehicleToRespawn(i);
	}
	return 1;
	}
	else return 0;
}
Defines and Includes of my gamemode:

Код:
#include <a_samp>
#include <zcmd>
#define YSI_IS_SERVER
#include <YSI\y_master>
#include <YSI\y_ini>
#include <sscanf2>
#include <streamer>
//A fuckload of color defines down below
Reply
#9

Already see it - it's like this:

pawn Код:
CMD:test(playerid, params[])
{
    // Here your command fex. SendClientMessage...
    return 1;
}
AND NOT

pawn Код:
cmd(Help,playerid, params[])
{
SendClientMessage(playerid,COLOR_WHITE,""#COL_LOGIN"» /Commands");
return 1;
}
By the way, use some tabs.
Reply
#10

Quote:
Originally Posted by Kingunit
Посмотреть сообщение
Already see it - it's like this:

pawn Код:
CMD:test(playerid, params[])
{
    // Here your command fex. SendClientMessage...
    return 1;
}
AND NOT

pawn Код:
cmd(Help,playerid, params[])
{
SendClientMessage(playerid,COLOR_WHITE,""#COL_LOGIN"» /Commands");
return 1;
}
By the way, use some tabs.
Im gonna try to use it that way (again), and i use Tabs wherever i can to organize me Gamemode script, but im lazy to tab up the scripts i copy.

EDIT: Didn't work. i had another idea. checkin every include and filterscript i have for OnPlayerCommandText and gonna replace that with the ZCMD callback(s). Reporting as soon as i can.

EDIT2:
Код:
// Note that the callback thing won't work with OnPlayerCommandText as it has a
//different default return to everything else.
Retrieved from Y_MASTER. Even though it only says wstuff about return(my gm returns 1 same way) he may have modded something else.

trying to remove from include list and execute commands. hold on.

EDIT3:
Nothing. im almost killing myself here. gosh D:. ima try to run ZCMD as a Filterscript.

EDIT4:

DIDN'T WORK

EDIT5:

I ran some tests made by myself to figure what was causing the problem and i saw that the commands arent even being added because OnPlayerCommandPerformed always returns 0 on Success. it seems the commands arent even being added -.-.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)