Dialog problem -
tbedy - 11.02.2018
Well i have dialog problem
When you choosing with double click it opens another dialog. it has to choose with ENTER to be normal...
Код:
RegisterTD[ playerid ][ 18 ] = CreatePlayerTextDraw(playerid, 325.528839, 155.591705, "spol");
PlayerTextDrawLetterSize(playerid, RegisterTD[ playerid ][ 18 ], 0.312881, 1.296083);
PlayerTextDrawAlignment(playerid, RegisterTD[ playerid ][ 18 ], 2);
PlayerTextDrawColor(playerid, RegisterTD[ playerid ][ 18 ], 255);
PlayerTextDrawSetShadow(playerid, RegisterTD[ playerid ][ 18 ], 0);
PlayerTextDrawSetOutline(playerid, RegisterTD[ playerid ][ 18 ], 0);
PlayerTextDrawBackgroundColor(playerid, RegisterTD[ playerid ][ 18 ], 51);
PlayerTextDrawFont(playerid, RegisterTD[ playerid ][ 18 ], 2);
PlayerTextDrawSetProportional(playerid, RegisterTD[ playerid ][ 18 ], 1);
PlayerTextDrawSetSelectable(playerid, RegisterTD[ playerid ][ 18 ], true);
Код:
if( playertextid == RegisterTD[ playerid ][ 18 ] ) {
SPD( playerid, dialog_SPOL, DSL, "Spol", "Musko\nZensko", "Odabir", "Izadji" );
return true;
}
When you choosing with double click in dialog above (countries) it opens below TD.. with ENTER choosing its everything normal
Код:
RegisterTD[ playerid ][ 17 ] = CreatePlayerTextDraw(playerid, 324.170013, 126.074966, "lozinka");
PlayerTextDrawLetterSize(playerid, RegisterTD[ playerid ][ 17 ], 0.312881, 1.296083);
PlayerTextDrawAlignment(playerid, RegisterTD[ playerid ][ 17 ], 2);
PlayerTextDrawColor(playerid, RegisterTD[ playerid ][ 17 ], 255);
PlayerTextDrawSetShadow(playerid, RegisterTD[ playerid ][ 17 ], 0);
PlayerTextDrawSetOutline(playerid, RegisterTD[ playerid ][ 17 ], 0);
PlayerTextDrawBackgroundColor(playerid, RegisterTD[ playerid ][ 17 ], 51);
PlayerTextDrawFont(playerid, RegisterTD[ playerid ][ 17 ], 2);
PlayerTextDrawSetProportional(playerid, RegisterTD[ playerid ][ 17 ], 1);
PlayerTextDrawSetSelectable(playerid, RegisterTD[ playerid ][ 17 ], true);
Код:
if( playertextid == RegisterTD[ playerid ][ 17 ] ) {
SPD( playerid, dialog_REGISTER, DSI, "Registracija", "Password moze sadrzavati minimalno 6, a maksimalno 20 znaka", "Registriraj", "Izadji" );
return true;
}
Re: Dialog problem -
Mugala - 11.02.2018
can u show me a full callback?
Re: Dialog problem -
tbedy - 11.02.2018
(dialog_spol) Double click choosing doesn't work:
http://prntscr.com/id4lql (it opens again same dialog)
(dialog_country) Double click choosing opens -> dialog_spol ..
http://prntscr.com/id4lz1 - >
http://prntscr.com/id4lql
Re: Dialog problem -
Mugala - 11.02.2018
no dude, I mean a callback. callback which starts with
public ...
callback definition from wiki -
https://sampwiki.blast.hk/wiki/Category:Scripting_Callbacks
Re: Dialog problem -
tbedy - 11.02.2018
Код:
public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[])
{
new dStyle = DSL;
if(strfind(inputtext, "%", true) != -1 || strfind(inputtext, "#", true) != -1)
{
SCM( playerid, CRVENA, "Uneli ste format koji server ne podrzava!");
return 1;
}
////////////////////////////////////////////////////////////////////////////
if( dialogid == dialog_LOGIN ) {
if( !response ) return Kick( playerid );
if( response ) {
if( !strcmp( inputtext, PlayerInfo[ playerid ][ xLozinka ], false ) && !isnull( inputtext ) ) {
INI_ParseFile( Korisnici( playerid ), "OcitajKorisnika", .bExtra = true, .extra = playerid );
if( fexist( Admini( playerid ) ) ) INI_ParseFile( Admini( playerid ), "OcitajAdmina", .bExtra = true, .extra = playerid );
if( fexist( Inventory( playerid ) ) ) INI_ParseFile( Inventory( playerid ), "LoadInventory", .bExtra = true, .extra = playerid );
LoginTDControl( playerid, false );
new datum[ 64 ]; new year, month,day;
getdate( year, month, day );
new tmphour, tmpminute, tmpsecond;
gettimeEx( tmphour, tmpminute, tmpsecond );
FixHour( tmphour );
tmphour = shifthour;
format( datum, sizeof( datum ), "%02d/%02d/%d - %d/%d/%d", day, month, year, tmphour, tmpminute, tmpsecond );
strmid( PlayerInfo[ playerid ][ xLastLogin ], datum, 0, strlen( datum ), 64 );
if( PlayerInfo[ playerid ][ xFirmaID ] != -1 ) {
BussinesInfo[ PlayerInfo[ playerid ][ xFirmaID ] ][ bNeaktivnost ] = 0;
SaveBussines( PlayerInfo[ playerid ][ xFirmaID ] );
}
if( PlayerInfo[ playerid ][ xProperty ][ 0 ] != -1 ) {
II[ PlayerInfo[ playerid ][ xProperty ][ 0 ] ][ iNeaktivnost ] = 0;
SaveProperty( PlayerInfo[ playerid ][ xProperty ][ 0 ] );
}
if( PlayerInfo[ playerid ][ xProperty ][ 1 ] != -1 ) {
II[ PlayerInfo[ playerid ][ xProperty ][ 1 ] ][ iNeaktivnost ] = 0;
SaveProperty( PlayerInfo[ playerid ][ xProperty ][ 1 ] );
}
if( PlayerInfo[ playerid ][ xProperty ][ 2 ] != -1 ) {
II[ PlayerInfo[ playerid ][ xProperty ][ 2 ] ][ iNeaktivnost ] = 0;
SaveProperty( PlayerInfo[ playerid ][ xProperty ][ 2 ] );
}
if( PlayerInfo[ playerid ][ xVoziloID ][ 0 ] != -1 ) {
VehicleInfo[ PlayerInfo[ playerid ][ xVoziloID ][ 0 ] ][ vNeaktivnost ] = 0;
SaveVehicle( PlayerInfo[ playerid ][ xVoziloID ][ 0 ] );
}
if( PlayerInfo[ playerid ][ xVoziloID ][ 1 ] != -1 ) {
VehicleInfo[ PlayerInfo[ playerid ][ xVoziloID ][ 1 ] ][ vNeaktivnost ] = 0;
SaveVehicle( PlayerInfo[ playerid ][ xVoziloID ][ 1 ] );
}
if( PlayerInfo[ playerid ][ xVoziloID ][ 2 ] != -1 ) {
VehicleInfo[ PlayerInfo[ playerid ][ xVoziloID ][ 2 ] ][ vNeaktivnost ] = 0;
SaveVehicle( PlayerInfo[ playerid ][ xVoziloID ][ 2 ] );
}
new banfile[ 100 ]; format( banfile, sizeof( banfile ), FILE_BAN, ImeIgraca( playerid ) );
if( fexist( banfile ) ) {
new File: UserFile = fopen( banfile, io_read );
new razlogbana[ 128 ] = "Nepoznat";
new key[256];
new Data[256];
while ( fread( UserFile , Data, sizeof( Data ) ) ) {
key = ini_GetKey( Data );
if( strcmp( key , "Razlog" , true ) == 0 ) {
format( razlogbana, strlen( ini_GetValue ( Data ) ), "%s", ini_GetValue( Data ) );
}
}
fclose( UserFile );
getdate( year, month, day );
SendClientMessage( playerid, SVETLOCRVENA, " A - HP // Vas acc je trenutno banovan! Izbaceni ste!" );
format( globalstring, sizeof( globalstring ), "Razlog bana: %s", razlogbana );
SendClientMessage( playerid, BELA, globalstring );
format( globalstring, sizeof( globalstring ), "Vas server nick: %s, Danasnji datum: %d.%d.%d", ImeIgraca( playerid ), day, month, year );
SendClientMessage( playerid, ZUTA, globalstring );
Muma_Kick( playerid );
return 1;
}
if( PlayerInfo[ playerid ][ xPocetniTut ] == 0 ) {
TimerTutorial[ playerid ] = SetTimerEx( "PocetniTut", 15000, false, "ii", playerid, 1 );
PocetniTutorialStartovan[ playerid ] = true;
}
else {
aliasLogin( playerid );
if( fexist( Inventory( playerid ) ) ) ProveriInvOruzje[ playerid ] = SetTimerEx( "ProveraInvOruzja", 10, false, "dd", playerid, 0 );
Muma_SetSpawnInfo( playerid );
SpawnPlayer( playerid ); PlayerLogged[ playerid ] = true;
antiCheatCS[ playerid ][ TeleportCheck ] = 4;
antiCheatCS[ playerid ][ WeaponDetect ] = 4;
for( new i = 0; i < 34; i ++) {
TextDrawShowForPlayer( playerid, IGGLAVNI[ i ] );
TextDrawShowForPlayer( playerid, HappyHoursOFF );
}
if( ServerInfo[ HappyHours ] == true ) {
TextDrawShowForPlayer( playerid, HappyHoursON );
TextDrawHideForPlayer( playerid, HappyHoursOFF );
}
if( PlayerInfo[ playerid ][ xPol ] == 0 ) PlayerInfo[ playerid ][ xPol ] = 1;
SetPlayerVirtualWorld( playerid, 0 );
ResetAllWeapons( playerid );
new playersip[ 128 ];
GetPlayerIp( playerid, playersip, sizeof( playersip ) );
format( globalstring, sizeof( globalstring ), "Igrac: %s | [ID:%d] | [LVL:%d] | [IP:%s] se ulogovao na server.", ImeIgraca( playerid ), playerid, PlayerInfo[ playerid ][ xLevel ], playersip );
AdminPoruka( ZUTA, globalstring );
}
}
else {
if( PokusajLogina[ playerid ] == MAX_POKUSAJ_LOGINA - 1 ) {
format( globalstring, sizeof( globalstring ), "Uneli ste krivu lozinku %d puta i dobili kick!", MAX_POKUSAJ_LOGINA );
SCM( playerid, CRVENA, globalstring);
Kick( playerid );
return true;
}
PokusajLogina[ playerid ]++;
SendClientMessage( playerid, CRVENA, "Kriva lozinka!" );
format( sDStrg, sizeof( sDStrg ), DialogTekstovi[ 0 ], MAX_POKUSAJ_LOGINA );
SPD( playerid, dialog_LOGIN, DSP, D_NASLOV, sDStrg, D_ODABERI, D_ODUSTANI );
}
}
return true;
}
else if( dialogid == dialog_REGISTER ) {
if( !response ) return 1;
if( response ) {
if( strlen( inputtext ) < 6 || strlen(inputtext) > 20 ) {
SPD( playerid, dialog_REGISTER, DSI, "Registracija", "Password moze sadrzavati minimalno 6 a maximalno 20 znaka", "Registriraj", "Izlaz");
return 1;
}
else {
strmid( PlayerInfo[ playerid ][ xLozinka ], inputtext, 0, strlen( inputtext ), 50);
PlayerTextDrawSetString( playerid, RegisterTD[ playerid ][ 17 ], inputtext );
InputPassword[ playerid ] = true;
SelectTextDraw( playerid, GLAVNA );
}
}
}
else if( dialogid == dialog_SPOL ) {
if( !response ) return 1;
if( response ) {
switch( listitem ) {
case 0: {
PlayerInfo[ playerid ][ xPol ] = 1;
PlayerTextDrawSetString( playerid, RegisterTD[ playerid ][ 18 ], "Musko" );
SelectTextDraw( playerid, GLAVNA );
PlayerTextDrawShow(playerid, NickIgracaTD[ playerid ] );
}
case 1: {
PlayerInfo[ playerid ][ xPol ] = 2;
PlayerTextDrawSetString( playerid, RegisterTD[ playerid ][ 18 ], "Zensko" );
SelectTextDraw( playerid, GLAVNA );
PlayerTextDrawShow(playerid, NickIgracaTD[ playerid ] );
}
}
}
}
else if( dialogid == dialog_COUNTRY ) {
if( !response ) return 1;
if( response ) {
switch( listitem ) {
case 0: {
PlayerInfo[ playerid ][ xDrzava ] = 3;
PlayerTextDrawSetString( playerid, RegisterTD[ playerid ][ 21 ], "Srbija" );
ChoseCountry[ playerid ] = true;
SelectTextDraw( playerid, GLAVNA );
CountryTD(playerid);
PlayerTextDrawShow(playerid, NickIgracaTD[ playerid ] );
}
case 1: {
PlayerInfo[ playerid ][ xDrzava ] = 2;
PlayerTextDrawSetString( playerid, RegisterTD[ playerid ][ 21 ], "Hrvatska" );
ChoseCountry[ playerid ] = true;
SelectTextDraw( playerid, GLAVNA );
CountryTD(playerid);
PlayerTextDrawShow(playerid, NickIgracaTD[ playerid ] );
}
case 2: {
PlayerInfo[ playerid ][ xDrzava ] = 1;
PlayerTextDrawSetString( playerid, RegisterTD[ playerid ][ 21 ], "Makedonija" );
ChoseCountry[ playerid ] = true;
SelectTextDraw( playerid, GLAVNA );
CountryTD(playerid);
PlayerTextDrawShow(playerid, NickIgracaTD[ playerid ] );
}
case 3: {
PlayerInfo[ playerid ][ xDrzava ] = 4;
PlayerTextDrawSetString( playerid, RegisterTD[ playerid ][ 21 ], "Crna_Gora" );
ChoseCountry[ playerid ] = true;
SelectTextDraw( playerid, GLAVNA );
CountryTD(playerid);
PlayerTextDrawShow(playerid, NickIgracaTD[ playerid ] );
}
case 4: {
PlayerInfo[ playerid ][ xDrzava ] = 5;
PlayerTextDrawSetString( playerid, RegisterTD[ playerid ][ 21 ], "BiH" );
ChoseCountry[ playerid ] = true;
SelectTextDraw( playerid, GLAVNA );
CountryTD(playerid);
PlayerTextDrawShow(playerid, NickIgracaTD[ playerid ] );
}
case 5: {
PlayerInfo[ playerid ][ xDrzava ] = 6;
PlayerTextDrawSetString( playerid, RegisterTD[ playerid ][ 21 ], "Ostalo" );
ChoseCountry[ playerid ] = true;
SelectTextDraw( playerid, GLAVNA );
CountryTD(playerid);
PlayerTextDrawShow(playerid, NickIgracaTD[ playerid ] );
}
}
}
}
else if( dialogid == dialog_AGE ) {
if( !response ) return 1;
if( response ) {
new age = strval( inputtext );
if( age < 17 || age > 40 ) return SPD( playerid, dialog_AGE, DSI, "Godine", "U prazni prostor ispod unesite IC vaљe godine\nMinimalno 17 maximalno 40", "Unos", "Izadji" );
PlayerTextDrawSetString( playerid, RegisterTD[ playerid ][ 20 ], inputtext );
PlayerInfo[ playerid ][ xGodine ] = age;
InputAge[ playerid ] = true;
SelectTextDraw( playerid, GLAVNA );
}
}
else if( dialogid == dialog_MAIL ) {
if( !response ) return 1;
if( response ) {
new mailstring = strfind( inputtext, "@", true), tackastring = strfind( inputtext, ".", true );
if( mailstring == -1 || tackastring == -1) {
SPD(playerid, dialog_MAIL, DSI, "Mail", "U prazni prostor ispod unesite vasu e-mail adresu.\nE-mail adresa ce nam posluziti u vracanju vasih passworda.(Bez maila nema vracanja passworda)", "Unos", "Izlaz");
}
else {
strmid( PlayerInfo[ playerid ][ xEmail ], inputtext, 0, strlen( inputtext ), 34 );
PlayerTextDrawSetString( playerid, RegisterTD[ playerid ][ 19 ], inputtext );
PlayerTextDrawLetterSize( playerid, RegisterTD[ playerid ][ 19 ], 0.200000, 1.000000 );
PlayerTextDrawShow( playerid, RegisterTD[ playerid ][ 19 ] );
InputMail[ playerid ] = true;
SelectTextDraw( playerid, GLAVNA );
}
}
}
else if( dialogid == dialog_******* )
{
if ( !response ) return SendInfoMessage( playerid, "Odustali ste od pustanja pjesme." );
if( strlen( inputtext ))
{
foreach(new i : Player)
{
new ola[ 255 ];
format( ola, sizeof( ola ), "https://6t.pe/?song=%s", inputtext );
PlayAudioStreamForPlayer( i, ola );
}
}
}
Re: Dialog problem -
Mugala - 11.02.2018
well I dont understand, u're using TextDraw's selection in OnDialogResponse?
Re: Dialog problem -
tbedy - 11.02.2018
Yes, clickable TD opens dialog...
And dialog_country on choosing opens dialog_spol like you press TD for dialog_spol but you just tried to choose country
Re: Dialog problem -
Mugala - 11.02.2018
dude, u must use this callback for PlayerTextDraw's codding -
https://sampwiki.blast.hk/wiki/OnPlayerClickPlayerTextDraw
Re: Dialog problem -
tbedy - 11.02.2018
Код:
public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
{
if( playertextid == RegisterTD[ playerid ][ 17 ] ) {
SPD( playerid, dialog_REGISTER, DSI, "Registracija", "Password moze sadrzavati minimalno 6, a maksimalno 20 znaka", "Registriraj", "Izadji" );
return true;
}
if( playertextid == RegisterTD[ playerid ][ 18 ] ) {
SPD( playerid, dialog_SPOL, DSL, "Spol", "Musko\nZensko", "Odabir", "Izadji" );
return true;
}
if( playertextid == RegisterTD[ playerid ][ 21 ] ) {
SPD( playerid, dialog_COUNTRY, DSL, "Drzava", "Srbija\nHrvatska\nMakedonija\nCrna Gora\nBosna i Hercegovina\nOstalo", "Odabir", "Izadji" );
return true;
}
if( playertextid == RegisterTD[ playerid ][ 20 ] ) {
SPD( playerid, dialog_AGE, DSI, "Godine", "U prazni prostor ispod unesite vase godine\nMinimalno 12 maximalno 70", "Unos", "Izadji" );
return true;
}
if( playertextid == RegisterTD[ playerid ][ 19 ] ) {
SPD(playerid, dialog_MAIL, DSI, "Mail", "U prazni prostor ispod unesite vasu e-mail adresu.\nE-mail adresa ce nam posluziti u vracanju vaseg passworda.", "Unos", "Izadji" );
return true;
}
Re: Dialog problem -
Mugala - 11.02.2018
so you can't use a double-click after this callback? on these textdraws?
Re: Dialog problem -
tbedy - 11.02.2018
Yep... can use double click on dialogs which opens on TD click...
dialog_spol (on double click) opening - > dialog_spol
dialog_country (on double click - choosing country) opening - > dialog_spol
Re: Dialog problem -
Mugala - 11.02.2018
it's probably u haven't hidden the selectable textdraw, which is behind of the dialog.
Re: Dialog problem -
tbedy - 11.02.2018
I don't need to hide TD... TD's are shown all them time, its like menu of TD's...
http://prntscr.com/id4wyg |
http://prntscr.com/id4x21
Any why its black font when cursor is above, and blue font when curs is below
Re: Dialog problem -
Mugala - 11.02.2018
fix your textdraw's sizes.
Re: Dialog problem -
tbedy - 11.02.2018
Textdraw size's are all fine...
its should be problem somewhere else?
i think in dialog... because TD's are fine, but only when i double click that dialog to choose, opening some else dialog...
really wierd
Re: Dialog problem -
Mugala - 11.02.2018
is it open a dialog which is only placed at TextDraws? but I think that it's about size, look at your pictures, they're all blue when you're selecting.