How to create new dialog response? -
Kukkurloom - 01.05.2012
If I have 1 dialog response in :
public OnDialogResponse ( playerid, dialogid, response, listitem, inputtext [] )
[My DialogResponse]
What I need to write to the end of my 1 dialog response, to create new one?
Re: How to create new dialog response? -
TzAkS. - 01.05.2012
Do you mean to add a new dialog?
Like this?
Код:
if(dialogid == 1)
{
if(response)
{
// something here
}
}
if(dialogid == 2)//another dialog
{
if(response)
{
// something here
}
}
Re: How to create new dialog response? -
Kukkurloom - 01.05.2012
It didn't worked...
Re: How to create new dialog response? -
Carbonite - 01.05.2012
No he means you add
Код:
if(dialogid == 1)
{
if(response)
{
// something here
}
}
if(dialogid == 2)//another dialog
{
if(response)
{
// something here
}
}
under the OnDialogResponse callback.
Re: How to create new dialog response? -
Kukkurloom - 01.05.2012
PHP код:
public OnDialogResponse ( playerid, dialogid, response, listitem, inputtext [] )
{
switch ( dialogid )
{
case 1:
{
if(!response)
{
SendClientMessage(playerid, 0xFF0000FF, "Sa ei ostnud midagi.");
return 1; // ...
}
switch(listitem)
{
case 0: // Items
{
if(GetPlayerMoney(playerid) < 10) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-10);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 paki Tere piima, mis maksis 10 LSUD'd. ");
}
case 1:
{
if(GetPlayerMoney(playerid) < 5) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-5);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 paki Sддstu makarone, mis maksis 5 LSUD'd. ");
}
case 2:
{
if(GetPlayerMoney(playerid) < 25) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-25);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 kьlmutatud Maamehe pizza, mis maksis 25 LSUD'd. ");
}
case 3:
{
if(GetPlayerMoney(playerid) < 33) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-33);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 paki Vinku viinereid, mis maksis 33 LSUD'd. ");
}
case 4:
{
if(GetPlayerMoney(playerid) < 22) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-22);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 kilo Los Santose хuna, mis maksis 22 LSUD'd. ");
}
case 5:
{
if(GetPlayerMoney(playerid) < 6) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-6);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 kilo Maamehe kartulit, mis maksis 6 LSUD'd. ");
}
case 6:
{
if(GetPlayerMoney(playerid) < 21) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-21);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 paki komme nimega Pilveke, mis maksis 21 LSUD'd. ");
}
case 7:
{
if(GetPlayerMoney(playerid) < 12) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-12);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 Lays krхpse, mis maksis 12 LSUD'd. ");
SendClientMessage(playerid,0xAA3333AA, " Krхpsud on vдga kahjulikud sinu tervisele! ");
}
case 8:
{
if(GetPlayerMoney(playerid) < 42) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-42);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 paki Maamehe kotlete, mis maksis 42 LSUD'd. ");
}
// Add the rest of your listitems for dialog 1 here
}
}
// Add the rest of your dialogs here
}
return 0; // If you put return 1 here the callback will not continue to be called in other scripts (filterscripts, etc.).
}
Where and what do I need to add? I'm very noob scripter Do create new dialog...
Re: How to create new dialog response? -
FL1K3R - 01.05.2012
Look at this code, please
pawn Код:
public OnDialogResponse ( playerid, dialogid, response, listitem, inputtext [] )
{
switch ( dialogid )
{
case 1:
{
if(!response)
{
SendClientMessage(playerid, 0xFF0000FF, "Sa ei ostnud midagi.");
return 1; // ...
}
switch(listitem)
{
case 0: // Items
{
if(GetPlayerMoney(playerid) < 10) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-10);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 paki Tere piima, mis maksis 10 LSUD'd. ");
}
case 1:
{
if(GetPlayerMoney(playerid) < 5) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-5);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 paki Sддstu makarone, mis maksis 5 LSUD'd. ");
}
case 2:
{
if(GetPlayerMoney(playerid) < 25) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-25);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 kьlmutatud Maamehe pizza, mis maksis 25 LSUD'd. ");
}
case 3:
{
if(GetPlayerMoney(playerid) < 33) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-33);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 paki Vinku viinereid, mis maksis 33 LSUD'd. ");
}
case 4:
{
if(GetPlayerMoney(playerid) < 22) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-22);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 kilo Los Santose хuna, mis maksis 22 LSUD'd. ");
}
case 5:
{
if(GetPlayerMoney(playerid) < 6) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-6);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 kilo Maamehe kartulit, mis maksis 6 LSUD'd. ");
}
case 6:
{
if(GetPlayerMoney(playerid) < 21) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-21);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 paki komme nimega Pilveke, mis maksis 21 LSUD'd. ");
}
case 7:
{
if(GetPlayerMoney(playerid) < 12) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-12);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 Lays krхpse, mis maksis 12 LSUD'd. ");
SendClientMessage(playerid,0xAA3333AA, " Krхpsud on vдga kahjulikud sinu tervisele! ");
}
case 8:
{
if(GetPlayerMoney(playerid) < 42) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-42);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 paki Maamehe kotlete, mis maksis 42 LSUD'd. ");
}
// Add the rest of your listitems for dialog 1 here
}
}
// ADD HERE THE NEW DIALOG
/*case 2:
case 3:
etc...*/
}
return 0; // If you put return 1 here the callback will not continue to be called in other scripts (filterscripts, etc.).
}
Re: How to create new dialog response? -
Kukkurloom - 01.05.2012
error 014: invalid statement; not in switch
warning 215: expression has no effect
error 001: expected token: ";", but found ":"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
PHP код:
public OnDialogResponse ( playerid, dialogid, response, listitem, inputtext [] )
{
switch ( dialogid )
{
case 1:
{
if(!response)
{
SendClientMessage(playerid, 0xFF0000FF, "Sa ei ostnud midagi.");
return 1; // ...
}
switch(listitem)
{
case 0: // Items
{
if(GetPlayerMoney(playerid) < 10) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-10);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 paki Tere piima, mis maksis 10 LSUD'd. ");
}
case 1:
{
if(GetPlayerMoney(playerid) < 5) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-5);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 paki Sддstu makarone, mis maksis 5 LSUD'd. ");
}
case 2:
{
if(GetPlayerMoney(playerid) < 25) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-25);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 kьlmutatud Maamehe pizza, mis maksis 25 LSUD'd. ");
}
case 3:
{
if(GetPlayerMoney(playerid) < 33) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-33);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 paki Vinku viinereid, mis maksis 33 LSUD'd. ");
}
case 4:
{
if(GetPlayerMoney(playerid) < 22) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-22);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 kilo Los Santose хuna, mis maksis 22 LSUD'd. ");
}
case 5:
{
if(GetPlayerMoney(playerid) < 6) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-6);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 kilo Maamehe kartulit, mis maksis 6 LSUD'd. ");
}
case 6:
{
if(GetPlayerMoney(playerid) < 21) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-21);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 paki komme nimega Pilveke, mis maksis 21 LSUD'd. ");
}
case 7:
{
if(GetPlayerMoney(playerid) < 12) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-12);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 Lays krхpse, mis maksis 12 LSUD'd. ");
SendClientMessage(playerid,0xAA3333AA, " Krхpsud on vдga kahjulikud sinu tervisele! ");
}
case 8:
{
if(GetPlayerMoney(playerid) < 42) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-42);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 paki Maamehe kotlete, mis maksis 42 LSUD'd. ");
}
// Add the rest of your listitems for dialog 1 here
}
case 2:
{
if(!response)
{
SendClientMessage(playerid, 0xFF0000FF, "Sa ei ostnud midagi.");
return 1; // ...
}
switch(listitem)
{
case 0: // Items
{
if(GetPlayerMoney(playerid) < 80) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-10);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 Neoon joogi, mis maksis sulle 80 LSUD. ");
}
case 1:
{
if(GetPlayerMoney(playerid) < 5) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-5);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 paki Sддstu makarone, mis maksis 5 LSUD'd. ");
}
case 2:
{
if(GetPlayerMoney(playerid) < 25) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-25);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 kьlmutatud Maamehe pizza, mis maksis 25 LSUD'd. ");
}
case 3:
{
if(GetPlayerMoney(playerid) < 33) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-33);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 paki Vinku viinereid, mis maksis 33 LSUD'd. ");
}
case 4:
{
if(GetPlayerMoney(playerid) < 22) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-22);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 kilo Los Santose хuna, mis maksis 22 LSUD'd. ");
}
case 5:
{
if(GetPlayerMoney(playerid) < 6) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-6);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 kilo Maamehe kartulit, mis maksis 6 LSUD'd. ");
}
case 6:
{
if(GetPlayerMoney(playerid) < 21) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-21);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 paki komme nimega Pilveke, mis maksis 21 LSUD'd. ");
}
case 7:
{
if(GetPlayerMoney(playerid) < 12) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-12);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 Lays krхpse, mis maksis 12 LSUD'd. ");
SendClientMessage(playerid,0xAA3333AA, " Krхpsud on vдga kahjulikud sinu tervisele! ");
}
case 8:
{
if(GetPlayerMoney(playerid) < 42) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-42);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 paki Maamehe kotlete, mis maksis 42 LSUD'd. ");
}
}
}
return 0; // If you put return 1 here the callback will not continue to be called in other scripts (filterscripts, etc.).
}
Re: How to create new dialog response? -
Kukkurloom - 02.05.2012
Can somebody please help??
Re: How to create new dialog response? -
MadeMan - 02.05.2012
pawn Код:
public OnDialogResponse ( playerid, dialogid, response, listitem, inputtext [] )
{
switch ( dialogid )
{
case 1:
{
if(!response)
{
SendClientMessage(playerid, 0xFF0000FF, "Sa ei ostnud midagi.");
return 1; // ...
}
switch(listitem)
{
case 0: // Items
{
if(GetPlayerMoney(playerid) < 10) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-10);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 paki Tere piima, mis maksis 10 LSUD'd. ");
}
case 1:
{
if(GetPlayerMoney(playerid) < 5) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-5);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 paki Sддstu makarone, mis maksis 5 LSUD'd. ");
}
// Add the rest of your listitems for dialog 1 here
}
}
case 2:
{
if(!response)
{
SendClientMessage(playerid, 0xFF0000FF, "Sa ei ostnud midagi.");
return 1; // ...
}
switch(listitem)
{
case 0: // Items
{
if(GetPlayerMoney(playerid) < 10) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-10);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 paki Tere piima, mis maksis 10 LSUD'd. ");
}
case 1:
{
if(GetPlayerMoney(playerid) < 5) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-5);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 paki Sддstu makarone, mis maksis 5 LSUD'd. ");
}
// Add the rest of your listitems for dialog 2 here
}
}
// Add the rest of your dialogs here
}
return 0; // If you put return 1 here the callback will not continue to be called in other scripts (filterscripts, etc.).
}
Re: How to create new dialog response? -
Kukkurloom - 02.05.2012
They are different dialogs...
1 is used in Shop and the other is used in Nightclub...