Inputtext problem
#1

Ok, so I tried to make something like police monitor and there I used select textdraw and other stuff, that doesn't matter right now.I have problem with geting string from dialog.I tried using inputtext and I'am getting errors so here is what I have done by now.
Код:
if(dialogid == DIALOG_RECORD)
    {
        if(response)
        {
            new id[MAX_PLAYERS], h, m, s, Name[MAX_PLAYER_NAME];
 
            gettime(h,m,s);
			RPName(playerid, Name);
			SCM(playerid, GRAD2, "_______________| {FFFFFF}MONITOR {BFC0C2}|_______________");
			format(CmdString, sizeof CmdString, "	Name: %s", CrimeInfo[inputtext][cDone]);
			SCM(playerid, WHITE, CmdString);
			format(CmdString, sizeof CmdString, "	Crime: %s", CrimeInfo[inputtext][cCrime]);
			SCM(playerid, WHITE, CmdString);
			format(CmdString, sizeof CmdString, "	Reported: %s", CrimeInfo[inputtext][cReported]);
			SCM(playerid, WHITE, CmdString);
			format(CmdString, sizeof CmdString, "	Your name: %s", hIme);
			SCM(playerid, WHITE, CmdString);
			format(CmdString, sizeof CmdString, "________________________________|{FFFFFF}%d:%d{BFC0C2}|__", h, m);
			SCM(playerid, WHITE, CmdString);
        }
If you need something else just post!
Reply
#2

show the function or enum of CrimeInfo
Reply
#3

Here you go
Код:
enum crInfo
{
	cDone[MAX_PLAYER_NAME],
	cReported[MAX_PLAYER_NAME],
	cCrime[64],
};
new CrimeInfo[MAX_PLAYERS][crInfo];
Reply
#4

I have a question: What you have to type in that dialog? the playerid or name?
Reply
#5

try this
PHP код:
enum crInfo
{
    
cDone,
    
cReported,
    
cCrime[64],
};
new 
CrimeInfo[MAX_PLAYERS][crInfo];
if(
dialogid == DIALOG_RECORD)
{
        if(
response)
        {
            new 
ID strval(inputtext);
            new 
id[MAX_PLAYERS], hmsName[MAX_PLAYER_NAME];
            
gettime(h,m,s);
            
RPName(playeridName);
            
SCM(playeridGRAD2"_______________| {FFFFFF}MONITOR {BFC0C2}|_______________");
            
format(CmdStringsizeof CmdString"    Name: %s"CrimeInfo[ID][cDone]);
            
SCM(playeridWHITECmdString);
            
format(CmdStringsizeof CmdString"    Crime: %s"CrimeInfo[ID][cCrime]);
            
SCM(playeridWHITECmdString);
            
format(CmdStringsizeof CmdString"    Reported: %s"CrimeInfo[ID][cReported]);
            
SCM(playeridWHITECmdString);
            
format(CmdStringsizeof CmdString"    Your name: %s"hIme);
            
SCM(playeridWHITECmdString);
            
format(CmdStringsizeof CmdString"________________________________|{FFFFFF}%d:%d{BFC0C2}|__"hm);
            
SCM(playeridWHITECmdString);
        }

Reply
#6

Quote:
Originally Posted by Lucky13
Посмотреть сообщение
I have a question: What you have to type in that dialog? the playerid or name?
When dialog pop out I have to enter player name

Quote:
Originally Posted by IceBilizard
Посмотреть сообщение
try this
PHP код:
enum crInfo
{
    
cDone,
    
cReported,
    
cCrime[64],
};
new 
CrimeInfo[MAX_PLAYERS][crInfo];
if(
dialogid == DIALOG_RECORD)
{
        if(
response)
        {
            new 
ID strval(inputtext);
            new 
id[MAX_PLAYERS], hmsName[MAX_PLAYER_NAME];
            
gettime(h,m,s);
            
RPName(playeridName);
            
SCM(playeridGRAD2"_______________| {FFFFFF}MONITOR {BFC0C2}|_______________");
            
format(CmdStringsizeof CmdString"    Name: %s"CrimeInfo[ID][cDone]);
            
SCM(playeridWHITECmdString);
            
format(CmdStringsizeof CmdString"    Crime: %s"CrimeInfo[ID][cCrime]);
            
SCM(playeridWHITECmdString);
            
format(CmdStringsizeof CmdString"    Reported: %s"CrimeInfo[ID][cReported]);
            
SCM(playeridWHITECmdString);
            
format(CmdStringsizeof CmdString"    Your name: %s"hIme);
            
SCM(playeridWHITECmdString);
            
format(CmdStringsizeof CmdString"________________________________|{FFFFFF}%d:%d{BFC0C2}|__"hm);
            
SCM(playeridWHITECmdString);
        }

It's not working.There is no errors but when I type in name or ID in dialog it just show me blank text just like it did before.And as I know "strval" is used to convert string to integer
Reply
#7

Try this one:

Код:
enum crInfo 
{ 
    cDone, 
    cReported, 
    cCrime[64], 
}; 
new CrimeInfo[MAX_PLAYERS][crInfo]; 


if(dialogid == DIALOG_RECORD) 
{ 
        if(response) 
        { 
            new pid = strval(inputtext); 
            new h, m, s, Name[MAX_PLAYER_NAME]; 

            gettime(h,m,s); 
            RPName(playerid, Name); 
            SCM(playerid, GRAD2, "_______________| {FFFFFF}MONITOR {BFC0C2}|_______________"); 
            format(CmdString, sizeof CmdString, "    Name: %s", CrimeInfo[pid][cDone]); 
            SCM(playerid, WHITE, CmdString); 
            format(CmdString, sizeof CmdString, "    Crime: %s", CrimeInfo[pid][cCrime]); 
            SCM(playerid, WHITE, CmdString); 
            format(CmdString, sizeof CmdString, "    Reported: %s", CrimeInfo[pid][cReported]); 
            SCM(playerid, WHITE, CmdString); 
            format(CmdString, sizeof CmdString, "    Your name: %s", hIme); 
            SCM(playerid, WHITE, CmdString); 
            format(CmdString, sizeof CmdString, "________________________________|{FFFFFF}%d:%d{BFC0C2}|__", h, m); 
            SCM(playerid, WHITE, CmdString); 
        } 
}
Reply
#8

Quote:
Originally Posted by Lucky13
Посмотреть сообщение
Try this one:

Код:
enum crInfo 
{ 
    cDone, 
    cReported, 
    cCrime[64], 
}; 
new CrimeInfo[MAX_PLAYERS][crInfo]; 


if(dialogid == DIALOG_RECORD) 
{ 
        if(response) 
        { 
            new pid = strval(inputtext); 
            new h, m, s, Name[MAX_PLAYER_NAME]; 

            gettime(h,m,s); 
            RPName(playerid, Name); 
            SCM(playerid, GRAD2, "_______________| {FFFFFF}MONITOR {BFC0C2}|_______________"); 
            format(CmdString, sizeof CmdString, "    Name: %s", CrimeInfo[pid][cDone]); 
            SCM(playerid, WHITE, CmdString); 
            format(CmdString, sizeof CmdString, "    Crime: %s", CrimeInfo[pid][cCrime]); 
            SCM(playerid, WHITE, CmdString); 
            format(CmdString, sizeof CmdString, "    Reported: %s", CrimeInfo[pid][cReported]); 
            SCM(playerid, WHITE, CmdString); 
            format(CmdString, sizeof CmdString, "    Your name: %s", hIme); 
            SCM(playerid, WHITE, CmdString); 
            format(CmdString, sizeof CmdString, "________________________________|{FFFFFF}%d:%d{BFC0C2}|__", h, m); 
            SCM(playerid, WHITE, CmdString); 
        } 
}
It's same thing that IceBilizard has done.

Strval is used to convert string to integer
Reply
#9

Quote:
Originally Posted by Wex56
Посмотреть сообщение
It's same thing that IceBilizard has done.

Strval is used to convert string to integer
IceBilizard's:
Код:
enum crInfo 
{ 
    cDone, 
    cReported, 
    cCrime[64], 
}; 
new CrimeInfo[MAX_PLAYERS][crInfo]; 


if(dialogid == DIALOG_RECORD) 
{ 
        if(response) 
        { 
            new ID = strval(inputtext); 
            new id[MAX_PLAYERS], h, m, s, Name[MAX_PLAYER_NAME]; 

            gettime(h,m,s); 
            RPName(playerid, Name); 
            SCM(playerid, GRAD2, "_______________| {FFFFFF}MONITOR {BFC0C2}|_______________"); 
            format(CmdString, sizeof CmdString, "    Name: %s", CrimeInfo[ID][cDone]); 
            SCM(playerid, WHITE, CmdString); 
            format(CmdString, sizeof CmdString, "    Crime: %s", CrimeInfo[ID][cCrime]); 
            SCM(playerid, WHITE, CmdString); 
            format(CmdString, sizeof CmdString, "    Reported: %s", CrimeInfo[ID][cReported]); 
            SCM(playerid, WHITE, CmdString); 
            format(CmdString, sizeof CmdString, "    Your name: %s", hIme); 
            SCM(playerid, WHITE, CmdString); 
            format(CmdString, sizeof CmdString, "________________________________|{FFFFFF}%d:%d{BFC0C2}|__", h, m); 
            SCM(playerid, WHITE, CmdString); 
        } 
}
Mine:
Код:
enum crInfo 
{ 
    cDone, 
    cReported, 
    cCrime[64], 
}; 
new CrimeInfo[MAX_PLAYERS][crInfo]; 


if(dialogid == DIALOG_RECORD) 
{ 
        if(response) 
        { 
            new pid = strval(inputtext); 
            new h, m, s, Name[MAX_PLAYER_NAME]; 

            gettime(h,m,s); 
            RPName(playerid, Name); 
            SCM(playerid, GRAD2, "_______________| {FFFFFF}MONITOR {BFC0C2}|_______________"); 
            format(CmdString, sizeof CmdString, "    Name: %s", CrimeInfo[pid][cDone]); 
            SCM(playerid, WHITE, CmdString); 
            format(CmdString, sizeof CmdString, "    Crime: %s", CrimeInfo[pid][cCrime]); 
            SCM(playerid, WHITE, CmdString); 
            format(CmdString, sizeof CmdString, "    Reported: %s", CrimeInfo[pid][cReported]); 
            SCM(playerid, WHITE, CmdString); 
            format(CmdString, sizeof CmdString, "    Your name: %s", hIme); 
            SCM(playerid, WHITE, CmdString); 
            format(CmdString, sizeof CmdString, "________________________________|{FFFFFF}%d:%d{BFC0C2}|__", h, m); 
            SCM(playerid, WHITE, CmdString); 
        } 
}
See the difference? You define 2 times ( one time an integer & one time a string ) the same variable in IceBilizard's.

Did you test mine at least?
Reply
#10

Код:
if(dialogid == DIALOG_RECORD)
    {
        if(response)
        {
            new id, h, m, s, Name[MAX_PLAYER_NAME];
 
            gettime(h,m,s);
			RPName(playerid, Name);
			SCM(playerid, GRAD2, "_______________| {FFFFFF}MONITOR {BFC0C2}|_______________");
			format(CmdString, sizeof CmdString, "	Name: %s", CrimeInfo[id][cDone]);
			SCM(playerid, WHITE, CmdString);
			format(CmdString, sizeof CmdString, "	Crime: %s", CrimeInfo[id][cCrime]);
			SCM(playerid, WHITE, CmdString);
			format(CmdString, sizeof CmdString, "	Reported: %s", CrimeInfo[id][cReported]);
			SCM(playerid, WHITE, CmdString);
			format(CmdString, sizeof CmdString, "	Your name: %s", hIme);
			SCM(playerid, WHITE, CmdString);
			format(CmdString, sizeof CmdString, "________________________________|{FFFFFF}%d:%d{BFC0C2}|__", h, m);
			SCM(playerid, WHITE, CmdString);
        }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)