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