Nooo I'm pretty sure im missing something, HELP! -
Lorenc_ - 20.06.2010
ok i've make my dialog... its a simple objective input text one but it dosent appear or work for some reason heres the whole code...
Код:
dcmd_order(playerid, params[])
{
#pragma unused params
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_INPUT, "ORDER", "Type your objective for the --------------.", "Submit", "Cancel");
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 0 && response)
{
switch(listitem)
{
case 0:
{
for(new i=0; i<MAX_PLAYERS; i++)
{
new string [256];
format(string, sizeof(string), "OBJECTIVE: %s", inputtext);
ShowBriefMessageForPlayer(i, string, 5000); // its just a basic textdraw at the bottom of the screen shown for all!
}
}
}
}
return 1;
}
Please help me if i missed something.. I just came back to samp because of a little holiday..
Re: Nooo I'm pretty sure im missing something, HELP! -
DJDhan - 20.06.2010
Код:
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_INPUT, "ORDER", "Type your objective for the --------------.", "Submit", "Cancel");
AND
are not matching are they?
You are showing a Input Dialog and switching ListItems?
I am not having much experience with dialogs but this might work:
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 0 && response)
{
if(!strlen(inputtext)
{
SendClientMessage(playerid,0xffffffaa,"You have left the space blank.");
return ShowPlayerDialog(playerid, 0, DIALOG_STYLE_INPUT, "ORDER", "Type your objective for the --------------.", "Submit", "Cancel");
}
for(new i=0; i<MAX_PLAYERS; i++)
{
new string [128];
format(string, sizeof(string), "OBJECTIVE: %s", inputtext);
ShowBriefMessageForPlayer(i, string, 5000); // its just a basic textdraw at the bottom of the screen shown for all!
}
}
return 1;
}
Re: Nooo I'm pretty sure im missing something, HELP! -
ToPhrESH - 20.06.2010
I cant help u with this. Ive never really used pragma...
but wb and happy holydays
Re: Nooo I'm pretty sure im missing something, HELP! -
Joe_ - 20.06.2010
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 0 && response)
{
if(inputtext[0] != '\0')
{
for(new i = 0, b = GetMaxPlayers(); i < b; i++)
{
new string[128];
format(string, sizeof(string), "OBJECTIVE: %s", inputtext);
ShowBriefMessageForPlayer(i, string, 5000); // its just a basic textdraw at the bottom of the screen shown for all!
}
return 1;
}
SendClientMessage(playerid, YOUR_COLOR, "Please enter an objective into the box.");
}
return 1;
}
Much better code, really don't know why people use strlen, MAX_PLAYERS and 256 cells -.- *Looks at DJDHAN*
Anyway, that should work.
Checked first char of inputtext to check if it's null, not the whole string.
GetMaxPlayers loop, Efficient, but a bit slower, due to MAX_PLAYERS being a constant, and GetMaxPlayers being a function-
Although I only called the function once and stored the result into the varible 'b'.
Changed 'string' lenght to 128 cells, the MAXIMUM text output, so 256 is a waste.
Re: Nooo I'm pretty sure im missing something, HELP! -
DJDhan - 20.06.2010
Oops, Joe is right, I forgot to edit string[256] to string[128].
My bad :P
Re: Nooo I'm pretty sure im missing something, HELP! -
Lorenc_ - 20.06.2010
Quote:
Originally Posted by DJDhan
switch(listitem)
are not matching are they?
You are showing a Input Dialog and switching ListItems?
I am not having much experience with dialogs but this might work:
|
Shit I forgot about that LMAO I was about to remove it yesterday but i forgot to! Thanks for Noticing and thanks Everyone for Support.