Server:Unknown Commands
#1

i created this command and i go to server and said Unknown Commands he dont work
what i wrong

pawn Код:
dcmd_teamstats(playerid, cmdtext[])
{
        #pragma unused cmdtext
        new giveteamid, idx, tmp[256];
        tmp = strtok(cmdtext, idx);

        if (!strlen(tmp))
        {
            for (new i = 0; i < MAX_TURFS; i++) {
                 new msg[ 256 ];
                 format(msg, sizeof(msg), "~w~%s stats:~n~~g~Turfwars Won: %d~n~~r~Turfwars Lost: %d~n~~w~Rivals killed: %d~n~Homies lost: %d~n~~y~Turfs: %d~n~~w~Teamscore: %d",
                 TeamInfo[ gTeam[playerid] ][ TeamName ], TeamInfo[ gTeam[playerid] ][ TurfWarsWon ],
                 TeamInfo[ gTeam[playerid] ][ TurfWarsLost ], TeamInfo[ gTeam[playerid] ][ RivalsKilled ],
                 TeamInfo[ gTeam[playerid] ][ HomiesDied ], OwnedTurfs(), TeamInfo[ gTeam[playerid] ][ TeamScore ]);
                 new Text:txt = TextDrawCreate( 33.0, 261.0, msg);
                 TextDrawUseBox( txt, 1 );
                 TextDrawBoxColor( txt, 0x00000066 );
                 TextDrawTextSize( txt, 141.0, 0.0 );
                 TextDrawAlignment( txt, 0 );
                 TextDrawBackgroundColor( txt, 0x000000ff );
                 TextDrawFont( txt, 1 );
                 TextDrawLetterSize( txt, 0.29, 1.0 );
                 TextDrawColor( txt, 0xffffffff );
                 TextDrawSetOutline( txt, 1 );
                 TextDrawSetProportional( txt, 1 );
                 TextDrawSetShadow( txt, 1 );
                 TimeTextForPlayer( playerid, txt, 6000 );
                 return 1;
            }
        }
        giveteamid = strval(tmp);
        if ((giveteamid < 0 || giveteamid > 14)) {
            SendClientMessage(playerid, COLOR_RED, "No such teamid! Look at the teamid's.");
            SendClientMessage(playerid, COLOR_WHITE, "Grove: 1 l Ballas : 2 l Vagos: 3 l Aztegas: 4'");
            SendClientMessage(playerid, COLOR_WHITE, "Cop: 5 | Biker: 6 | Rapper: 7 ");
            return 1;
        }
        for (new i = 0; i < MAX_TURFS; i++) {
             new msg[ 256 ];
             format(msg, sizeof(msg), "~w~%s stats:~n~~g~Turfwars Won: %d~n~~r~Turfwars Lost: %d~n~~w~Rivals killed: %d~n~Homies lost: %d~n~~y~Turfs: %d~n~~w~Teamscore: %d",
             TeamInfo[ giveteamid ][ TeamName ], TeamInfo[ giveteamid ][ TurfWarsWon ],
             TeamInfo[ giveteamid ][ TurfWarsLost ], TeamInfo[ giveteamid ][ RivalsKilled ],
             TeamInfo[ giveteamid ][ HomiesDied ], OwnedTurfs2(giveteamid), TeamInfo[ giveteamid ][ TeamScore ]);
             new Text:txt = TextDrawCreate( 33.0, 261.0, msg);
             TextDrawUseBox( txt, 1 );
             TextDrawBoxColor( txt, 0x00000066 );
             TextDrawTextSize( txt, 141.0, 0.0 );
             TextDrawAlignment( txt, 0 );
             TextDrawBackgroundColor( txt, 0x000000ff );
             TextDrawFont( txt, 1 );
             TextDrawLetterSize( txt, 0.29, 1.0 );
             TextDrawColor( txt, 0xffffffff );
             TextDrawSetOutline( txt, 1 );
             TextDrawSetProportional( txt, 1 );
             TextDrawSetShadow( txt, 1 );
             TimeTextForPlayer( playerid, txt, 6000 );
             return 1;
        }
        return 1;
}
Reply
#2

At the end:
pawn Код:
return 0;
Might work.
Reply
#3

Quote:
Originally Posted by Stigg
Посмотреть сообщение
At the end:
pawn Код:
return 0;
Might work.
he not working
but th'x
Reply
#4

If I ignore the fact that the code is kind of meshed up (return in loops)
And the useage of some obsolete functions (like strtok)

I would say that you missed the dcmd part in OnPlayerCommandText
Reply
#5

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
If I ignore the fact that the code is kind of meshed up (return in loops)
And the useage of some obsolete functions (like strtok)

I would say that you missed the dcmd part in OnPlayerCommandText
nop this cmds is compilated

can help some one
Reply
#6

Quote:
Originally Posted by ...:Lucian:...
Посмотреть сообщение
nop this cmds is compilated

can help some one
Okey

And did you add

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
the dcmd part in OnPlayerCommandText
pawn Код:
dcmd(teamstats, 9, cmdtext);
?
Reply
#7

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
Okey

And did you add



pawn Код:
dcmd(teamstats, 9, cmdtext);
?
he have

pawn Код:
dcmd(teamstats, 9, cmdtext);
Reply
#8

than did you try to put a print("Test") in each line to check where the code stops working ?

If it stops working it will return 0 => Unknown Command
Reply
#9

You're Wrong Whit This

new Text:txt = TextDrawCreate( 33.0, 261.0, msg);
Reply
#10

Quote:
Originally Posted by necrobg3
Посмотреть сообщение
You're Wrong Whit This

new Text:txt = TextDrawCreate( 33.0, 261.0, msg);
is not this for why i dont have no error
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)