SA-MP Forums Archive
Dialog Save problem - 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)
+--- Thread: Dialog Save problem (/showthread.php?tid=625654)



Dialog Save problem - SytonicX - 04.01.2017

PHP код:
                    case 3// clan
                    
{
                        
ShowPlayerDialog(playerid65DIALOG_STYLE_INPUT"{17a005}Clan""{ffffff}Please enter the {17a005}clan {ffffff}in order to change it""Select""Cancel");
                        
myStrcpy(wat"Clan");
                        
//return 1;
                    
}
//===================================//
    
if(dialogid == 65)
    {
        if(!
response)
        {
            
SendClientMessage(playeridCOLOR_RED"You cancelled the dialog!");
        }
        else
        {
            if(
strlen(inputtext))
            {
                new 
iPlayer;
                
PlayerInfo[iPlayer][clan] = strval(inputtext);
                new 
string64 ];
                
format(stringsizeof(string), "INFO: Player Clan changed to {3BB9FF}%s.",strval(inputtext));
                
SendClientMessage(playerid, -1string);
            }
        }
        return 
1;
    } 
The dialog is not saving when i try. When i try to enter anything inside the dialog, its not saving at the PlayerInfo[playerid][clan] its just switching the word "None" to " ", which means its just removing the word, nothing else.


Re: Dialog Save problem - Lordzy - 04.01.2017

As per the code, it expects you to enter a numerical inputtext. Whenever you type "None", strval will return 0. Also, you used the wrong format specifier while formatting string. It should be "%d" instead of "%s" since strval returns integer, not string.

I've to also add that I'm totally unclear about your code. What are you trying to do by declaring iPlayer? Your dialog responses will change the array data for zeroth index only.


Re: Dialog Save problem - SytonicX - 04.01.2017

can you tell me what is the right "str" code to make it read string? and what exactly should I type?


Re: Dialog Save problem - Lordzy - 04.01.2017

Quote:
Originally Posted by SytonicX
Посмотреть сообщение
can you tell me what is the right "str" code to make it read string? and what exactly should I type?
I'm not familiar with your clan data structure. Your code under OnDialogResponse won't work properly, unless you purposely intended it to be like that.
pawn Код:
format(string, sizeof(string), "INFO: Player Clan changed to {3BB9FF}%d.",strval(inputtext));
Replaced %s with %d



Re: Dialog Save problem - SytonicX - 04.01.2017

Look, let me tell you how is it working, when I open a dialog and press on " Clan" this dialog is going to show up, when I type inside it for example: " Testing " or anything, its going to show up next to the word clan in the main dialog.


Re: Dialog Save problem - SytonicX - 05.01.2017

Bumb, still need help with this.


Re: Dialog Save problem - oMa37 - 05.01.2017

PHP код:
new iPlayer
PlayerInfo[iPlayer][clan] = strval(inputtext); 
What are you trying to do here?
I assume you are trying to assign this variable to playerid, if so you can do this;

PHP код:
PlayerInfo[playerid][clan] = strval(inputtext); 



Re: Dialog Save problem - SytonicX - 05.01.2017

I am trying to give it to a target player not to myself.


Respuesta: Dialog Save problem - Whillyrez - 05.01.2017

PHP код:
PlayerInfo[iPlayer][clan] = strval(inputtext); 
re-place this with this:
PHP код:
format(PlayerInfo[iPlayer][clan], 10inputtext);