09.05.2011, 17:30
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".
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;
}