#1

Hi, Im making a cmd like /cmd select param1 param2

But this is fucked up If i do /t srk id its show me message from "tikr".

pawn Код:
CMD:t( playerid, params[ ] )
{
    if( ZaidejuDB[ playerid ][ pDarbas ] != 1 ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Jыs {FF0000}nedirbate {FFFFFF}Policijos Departamente!" );
    new
        Priezastis[ 51 ],
        Stringas[ 187 ],
        Sscanf[ 4 ][ 5 ],
        ID
    ;
    sscanf( params, "s[ 4 ]s[ 4 ]s[ 5 ]s[ 5 ]", Sscanf[ 0 ], Sscanf[ 1 ], Sscanf[ 2 ], Sscanf[ 3 ] );
    if( isnull( params ) )
    {
        SendClientMessage( playerid, -1, "{FFFFFF][ {FFFF00}INFORMACIJA {FFFFFF}]: Komandos naudojimas: {FF0000}/t <Veiksmas>" );
        SendClientMessage( playerid, -1, "{FFFFFF}[ {FF0000}VEIKSMAI {FFFFFF}]: srk, ita, tikr, uztv, bauda, amteises, aginklus, pstr" );
    }
    if( ! strcmp( Sscanf[ 0 ], "srk", true ) )
    {
        if( sscanf( Sscanf[ 0 ], "u", ID ) ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Komandos naudojimas: {FFFF00}/t srk <Vardas/ID>" );
        if( ID == INVALID_PLAYER_ID || ID == playerid ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Юaidлjas yra {FF0000}neprisijungжs!" );
        if( ZaidejuDB[ ID ][ pDarbas ] == 1 ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Рis юaidлjas dirba Policijos Departamente!" );
        if( ! IsPlayerNearPlayer( playerid, ID, 5.0 ) ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Юaidлjas privalo stovлti prie Jыsш!" );
        if( ZaidejuDB[ ID ][ pSurakintas ] == 0 )
        {
            format( Stringas, 102, "{FFFFFF][ {FF0000}PRANEРIMAS {FFFFFF]: %s %s Jus surakino!", ZaidejuDB[ playerid ][ pRPavadinimas ], GetPlayerNameEx( playerid, true ) );
            SendClientMessage( ID, -1, Stringas );
            format( Stringas, 121, "{FFFFFF][ {6EF83C}RACIJA {FFFFFF]: %s %s surakino %s", ZaidejuDB[ playerid ][ pRPavadinimas ], GetPlayerNameEx( playerid, true ), GetPlayerNameEx( ID, true ) );
            SendClientMessage( ID, -1, Stringas );
            SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Юmogus {6EF83C}sлkmingai {FFFFFF}surakintas!" );
            TogglePlayerControllable( ID, false );
            ZaidejuDB[ ID ][ pSurakintas ] = 1;
        }
        else
        {
            format( Stringas, 102, "{FFFFFF][ {6EF83C}PRANEРIMAS {FFFFFF]: %s %s Jus atrakino!", ZaidejuDB[ playerid ][ pRPavadinimas ], GetPlayerNameEx( playerid, true ) );
            SendClientMessage( ID, -1, Stringas );
            format( Stringas, 121, "{FFFFFF][ {6EF83C}RACIJA {FFFFFF]: %s %s atrakino %s", ZaidejuDB[ playerid ][ pRPavadinimas ], GetPlayerNameEx( playerid, true ), GetPlayerNameEx( ID, true ) );
            SendJobMessage( Stringas, 1 );
            SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Юmogus {6EF83C}sлkmingai {FFFFFF}atrakintas!" );
            TogglePlayerControllable( ID, true );
            ZaidejuDB[ ID ][ pSurakintas ] = 0;
        }
    }
    else if( ! strcmp( Sscanf[ 1 ], "ita", true ) )
    {
        new
            Kiekis
        ;
        if( sscanf( Sscanf[ 1 ], "uds[ 51 ]", ID, Kiekis, Priezastis ) ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Komandos naudojimas: {FFFF00}/t ita <Vardas/ID> <Kiekis> <Prieюastis>" );
        if( ID == INVALID_PLAYER_ID || ID == playerid ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Юaidлjas yra {FF0000}neprisijungжs!" );
        if( strlen( Priezastis ) > 50 ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Jыsш suvestas tekstas yra {FF0000}per ilgas! {FFFFFF}[ Iki 50 simboliш ]" );
        if( ZaidejuDB[ ID ][ pDarbas ] == 1 ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Рis юaidлjas dirba Policijos Departamente!" );
        if( ! IsPlayerNearPlayer( playerid, ID, 5.0 ) ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Юaidлjas privalo stovлti prie Jыsш!" );
        if( ZaidejuDB[ playerid ][ pSurakintas ] == 0 ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Юaidлjas {FF0000}nлra {FFFFFF}surakintas!" );
        if( Kiekis < 0 || Kiekis > 100 ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Kiekis suvestas {FF0000}blogai! {FFFFFF}[ 1 - 100 ]" );
        format( Stringas, 162, "{FFFFFF}[ {FF0000}PRANEРIMAS {FFFFFF}]: %s Jus бtarл {FF0000}%d i. l. {FFFFFF}[ %s ]", GetPlayerNameEx( playerid, true ), Kiekis, Priezastis );
        SendClientMessage( ID, -1, Stringas );
        SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Юmogus {6EF83C}sлkmingai {FFFFFF}бtartas!" );
        format( Stringas, 185, "{FFFFFF}[ {FF0000}PRANEРIMAS {FFFFFF}]: %s бtarл %s {FF0000}%d i. l. {FFFFFF}[ %s ]", GetPlayerNameEx( playerid, true ), GetPlayerNameEx( ID, true ), Kiekis, Priezastis );
        SendJobMessage( Stringas, 1 );
    }
    else if( ! strcmp( Sscanf[ 2 ], "tikr", true ) )
    {
        if( sscanf( Sscanf[ 2 ], "u", ID ) ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Komandos naudojimas: {FFFF00}/t tikr <Vardas/ID>" );
        if( ID == INVALID_PLAYER_ID || ID == playerid ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Юaidлjas yra {FF0000}neprisijungжs!" );
        if( ! IsPlayerNearPlayer( playerid, ID, 5.0 ) ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Юaidлjas privalo stovлti prie Jыsш!" );
        SendClientMessage( ID, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Praрome palaukti, Policija jus tikrina!" );
        new
            Blaivumas[ 17 ]
        ;
        if( GetPlayerDrunkLevel( ID ) > 250 ) Blaivumas = "{FF0000}girtas";
        else Blaivumas = "{6E83C}negirtas";
        new
            Veiksmas[ 52 ]
        ;
        if( GetPlayerState( ID ) == PLAYER_STATE_DRIVER ) format( Veiksmas, 52, "vairuoja {FFFF00}%s", MasinuPavadinimai[ GetVehicleModel( GetPlayerVehicleID( ID ) ) - 400 ] );
        else Veiksmas = "stovi ant kojш";
        format( Stringas, 187, "%s patikrinimas\n \n{FFFFFF}Юaidлjas yra %s\n \n%s.\n \nIeрkomas %d i. lygiu(-iais)", GetPlayerNameEx( ID, true ), Blaivumas, Veiksmas, GetPlayerWantedLevel( ID ) );
        ShowPlayerDialog( playerid, POLICE_CHECK, DIALOG_STYLE_LIST, "{FFFFFF}Patikrinimas", Stringas, "Uюdaryti", "" );
    }
    else if( ! strcmp( Sscanf[ 3 ], "uztv", true ) )
    {
        new
            Blokada
        ;
        if( sscanf( Sscanf[ 3 ], "d", Blokada ) ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Komandos naudojimas: {FFFF00}/t uztv <uюtvaros ID>" );
        if( Blokada < 1 || Blokada > 3 ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Uюtvaros ID suvestas {FF0000}blogai!" );
        if( ZaidejuDB[ playerid ][ pBlokada ] == false ) PlaceRoadBlock( playerid, Blokada );
        else DeleteRoadBlock( playerid );
    }
    else
    {
        SendClientMessage( playerid, -1, "{FFFFFF][ {FFFF00}INFORMACIJA {FFFFFF}]: Komandos naudojimas: {FF0000}/t <Veiksmas>" );
        SendClientMessage( playerid, -1, "{FFFFFF}[ {FF0000}VEIKSMAI {FFFFFF}]: srk, ita, tikr, uztv, bauda, amteises, aginklus, pstr" );
    }
    return true;
}
Reply
#2

pawn Код:
new
        Priezastis[ 51 ],
        Stringas[ 187 ],
        Sscanf[ 5 ],
        ID
    ;
    sscanf( params, "s[ 4 ]", Sscanf);
pawn Код:
if( ! strcmp( Sscanf, "srk", true ) )
pawn Код:
else if( ! strcmp( Sscanf, "ita", true ) )
Reply
#3

Thanks, I will test it soon.

Now another question.

Is there are any function like stradd? Because I did not found it on samp wikipedia..
Reply
#4

Quote:
Originally Posted by Gh0sT_
Посмотреть сообщение
Thanks, I will test it soon.

Now another question.

Is there are any function like stradd? Because I did not found it on samp wikipedia..
You mean a function that inserts a string into another string?
Yes.

pawn Код:
string(dest[], source[], pos = 0, len = sizeof(dest));
Reply
#5

Thanks, so..

new something[ 10 ] = "test";
string( something, " test", ?, 10 );

so "something" will be test test? anyways what I need to place in ?
Reply
#6

Quote:
Originally Posted by Gh0sT_
Посмотреть сообщение
Thanks, so..

new something[ 10 ] = "test";
string( something, " test", ?, 10 );

so "something" will be test test? anyways what I need to place in ?
Owww sorry! It's not string() but strins! Mistyped a word! Sorry.


So,
pawn Код:
strins( destination string, string you want to insert into destination string, position where it will be added, length of destination string);
Get it?


PS: Don't use [ 4 ] in the sscanf string! use [4] without spaces!
Reply
#7

**DELETED**
Reply
#8

pawn Код:
CMD:t( playerid, params[ ] )
{
    if( ! IsPlayerSpawned( playerid ) ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Jыs {FF0000}negalite {FFFFFF}naudoti komandш dabar!" );
    if( ZaidejuDB[ playerid ][ pDarbas ] != 1 ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Jыs {FF0000}nedirbate {FFFFFF}Policijos Departamente!" );
    new
        Priezastis[ 51 ],
        Sscanf2[ 12 ],
        Stringas[ 187 ],
        Sscanf[ 8 ],
        ID
    ;
    sscanf( params, "s[8]", Sscanf );
    sscanf( Sscanf, "s[12]", Sscanf2 );
    if( isnull( Sscanf ) )
    {
        SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Komandos naudojimas: {FF0000}/t <Veiksmas>" );
        SendClientMessage( playerid, -1, "{FFFFFF}[ {FF0000}VEIKSMAI {FFFFFF}]: srk, ita, tikr, uztv, bauda, amteises, agteises, aginklus, pstr, ieskomi, fiksuoti" );
        return true;
    }
    if( ! strcmp( Sscanf, "srk", true ) && ! isnull( Sscanf ) )
    {
        if( sscanf( Sscanf, "u", ID ) ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Komandos naudojimas: {FFFF00}/t srk <Vardas/ID>" );
        if( ID == INVALID_PLAYER_ID || ID == playerid ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Юaidлjas yra {FF0000}neprisijungжs!" );
        if( ZaidejuDB[ ID ][ pDarbas ] == 1 ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Рis юaidлjas dirba Policijos Departamente!" );
        if( ! IsPlayerNearPlayer( playerid, ID, 5.0 ) ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Юaidлjas privalo stovлti prie Jыsш!" );
        if( ZaidejuDB[ ID ][ pSurakintas ] == 0 )
        {
            format( Stringas, 102, "{FFFFFF][ {FF0000}PRANEРIMAS {FFFFFF]: %s %s Jus surakino!", ZaidejuDB[ playerid ][ pRPavadinimas ], GetPlayerNameEx( playerid, true ) );
            SendClientMessage( ID, -1, Stringas );
            format( Stringas, 121, "{FFFFFF][ {6EF83C}RACIJA {FFFFFF]: %s %s surakino %s", ZaidejuDB[ playerid ][ pRPavadinimas ], GetPlayerNameEx( playerid, true ), GetPlayerNameEx( ID, true ) );
            SendClientMessage( ID, -1, Stringas );
            SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Юmogus {6EF83C}sлkmingai {FFFFFF}surakintas!" );
            TogglePlayerControllable( ID, false );
            ZaidejuDB[ ID ][ pSurakintas ] = 1;
            return true;
        }
        else
        {
            format( Stringas, 102, "{FFFFFF][ {6EF83C}PRANEРIMAS {FFFFFF]: %s %s Jus atrakino!", ZaidejuDB[ playerid ][ pRPavadinimas ], GetPlayerNameEx( playerid, true ) );
            SendClientMessage( ID, -1, Stringas );
            format( Stringas, 121, "{FFFFFF][ {6EF83C}RACIJA {FFFFFF]: %s %s atrakino %s", ZaidejuDB[ playerid ][ pRPavadinimas ], GetPlayerNameEx( playerid, true ), GetPlayerNameEx( ID, true ) );
            SendJobMessage( Stringas, 1 );
            SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Юmogus {6EF83C}sлkmingai {FFFFFF}atrakintas!" );
            TogglePlayerControllable( ID, true );
            ZaidejuDB[ ID ][ pSurakintas ] = 0;
            return true;
        }
        return true;
    }
    if( ! strcmp( Sscanf, "ita", true ) && ! isnull( Sscanf ) )
    {
        new
            Kiekis
        ;
        if( sscanf( Sscanf, "uds[51]", ID, Kiekis, Priezastis ) ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Komandos naudojimas: {FFFF00}/t ita <Vardas/ID> <Kiekis> <Prieюastis>" );
        if( ID == INVALID_PLAYER_ID || ID == playerid ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Юaidлjas yra {FF0000}neprisijungжs!" );
        if( strlen( Priezastis ) > 50 ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Jыsш suvestas tekstas yra {FF0000}per ilgas! {FFFFFF}[ Iki 50 simboliш ]" );
        if( ZaidejuDB[ ID ][ pDarbas ] == 1 ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Рis юaidлjas dirba Policijos Departamente!" );
        if( ! IsPlayerNearPlayer( playerid, ID, 5.0 ) ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Юaidлjas privalo stovлti prie Jыsш!" );
        if( ZaidejuDB[ playerid ][ pSurakintas ] == 0 ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Юaidлjas {FF0000}nлra {FFFFFF}surakintas!" );
        if( Kiekis < 0 || Kiekis > 100 ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Kiekis suvestas {FF0000}blogai! {FFFFFF}[ 1 - 100 ]" );
        format( Stringas, 162, "{FFFFFF}[ {FF0000}PRANEРIMAS {FFFFFF}]: %s Jus бtarл {FF0000}%d i. l. {FFFFFF}[ %s ]", GetPlayerNameEx( playerid, true ), Kiekis, Priezastis );
        SendClientMessage( ID, -1, Stringas );
        SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Юmogus {6EF83C}sлkmingai {FFFFFF}бtartas!" );
        format( Stringas, 185, "{FFFFFF}[ {FF0000}PRANEРIMAS {FFFFFF}]: %s бtarл %s {FF0000}%d i. l. {FFFFFF}[ %s ]", GetPlayerNameEx( playerid, true ), GetPlayerNameEx( ID, true ), Kiekis, Priezastis );
        SendJobMessage( Stringas, 1 );
        return true;
    }
    if( ! strcmp( Sscanf, "tikr", true ) && ! isnull( Sscanf ) )
    {
        if( sscanf( Sscanf, "u", ID ) ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Komandos naudojimas: {FFFF00}/t tikr <Vardas/ID>" );
        if( ID == INVALID_PLAYER_ID || ID == playerid ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Юaidлjas yra {FF0000}neprisijungжs!" );
        if( ! IsPlayerNearPlayer( playerid, ID, 5.0 ) ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Юaidлjas privalo stovлti prie Jыsш!" );
        SendClientMessage( ID, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Praрome palaukti, Policija jus tikrina!" );
        new
            Blaivumas[ 17 ]
        ;
        if( GetPlayerDrunkLevel( ID ) > 250 ) Blaivumas = "{FF0000}girtas";
        else Blaivumas = "{6E83C}negirtas";
        new
            Veiksmas[ 52 ]
        ;
        if( GetPlayerState( ID ) == PLAYER_STATE_DRIVER ) format( Veiksmas, 52, "vairuoja {FFFF00}%s", MasinuPavadinimai[ GetVehicleModel( GetPlayerVehicleID( ID ) ) - 400 ] );
        else Veiksmas = "stovi ant kojш";
        format( Stringas, 187, "%s patikrinimas\n \n{FFFFFF}Юaidлjas yra %s\n \n%s.\n \nIeрkomas %d i. lygiu(-iais)", GetPlayerNameEx( ID, true ), Blaivumas, Veiksmas, GetPlayerWantedLevel( ID ) );
        ShowPlayerDialog( playerid, POLICE_CHECK, DIALOG_STYLE_LIST, "{FFFFFF}Patikrinimas", Stringas, "Uюdaryti", "" );
        return true;
    }
    if( ! strcmp( Sscanf, "uztv", true ) && ! isnull( params ) )
    {
        new
            Blokada
        ;
        if( sscanf( Sscanf, "d", Blokada ) ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Komandos naudojimas: {FFFF00}/t uztv <uюtvaros ID>" );
        if( Blokada < 1 || Blokada > 3 ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Uюtvaros ID suvestas {FF0000}blogai!" );
        if( ZaidejuDB[ playerid ][ pBlokada ] == false ) PlaceRoadBlock( playerid, Blokada );
        else DeleteRoadBlock( playerid );
        return true;
    }
    if( ! strcmp( Sscanf, "bauda", true ) && ! isnull( params ) )
    {
        if( sscanf( Sscanf, "u", ID ) ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Komandos naudojimas: {FFFF00}/t bauda <Vardas/ID>" );
        if( ID == INVALID_PLAYER_ID ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Юaidлjas yra {FF0000}neprisijungжs!" );
        if( ! IsPlayerNearPlayer( playerid, ID, 5.0 ) ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Юaidлjas privalo stovлti prie Jыsш!" );
        new
            Kaina = GetPlayerWantedLevel( ID ) * 75
        ;
        if( GetPlayerMoney( ID ) < Kaina ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Юaidлjas {FF0000}neturite {FFFFFF}tiek pinigш!" );
        format( Stringas, 175, "{FFFFFF}%s %s siшlo jums mokлti {FF0000}baudа!\n \n{FFFFFF}Jыsш юvaigюduиiш kiekis: {FFFF00}%d\n{FFFFFF}Bauda: {FFFF00}%d", ZaidejuDB[ playerid ][ pRPavadinimas ], GetPlayerNameEx( playerid, true ), GetPlayerWantedLevel( ID ), Kaina );
        ShowPlayerDialog( ID, FINE, DIALOG_STYLE_MSGBOX, "{FFFFFF}Baudos mokлjimas", Stringas, "Mokлti", "Nemokлti" );
        ZaidejuDB[ playerid ][ pBauda ] = playerid;
        return true;
    }
    if( ! strcmp( Sscanf, "pstr", true ) && ! isnull( Sscanf ) )
    {
        if( ! strcmp( Sscanf2, "prasyti", true ) && ! isnull( Sscanf2 ) )
        {
            format( Stringas, 83, "{FFFFFF}[ {FF0000}RACIJA {FFFFFF}]: %s praрo pastiprinimo!", GetPlayerNameEx( playerid, true ) );
            SendJobMessage( Stringas, 1 );
            SendJobMessage( "{FFFFFF}[ {FF0000}RACIJA {FFFFFF}]: Pozicija paюymлta raudonu taрku!", 1 );
            foreach(Player, cID)
            {
                if( ZaidejuDB[ cID ][ pDarbas ] == 1 )
                {
                    if( ZaidejuDB[ cID ][ pPastiprinimas ] == false )
                    {
                        SetPlayerMarkerForPlayer( cID, playerid, 0xFF0000FF );
                        ZaidejuDB[ cID ][ pPastiprinimas ] = true;
                    }
                }
            }
            return true;
        }
        if( ! strcmp( Sscanf2, "nebeprasyti", true ) && ! isnull( Sscanf2 ) )
        {
            format( Stringas, 92, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: %s nebepraрo pastiprinimo!", GetPlayerNameEx( playerid, true ) );
            SendJobMessage( Stringas, 1 );
            foreach(Player, pID)
            {
                if( ZaidejuDB[ pID ][ pPastiprinimas ] == true )
                {
                    SetPlayerMarkerForPlayer( pID, playerid, 0xFCFC2D00 );
                    ZaidejuDB[ pID ][ pPastiprinimas ] = false;
                }
            }
            return true;
        }
        else
        {
            SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Komandos naudojimas: {FFFF00}/t pstr <Veiksmas>" );
            SendClientMessage( playerid, -1, "{FFFFFF}[ {FF0000}VEIKSMAI {FFFFFF}]: prasyti, nebeprasyti" );
            return true;
        }
    }
    if( ! strcmp( Sscanf, "ieskomi", true ) && ! isnull( Sscanf ) )
    {
        new
            Kiekis = 0
        ;
        foreach(Player, wID)
        {
            if( GetPlayerWantedLevel( wID ) > 0 )
            {
                Kiekis ++;
                format( Stringas, 78, "{FFFFFF}[ {FF0000}%d {FFFFFF}]: %s | {FFFF00}%d", Kiekis, GetPlayerNameEx( wID, true ), GetPlayerWantedLevel( wID ) );
                SendClientMessage( playerid, -1, Stringas );
            }
        }
        return true;
    }
    if( ! strcmp( Sscanf, "fiksuoti", true ) && ! isnull( Sscanf ) )
    {
        if( ! strcmp( Sscanf2, "pradeti", true ) && ! isnull( Sscanf2 ) )
        {
            if( ZaidejuDB[ playerid ][ pFik ] != 0 ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Pirma baikite lokuoti! [ /t fiksuoti baigti ]" );
            if( sscanf( Sscanf, "u", ID ) ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Komandos naudojimas: {FFFF00}/t tikr <Vardas/ID>" );
            if( ID == INVALID_PLAYER_ID || ID == playerid ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Юaidлjas yra {FF0000}neprisijungжs!" );
            format( Stringas, 126, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Pradлjote lokuoti {FF0000}%s! {FFFFFF}[ /t fiksuoti baigti ]", GetPlayerNameEx( ID, true ) );
            SendClientMessage( playerid, -1, Stringas );
            SetPlayerMarkerForPlayer( playerid, ID, 0xFF0000FF );
            ZaidejuDB[ playerid ][ pFik ] = ID;
            return true;
        }
        if( ! strcmp( Sscanf2, "baigti", true ) && ! isnull( Sscanf2 ) )
        {
            if( ZaidejuDB[ playerid ][ pFik ] != 0 ) return SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Pirma pradлkite lokuoti! [ /t fiksuoti pradeti ]" );
            format( Stringas, 92, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Baigлte lokuoti {FF0000}%s", GetPlayerNameEx( ZaidejuDB[ playerid ][ pFik ], true ) );
            SendClientMessage( playerid, -1, Stringas );
            SetPlayerMarkerForPlayer( playerid, ZaidejuDB[ playerid ][ pFik ], 0xFCFC2D00 );
            ZaidejuDB[ playerid ][ pFik ] = 0;
            return true;
        }
        else
        {
            SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Komandos naudojimas: {FF0000}/t <Veiksmas>" );
            SendClientMessage( playerid, -1, "{FFFFFF}[ {FF0000}VEIKSMAI {FFFFFF}]: srk, ita, tikr, uztv, bauda, amteises, agteises, aginklus, pstr, ieskomi, fiksuoti" );
            return true;
        }
    }
    else
    {
        SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Komandos naudojimas: {FF0000}/t <Veiksmas>" );
        SendClientMessage( playerid, -1, "{FFFFFF}[ {FF0000}VEIKSMAI {FFFFFF}]: srk, ita, tikr, uztv, bauda, amteises, agteises, aginklus, pstr, ieskomi, fiksuoti" );
        return true;
    }
    return true;
}
Don't work.

If I type just /t, ok, its shows me the usage of command.
If I type just /t uztvara or any another command(I mean strcmp checking) with no params, ok, its shows me the usage of that command(/t uztvara)
But if I type /t uztvara <param> its shows me usage of the all command (I think its isnull checkin problem, or last else.. :S)

Please help!

Also, Im getting error "unreachable code"

At last two lines:

return true;
}
Reply
#9

pawn Код:
new
        Priezastis[ 51 ],
        Sscanf2[ 64 ],
        Stringas[ 187 ],
        Sscanf[ 8 ],
        ID
    ;
    sscanf( params, "s[8]s[64]", Sscanf, Sscanf2 );
    if( isnull( Sscanf ) )
    {
        SendClientMessage( playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Komandos naudojimas: {FF0000}/t <Veiksmas>" );
        SendClientMessage( playerid, -1, "{FFFFFF}[ {FF0000}VEIKSMAI {FFFFFF}]: srk, ita, tikr, uztv, bauda, amteises, agteises, aginklus, pstr, ieskomi, fiksuoti" );
        return true;
    }
Then change these to Sscanf2

pawn Код:
if( sscanf( Sscanf2, "u", ID ) )
    if( sscanf( Sscanf2, "uds[51]", ID, Kiekis, Priezastis ) )
    if( sscanf( Sscanf2, "d", Blokada ) )
You can delete the last

pawn Код:
return true;
Reply
#10

I will test it soon, thanks..

Btw, now another problem with house saving. Its floods mysql_log, 50+ lines, but there is only 1 house(2 queries for each house in saving)

pawn Код:
stock SaveHouse( houseid )
{
    // Funkcija: SaveHouses( houseid )
    // Iрsaugo visus namus, ir бraрo juos б MySQL duom. bazж
    new
        Query[ 750 ]
    ;
    format( Query, 750, "UPDATE `namudb` SET `IsejimasX` = '%f', `IsejimasY` = '%f', `IsejimasZ` = '%f', `IeimasX` = '%f', `IeimasY` = '%f', `IeimasZ` = '%f', `Parduodamas` = '%i', `Uzrakintas` = '%i', `Raktai` = '%i' WHERE `NamoID` = '%d'",
    NamuDB[ houseid ][ hIsejimas ][ 0 ], NamuDB[ houseid ][ hIsejimas ][ 1 ], NamuDB[ houseid ][ hIsejimas ][ 2 ], NamuDB[ houseid ][ hIeimas ][ 0 ], NamuDB[ houseid ][ hIeimas ][ 1 ], NamuDB[ houseid ][ hIeimas ][ 2 ], NamuDB[ houseid ][ hParduodamas ], NamuDB[ houseid ][ hUzrakintas ], NamuDB[ houseid ][ hRaktai ], NamuDB[ houseid ][ hNamoID ] );
    mysql_query( Query );
    format( Query, 500, "UPDATE `namudb` SET `Savininkas` = '%s', `RaktuSavininkas` = '%s', `Interior` = '%d', `NamoID` = '%d', `PadetiPinigai` = '%d', `Kaina` = '%d' WHERE `NamoID` = '%d'", NamuDB[ houseid ][ hSavininkas ], NamuDB[ houseid ][ hRSavininkas ], NamuDB[ houseid ][ hInterior ], NamuDB[ houseid ][ hNamoID ], NamuDB[ houseid ][ hPinigai ], NamuDB[ houseid ][ hKaina ], NamuDB[ houseid ][ hNamoID ] );
    mysql_query( Query );
    Delete3DTextLabel( NamuDB[ houseid ][ hText ] );
}
and OnGameModeExit:

foreach(fNamai, hID) SaveHouse( hID );
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)