Jump to content
  • 0

pomoc [HELP]ann nefunguje


aneglepd

Dotaz

Pěkný den,

 

udělal jsem si takový vlastní FS, který jsem si následně dal na server, ale když zadám příkaz /announce, který je teda příkaz mého FS, tak mi na serveru vypíše, že žádný takový příkaz neexistuje, přitom v serverlogu je FS řádně načten. Prosím o pomoc.

 

Link to comment
Share on other sites

Recommended Posts

  • 0
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}

public OnFilterScriptExit()
{
return 1;
}
#endif

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/levent", cmdtext, true, 10) == 0)
{
SetPlayerHealth(playerid, 1000);
SetPlayerArmour(playerid, 100.0);
return 1;
}
if (strcmp("/kopecsmrti", cmdtext, true, 10) == 0)
{
   new vehicleid = GetPlayerVehicleID(playerid);
SetVehicleHealth(vehicleid, 1000000);
return 1;
}
return 0;
}

CMD:announce(playerid, params[])
{
    if(!IsPlayerAdmin(playerid))
return SendClientMessage(playerid, 0xFF0000FF, "You are not allowed to use this command!");

    new text[64], time, style;
    if (sscanf(params, "iis[64]", style, time, text)) return
        SendClientMessage(playerid, 0xFF0000FF, "Použitie: /announce <štýl[0-6]> <čas v milisekundách> <text>");
    if (strlen(text) > 64) return
        SendClientMessage(playerid, 0xFF0000FF, "Správa je veľmi dlhá! Prosím skráť ju!");
    if(style == 2) return SendClientMessage(playerid, 0xFF0000FF, "Štýl 2 je bugnutý, prosím nepoužívaj ho!");
    if (style < 0 || style > 6) return
        SendClientMessage(playerid, 0xFF0000FF,"Zlý štýl!");
    if (time > 20*1000) return
        SendClientMessage(playerid, 0xFF0000FF, "Nemôže byť dlhšia ako 20 sekúnd.");
    GameTextForAll(text, time, style);
    return 1;
}

Abych neporušil žádná autorská práva nebo co, tak to (announce patří vyvojáři DeTiX je to pouze přeloženo)

Link to comment
Share on other sites

  • 0

Note #1: If you want to use zcmd in a filterscript, put this define before including:

pawn Code:

#define FILTERSCRIPT


Note #2: If you want to check whether parameters string is empty you should not do it like:

pawn Code:

if (!strlen(params))
{
  // no parameters
}
 

Link to comment
Share on other sites

  • 0

Jak koukám na code vidím toto:

Zde je problém vtom že ZCMD a OnPlayerCommand  -  Nespolupracují

Takže si vyber včem chceš dělat příkazy doporučuji ZCMD

 

Tím pádem zrušíš příkazy ze OnPlayerCommand a dáš to do ZCMD

(Rovnou pak můžeš smazat celej OnPlayerCommand

 

To je ta možnost proč ti to píše že příkaz neexistuje.

Link to comment
Share on other sites

  • 0

Áno, toto jsem už taky smazal dříve, na SA:MP foru mi to kluci poradili, pořád nefunguje, kód je nyní takový.

#include <a_samp>
#include <zcmd>
#include <sscanf2>
#define FILTERSCRIPT
#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Blank Filterscript by your name here");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}
#endif

CMD:announce(playerid, params[])
{
    if(!IsPlayerAdmin(playerid))
		return SendClientMessage(playerid, 0xFF0000FF, "You are not allowed to use this command!");

    new text[64], time, style;
    if (sscanf(params, "iis[64]", style, time, text)) return
        SendClientMessage(playerid, 0xFF0000FF, "Usage: /announce <style[0-6]> <time in ms> <text>");
    if (!strlen(text) > 64) return
        SendClientMessage(playerid, 0xFF0000FF, "Message too long please shorten it!");
    if(style == 2) return SendClientMessage(playerid, 0xFF0000FF, "Bug with style 2 don't use it!");
    if (style < 0 || style > 6) return
        SendClientMessage(playerid, 0xFF0000FF,"Invalid style!");
    if (time > 20*1000) return
        SendClientMessage(playerid, 0xFF0000FF, "No longer than 20 seconds!");
    GameTextForAll(text, time, style);
    return 1;
}
Link to comment
Share on other sites

  • 0

Oh to Ano

Ale zde je ještě věc v tomto:

 

Máš vlastní mod ?

-Zde by nebyl problém

 

Jestli ne musíš udělat příkaz podle toho včem, je dělán mod

 

Takže  - Ukázky z modu

RZE - OnPlayerCommand

Street Life- DCMD

 

Ale pokud ti šel ten OnPlayerCommand tak to annouce dej do toho a bude to fungovat.

Link to comment
Share on other sites

  • 0

mas #define FILTERSCRIPT

 

a koukni se kde mas #endif

 

to ukoncuje #if defined FILTERSCRIPT

 

takze si dej #endif az uplne nakonec. tim ze to mas nad CMD:announce tak to ten prikaz odsrani.

Link to comment
Share on other sites

  • 0
if (strcmp("/announce", cmdtext, true, 10) == 0)
    if(!IsPlayerAdmin(playerid))
{
   new text[64], time, style;
    if (sscanf(cmdtext, "iis[64]", style, time, text)) return
        SendClientMessage(playerid, 0xFF0000FF, "Usage: /announce <style[0-6]> <time in ms> <text>");
    if(style == 2) return SendClientMessage(playerid, 0xFF0000FF, "Bug with style 2 don't use it!");
    if (style < 0 || style > 6) return
        SendClientMessage(playerid, 0xFF0000FF,"Invalid style!");
    if (time > 20*1000) return
        SendClientMessage(playerid, 0xFF0000FF, "No longer than 20 seconds!");
    GameTextForAll(text, time, style);
return 1;
}

A ještě jak psal Om3n  toho jsem si nevšim

Link to comment
Share on other sites

  • 0

No ne, toto je jak ze špatného sna..

 

pořád to samý... omg..

 

Aktuální script:

#include <a_samp>
#include <sscanf2>
#define FILTERSCRIPT
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Blank Filterscript by your name here");
	print("--------------------------------------\n");
	return 1;
}
public OnFilterScriptExit()
{
	return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/ann", cmdtext, true, 10) == 0)
    if(!IsPlayerAdmin(playerid))
{
   	new text[64], time, style;
    if (sscanf(cmdtext, "iis[64]", style, time, text)) return
        SendClientMessage(playerid, 0xFF0000FF, "Usage: /announce <style[0-6]> <time in ms> <text>");
    if(style == 2) return SendClientMessage(playerid, 0xFF0000FF, "Bug with style 2 don't use it!");
    if (style < 0 || style > 6) return
        SendClientMessage(playerid, 0xFF0000FF,"Invalid style!");
    if (time > 20*1000) return
        SendClientMessage(playerid, 0xFF0000FF, "No longer than 20 seconds!");
    GameTextForAll(text, time, style);
	return 1;
}
return 0;
}
#endif
Link to comment
Share on other sites

  • 0

#include <a_samp>
#include <sscanf2>
#define FILTERSCRIPT
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    return 1;
}
public OnFilterScriptExit()
{
    return 1;
}
#else
#endif
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/ann", cmdtext, true, 10) == 0)
if(!IsPlayerAdmin(playerid))
{
    new text[64], time, style;
if (sscanf(cmdtext, "iis[64]", style, time, text)) return
SendClientMessage(playerid, 0xFF0000FF, "Usage: /announce <style[0-6]> <time in ms> <text>");
if(style == 2) return SendClientMessage(playerid, 0xFF0000FF, "Bug with style 2 don't use it!");
if (style < 0 || style > 6) return
SendClientMessage(playerid, 0xFF0000FF,"Invalid style!");
if (time > 20*1000) return
SendClientMessage(playerid, 0xFF0000FF, "No longer than 20 seconds!");
GameTextForAll(text, time, style);
    return 1;
}
return 0;
}
Link to comment
Share on other sites

  • 0

#include <a_samp>

#include <sscanf2>

#define dcmd(%1,%2,%3) if((strcmp((%3)[1],#%1,true,(%2))==0)&&((((%3)[(%2)+1]==0)&&(dcmd_%1(playerid,"")))||(((%3)[(%2)+1]==32)&&(dcmd_%1(playerid,(%3)[(%2)+2]))))) return 1
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(ann,3,cmdtext);
return 1;
}



dcmd_ann(playerid, params[])
{
    if(IsPlayerAdmin(playerid))
    {
        new time, style;
        if (sscanf(params,"iis", style, time, params)) return SendClientMessage(playerid, 0xFF0000FF, "Usage: /announce <style[0-6]> <time in ms> <text>");
        if(style == 2) return SendClientMessage(playerid, 0xFF0000FF, "Bug with style 2 don't use it!");
        if (style < 0 || style > 6) return SendClientMessage(playerid, 0xFF0000FF,"Invalid style!");
        if (time > 20*1000) return SendClientMessage(playerid, 0xFF0000FF, "No longer than 20 seconds!");
        GameTextForAll(params, time, style);
    }
    return 1;
}
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...