SA-MP Forums Archive
Problem with this announce dcmd - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem with this announce dcmd (/showthread.php?tid=164637)



Problem with this announce dcmd - Jay. - 01.08.2010

my friend made me this code

pawn Код:
dcmd_ann2(playerid, params[])
{
    if(IsPlayerAdmin(playerid)) {
        if (!strlen(params))
        {
            SendClientMessage(playerid,COLOR_RED2, "USAGE: /text [text]");
            return 1;
        }

        TextDrawDestroy(Textdraw8);
        Textdraw8 = TextDrawCreate(308.000000,200.000000, params);
        TextDrawAlignment(Textdraw8,2);
        TextDrawBackgroundColor(Textdraw8,0x000000ff);
        TextDrawFont(Textdraw8,3);
        TextDrawLetterSize(Textdraw8,1.100000,1.899999);
        TextDrawSetOutline(Textdraw8,1);
        TextDrawSetProportional(Textdraw8,1);
        TextDrawSetShadow(Textdraw8,10);
        TextDrawShowForAll(Textdraw8);
    }
    return 1;
}

Now when i try to use it ingame it says uknown command

can anyone fix this?


Re: Problem with this announce dcmd - Ash. - 01.08.2010

Have you logged in as rcon admin before you perform this command?

"/rcon logon {pass}"


Re: Problem with this announce dcmd - Jay. - 01.08.2010

Quote:
Originally Posted by funky1234
Посмотреть сообщение
Have you logged in as rcon admin before you perform this command?

"/rcon logon {pass}"
I tryed using it typing it first without logging in.


pawn Код:
dcmd_ann(playerid, params[])
{
    if(IsPlayerAdmin(playerid)) {
        if (!strlen(params))
        {
            SendClientMessage(playerid,COLOR_RED2, "USAGE: /ann [text]");
            return 1;
        }

        TextDrawDestroy(Textdraw8);
        Textdraw8 = TextDrawCreate(308.000000,200.000000, params);
        TextDrawAlignment(Textdraw8,2);
        TextDrawBackgroundColor(Textdraw8,0x000000ff);
        TextDrawFont(Textdraw8,3);
        TextDrawLetterSize(Textdraw8,1.100000,1.899999);
        TextDrawSetOutline(Textdraw8,1);
        TextDrawSetProportional(Textdraw8,1);
        TextDrawSetShadow(Textdraw8,10);
        TextDrawShowForAll(Textdraw8);
    }
    else
    {
    SendClientMessage(playerid,COLOR_RED2,"Your not an admin");
    }
    return 1;
}
and maybe this will work?

EDIT: I've added this

pawn Код:
dcmd(ann,4,cmdtext);
Maybe thats why it don't work.


Re: Problem with this announce dcmd - Ash. - 01.08.2010

pawn Код:
"  if(IsPlayerAdmin(playerid)) {"
You need to login as RCON Admin, thats what the script wants, it wont execute the code after IsPlayerAdmin(playerid) if youre not admin. Log in as admin and the script will work.


Re: Problem with this announce dcmd - Jay. - 01.08.2010

Quote:
Originally Posted by funky1234
Посмотреть сообщение
pawn Код:
"  if(IsPlayerAdmin(playerid)) {"
You need to login as RCON Admin, thats what the script wants, it wont execute the code after IsPlayerAdmin(playerid) if youre not admin. Log in as admin and the script will work.
DOesn't make any difrence if i login or not it will still return Uknown command.


Re: Problem with this announce dcmd - Ash. - 01.08.2010

Try this: (Using original code, place your else if you want)

pawn Код:
dcmd_ann2(playerid, params[])
{
    if(IsPlayerAdmin(playerid) == 1) {
        if (!strlen(params))
        {
            SendClientMessage(playerid,COLOR_RED2, "USAGE: /text [text]");
            return 1;
        }

        TextDrawDestroy(Textdraw8);
        Textdraw8 = TextDrawCreate(308.000000,200.000000, params);
        TextDrawAlignment(Textdraw8,2);
        TextDrawBackgroundColor(Textdraw8,0x000000ff);
        TextDrawFont(Textdraw8,3);
        TextDrawLetterSize(Textdraw8,1.100000,1.899999);
        TextDrawSetOutline(Textdraw8,1);
        TextDrawSetProportional(Textdraw8,1);
        TextDrawSetShadow(Textdraw8,10);
        TextDrawShowForAll(Textdraw8);
    }
    return 1;
}



Re: Problem with this announce dcmd - Jay. - 01.08.2010

Quote:
Originally Posted by funky1234
Посмотреть сообщение
Try this: (Using original code, place your else if you want)

pawn Код:
dcmd_ann2(playerid, params[])
{
    if(IsPlayerAdmin(playerid) == 1) {
        if (!strlen(params))
        {
            SendClientMessage(playerid,COLOR_RED2, "USAGE: /text [text]");
            return 1;
        }

        TextDrawDestroy(Textdraw8);
        Textdraw8 = TextDrawCreate(308.000000,200.000000, params);
        TextDrawAlignment(Textdraw8,2);
        TextDrawBackgroundColor(Textdraw8,0x000000ff);
        TextDrawFont(Textdraw8,3);
        TextDrawLetterSize(Textdraw8,1.100000,1.899999);
        TextDrawSetOutline(Textdraw8,1);
        TextDrawSetProportional(Textdraw8,1);
        TextDrawSetShadow(Textdraw8,10);
        TextDrawShowForAll(Textdraw8);
    }
    return 1;
}
Okay its fixed thanks


Re: Problem with this announce dcmd - Ash. - 01.08.2010

No problem

Enjoy XD


Re: Problem with this announce dcmd - WackoX - 01.08.2010

Quote:
Originally Posted by [BADBOY]
Посмотреть сообщение
I tryed using it typing it first without logging in.


pawn Код:
dcmd_ann(playerid, params[])
{
    if(IsPlayerAdmin(playerid)) {
        if (!strlen(params))
        {
            SendClientMessage(playerid,COLOR_RED2, "USAGE: /ann [text]");
            return 1;
        }

        TextDrawDestroy(Textdraw8);
        Textdraw8 = TextDrawCreate(308.000000,200.000000, params);
        TextDrawAlignment(Textdraw8,2);
        TextDrawBackgroundColor(Textdraw8,0x000000ff);
        TextDrawFont(Textdraw8,3);
        TextDrawLetterSize(Textdraw8,1.100000,1.899999);
        TextDrawSetOutline(Textdraw8,1);
        TextDrawSetProportional(Textdraw8,1);
        TextDrawSetShadow(Textdraw8,10);
        TextDrawShowForAll(Textdraw8);
    }
    else
    {
    SendClientMessage(playerid,COLOR_RED2,"Your not an admin");
    }
    return 1;
}
and maybe this will work?

EDIT: I've added this

pawn Код:
dcmd(ann,4,cmdtext);
Maybe thats why it don't work.
Don't know if your people are blind, but the problem was that 'ann' isn't 4 characters long, it's 3.