help meh, -
ttimpz0r - 09.11.2011
Hey, I can't use any dialogs on my server. They open but if i click on some thing then i doesn't work..
Only neons work. I added weapon shop, i can see list of weapons but if i click on some weapon then it just closes the dialog.. sorry for my bad english
Re: help meh, -
SmiT - 09.11.2011
Did you
return false; at OnDialogResponse callback?
Re: help meh, -
ttimpz0r - 09.11.2011
yes, still doesn't work.. And why my server ping is about 200? Do i need to update smth?
Re : help meh, -
Naruto_Emilio - 09.11.2011
I think your using the same id for each Dialog, try to change all dialogs id's and look if it will work again.
Re: help meh, -
ttimpz0r - 09.11.2011
how do i change?
Re: help meh, -
Kostas' - 09.11.2011
pawn Код:
CMD:antifall(playerid, params[])
{
ShowPlayerDialog(playerid, 1/*The dialogs id is 1 here*/, DIALOG_STYLE_LIST, "{FFFFFF}Anti-Fall", "{00FF00}Enable\n{FF0000}Disable", "Select", "Cancel");
return 1;
}
CMD:rules(playerid, params[])
{
ShowPlayerDialog(playerid,3/*The dialogs id is 3 here*/ ,DIALOG_STYLE_MSGBOX,"{FFFFFF}Rules","","Accept","Don't accept");
return 1;
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1) {// dialog id = 1
if(response) {
if(listitem == 0) {
Act[playerid] = 1;
SendClientMessage(playerid, COLOR_ORANGE, "{FFFFFF}Anti-Fall Is Now {00FF00}ON{FFFFFF}!");
}
if(listitem == 1) {
Act[playerid] = 0;
SendClientMessage(playerid, COLOR_ORANGE, "{FFFFFF}Anti-Fall Is Now {FF0000}OFF{FFFFFF}!");
}
}
}
if(dialogid == 3) {// dialog id = 3 Note: Don't use the same
if(response) {
SendClientMessage(playerid,COLOR_GREEN,"You accepted our rules!");
}
else if(response == 0) {
SendClientMessage(playerid,COLOR_RED,"Therefore leave!");
Kick(playerid);
}
}
//More
Re: help meh, -
ttimpz0r - 09.11.2011
I have different dialog id's.
weaponshop dialog id is 9954 and neon dialogid is 1337
Re: help meh, -
Kostas' - 09.11.2011
If you are using it at your Gamemode, it must return 1;
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid) // Lookup the dialogid
{
case 1:
{
if(!response)
{
SendClientMessage(playerid, 0xFF0000FF, "You cancelled.");
return 1; // We processed it
}
switch(listitem) // This is far more efficient than using an if-elseif-else structure
{
case 0: // Listitems start with 0, not 1
{
// What should happen when they click on the first item?
}
case 1:
{
// And the second item?
}
case 2:
{
// We can keep going on here ;)
}
// Add the rest of your listitems for dialog 1 here
}
}
// Add the rest of your dialogs here
}
return 1;
}
If else in a Filterscript return 0;
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid) // Lookup the dialogid
{
case 1:
{
if(!response)
{
SendClientMessage(playerid, 0xFF0000FF, "You cancelled.");
return 1; // We processed it
}
switch(listitem) // This is far more efficient than using an if-elseif-else structure
{
case 0: // Listitems start with 0, not 1
{
// What should happen when they click on the first item?
}
case 1:
{
// And the second item?
}
case 2:
{
// We can keep going on here ;)
}
// 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.).
}
Re: help meh, -
-CaRRoT - 09.11.2011
Show Some of the Code of the Dialogs Mabye.. ?
Re: help meh, -
ttimpz0r - 09.11.2011
Код:
/*
||||||||||||||||||||||||||||||||||||||||
||Neon System By AlexzzPro ||
||Please keep the credits to me ||
||Do not re-relase without permisssion||
||Enjoy! ||
||||||||||||||||||||||||||||||||||||||||
*/
#define FILTERSCRIPT
#define COLOR_WHITE 0xFFFFFFAA
#include <a_samp>
#define NEON 1337 // Dialogid
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Neon System ");
print("--------------------------------------\n");
return 1;
}
#endif
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/neon", cmdtext, true, 10) == 0)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
{
SendClientMessage(playerid, COLOR_WHITE, " You are not the driver");
return 1;
}
ShowPlayerDialog(playerid, NEON, DIALOG_STYLE_LIST, "Choose your neon colour","Blue\nGreen\nYellow\nWhite\nPink\nTurn off Neon","Add","Close");
}
else
{
SendClientMessage(playerid, COLOR_WHITE, " You are not in a vehicle");
}
return 1;
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == NEON)
{
if(response)
{
if(listitem == 0)
{
SetPVarInt(playerid, "neon", 1);
SetPVarInt(playerid, "blue", CreateObject(18648,0,0,0,0,0,0));
SetPVarInt(playerid, "blue1", CreateObject(18648,0,0,0,0,0,0));
AttachObjectToVehicle(GetPVarInt(playerid, "blue"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
AttachObjectToVehicle(GetPVarInt(playerid, "blue1"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
GameTextForPlayer(playerid, "~b~ Blue ~w~Neon has been added to your vehicle",3500,5);
}
if(listitem == 1)
{
SetPVarInt(playerid, "neon", 1);
SetPVarInt(playerid, "green", CreateObject(18649,0,0,0,0,0,0));
SetPVarInt(playerid, "green1", CreateObject(18649,0,0,0,0,0,0));
AttachObjectToVehicle(GetPVarInt(playerid, "green"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
AttachObjectToVehicle(GetPVarInt(playerid, "green1"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
GameTextForPlayer(playerid, "~g~Green ~w~Neon has been added to your vehicle",3500,5);
}
if(listitem == 2)
{
SetPVarInt(playerid, "neon", 1);
SetPVarInt(playerid, "yellow", CreateObject(18650,0,0,0,0,0,0));
SetPVarInt(playerid, "yellow1", CreateObject(18650,0,0,0,0,0,0));
AttachObjectToVehicle(GetPVarInt(playerid, "yellow"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
AttachObjectToVehicle(GetPVarInt(playerid, "yellow1"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
GameTextForPlayer(playerid, "~y~Yellow~w~ Neon has been added to your vehicle",3500,5);
}
if(listitem == 3)
{
SetPVarInt(playerid, "neon", 1);
SetPVarInt(playerid, "white", CreateObject(18652,0,0,0,0,0,0));
SetPVarInt(playerid, "white1", CreateObject(18652,0,0,0,0,0,0));
AttachObjectToVehicle(GetPVarInt(playerid, "white"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
AttachObjectToVehicle(GetPVarInt(playerid, "white1"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
GameTextForPlayer(playerid, "~w~White~w~ Neon has been added to your vehicle",3500,5);
}
if(listitem == 4)
{
SetPVarInt(playerid, "neon", 1);
SetPVarInt(playerid, "pink", CreateObject(18651,0,0,0,0,0,0));
SetPVarInt(playerid, "pink1", CreateObject(18651,0,0,0,0,0,0));
AttachObjectToVehicle(GetPVarInt(playerid, "pink"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
AttachObjectToVehicle(GetPVarInt(playerid, "pink1"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
GameTextForPlayer(playerid, "~p~Pink~w~ Neon has been added to your vehicle",3500,5);
}
if(listitem == 5)
{
DestroyObject(GetPVarInt(playerid, "blue"));
DeletePVar(playerid, "neon");
DestroyObject(GetPVarInt(playerid, "blue1"));
DeletePVar(playerid, "neon");
DestroyObject(GetPVarInt(playerid, "green"));
DeletePVar(playerid, "neon");
DestroyObject(GetPVarInt(playerid, "green1"));
DeletePVar(playerid, "neon");
DestroyObject(GetPVarInt(playerid, "yellow"));
DeletePVar(playerid, "neon");
DestroyObject(GetPVarInt(playerid, "yellow1"));
DeletePVar(playerid, "neon");
DestroyObject(GetPVarInt(playerid, "white"));
DeletePVar(playerid, "neon");
DestroyObject(GetPVarInt(playerid, "white1"));
DeletePVar(playerid, "neon");
DestroyObject(GetPVarInt(playerid, "pink"));
DeletePVar(playerid, "neon");
DestroyObject(GetPVarInt(playerid, "pink1"));
DeletePVar(playerid, "neon");
GameTextForPlayer(playerid, "~g~Neon was deleted from your vehicle",3500,5);
}
}
}
return 1;
}
Код:
/**************************************************************
* WeaponShop FS v.1.0 *
* ^^ *
* (o )o) (o )o) *
* <-- | --> .: By Gertin :. <-- | --> *
* / \ / \ *
***************************************************************/
//================================INCLUDES======================================
#include <a_samp>
#include <streamer>
#include <zcmd>
#include <dudb>
//================================DEFINES=======================================
#define RED 0xFF0000AA
#pragma unused ret_memcpy
//================================NEWS==========================================
new Weaps;
new bool:Shop;
//================================COMMANDS======================================
COMMAND:shop(playerid,params[])
{
if(Shop == true)
{
SendClientMessage(playerid,RED,"{33FF00}You've opened the shop.");
ShowDialog(playerid, 9954);
return 1;
}
if(Shop == false)
{
SendClientMessage(playerid,RED,"{33FF00}Shop is closed .");
return 1;
}
return 0;
}
//==============================================================================
COMMAND:ashop(playerid, params[])
{
if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid,RED,"{FF0000}You need to be rcon admin !");
ShowDialog(playerid, 9963);
return 1;
}
//==============================PUBLICS=========================================
public OnFilterScriptInit()
{
Shop = true;
printf("===================================================");
printf("Oh , you loaded me . I'm WeaponShop FilterScript ^^");
printf("I'm Maked By Gertin !");
printf("===================================================");
return 1;
}
//==============================================================================
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response)
{
if(dialogid == 9954)
{
if(listitem == 0)
{
new string[256];
format(string, sizeof(string), "~w~Thanks ~b~For ~p~Using Shop ^^");
GameTextForPlayer(playerid, string, 7500, 3);
}
if(listitem == 1)
{
ShowDialog(playerid,9955);
}
if(listitem == 2)
{
ShowDialog(playerid,9956);
}
if(listitem == 3)
{
ShowDialog(playerid,9957);
}
if(listitem == 4)
{
ShowDialog(playerid,9958);
}
if(listitem == 5)
{
ShowDialog(playerid,9959);
}
if(listitem == 6)
{
ShowDialog(playerid,9960);
}
if(listitem == 7)
{
ShowDialog(playerid,9961);
}
if(listitem == 8)
{
ShowDialog(playerid,9962);
}
}
}
if(dialogid == 9963)
{
new string[256];
new ime[MAX_PLAYER_NAME];
GetPlayerName(playerid, ime, sizeof(ime));
if(response)
{
format(string, sizeof(string), "~r~[]Shop]~b~ is turned on by an admin:~y~ %s", ime);
GameTextForAll(string,5000,3);
Shop = true;
}
if(!response)
{
format(string, sizeof(string), "~r~[]Shop]~b~ is turned off by an admin:~y~ %s", ime);
GameTextForAll(string,5000,3);
Shop = false;
}
}
if(response)
{
if(dialogid == 9955)
{
Weaps = strval(inputtext);
if(Weaps > 250) return SendClientMessage(playerid, 0x0000D9AA, "{FF0000}Max Ammo is 250 .");
if(!isNumeric(inputtext)) return SendClientMessage(playerid, 0x0000D9AA, "Only numbers");
if(GetPlayerMoney(playerid) <= Weaps*50) return SendClientMessage(playerid,RED,"You donґt have so much money!");
GivePlayerMoney(playerid, -Weaps*50);
GivePlayerWeapon(playerid, 34, Weaps);
SendClientMessage(playerid, RED, "{33FF00}Thanks to use shop !{FF9900} You have buy Sniper Rifle !");
}
}
if(response)
{
if(dialogid == 9956)
{
Weaps = strval(inputtext);
if(Weaps > 250) return SendClientMessage(playerid, 0x0000D9AA, "{FF0000}Max Ammo is 250 .");
if(!isNumeric(inputtext)) return SendClientMessage(playerid, 0x0000D9AA, "Only numbers");
if(GetPlayerMoney(playerid) <= Weaps*10000) return SendClientMessage(playerid,RED,"You donґt have so much money!");
GivePlayerMoney(playerid, -Weaps*10000);
GivePlayerWeapon(playerid, 35, Weaps);
SendClientMessage(playerid, RED, "{33FF00}Thanks to use shop !{FF9900} You have buy Rocket Launcher !");
}
}
if(response)
{
if(dialogid == 9957)
{
Weaps = strval(inputtext);
if(Weaps > 250) return SendClientMessage(playerid, 0x0000D9AA, "{FF0000}Max Ammo is 250 .");
if(!isNumeric(inputtext)) return SendClientMessage(playerid, 0x0000D9AA, "Only numbers");
if(GetPlayerMoney(playerid) <= Weaps*100) return SendClientMessage(playerid,RED,"You donґt have so much money!");
GivePlayerMoney(playerid, -Weaps*100);
GivePlayerWeapon(playerid, 18, Weaps);
SendClientMessage(playerid, RED, "{33FF00}Thanks to use shop !{FF9900} You have buy Molotov Cocktail !");
}
}
if(response)
{
if(dialogid == 9958)
{
Weaps = strval(inputtext);
if(Weaps > 250) return SendClientMessage(playerid, 0x0000D9AA, "{FF0000}Max Ammo is 250 .");
if(!isNumeric(inputtext)) return SendClientMessage(playerid, 0x0000D9AA, "Only numbers");
if(GetPlayerMoney(playerid) <= Weaps*50) return SendClientMessage(playerid,RED,"You donґt have so much money!");
GivePlayerMoney(playerid, -Weaps*50);
GivePlayerWeapon(playerid, 27, Weaps);
SendClientMessage(playerid, RED, "{33FF00}Thanks to use shop !{FF9900} You have buy Combat Shotgun !");
}
}
if(response)
{
if(dialogid == 9959)
{
Weaps = strval(inputtext);
if(Weaps > 250) return SendClientMessage(playerid, 0x0000D9AA, "{FF0000}Max Ammo is 250 .");
if(!isNumeric(inputtext)) return SendClientMessage(playerid, 0x0000D9AA, "Only numbers");
if(GetPlayerMoney(playerid) <= Weaps*50) return SendClientMessage(playerid,RED,"You donґt have so much money!");
GivePlayerMoney(playerid, -Weaps*50);
GivePlayerWeapon(playerid, 26, Weaps);
SendClientMessage(playerid, RED, "{33FF00}Thanks to use shop !{FF9900} You have buy Sawn-Off Shotgun !");
}
}
if(response)
{
if(dialogid == 9960)
{
Weaps = strval(inputtext);
if(Weaps > 250) return SendClientMessage(playerid, 0x0000D9AA, "{FF0000}Max Ammo is 250 .");
if(!isNumeric(inputtext)) return SendClientMessage(playerid, 0x0000D9AA, "Only numbers");
if(GetPlayerMoney(playerid) <= Weaps*30) return SendClientMessage(playerid,RED,"You donґt have so much money!");
GivePlayerMoney(playerid, - Weaps*30);
GivePlayerWeapon(playerid, 24, Weaps);
SendClientMessage(playerid, RED, "{33FF00}Thanks to use shop !{FF9900} You have buy Desert Eagle !");
}
}
if(response)
{
if(dialogid == 9961)
{
Weaps = strval(inputtext);
if(Weaps > 250) return SendClientMessage(playerid, 0x0000D9AA, "{FF0000}Max Ammo is 250 .");
if(!isNumeric(inputtext)) return SendClientMessage(playerid, 0x0000D9AA, "Only numbers");
if(GetPlayerMoney(playerid) <= Weaps*300) return SendClientMessage(playerid,RED,"You donґt have so much money!");
GivePlayerMoney(playerid, -Weaps*300);
GivePlayerWeapon(playerid, 16, Weaps);
SendClientMessage(playerid, RED, "{33FF00}Thanks to use shop !{FF9900} You have buy Grenade !");
}
return 0;
}
if(response)
{
if(dialogid == 9962)
{
Weaps = strval(inputtext);
if(Weaps > 250) return SendClientMessage(playerid, 0x0000D9AA, "{FF0000}Max Ammo is 250 .");
if(!isNumeric(inputtext)) return SendClientMessage(playerid, 0x0000D9AA, "Only numbers");
if(GetPlayerMoney(playerid) <= Weaps*10) return SendClientMessage(playerid,RED,"You donґt have so much money!");
GivePlayerMoney(playerid, -Weaps*10);
GivePlayerWeapon(playerid, 29, Weaps);
SendClientMessage(playerid, RED, "{33FF00}Thanks to use shop !{FF9900} You have buy MP5 !");
}
}
return false;
}
//================================STOCKS========================================
stock IsNumeric(string[])
{
for (new i = 0, j = strlen(string);
i < j; i++)
{
if (string[i] > '9' || string[i] < '0')
return 0;
}
return 1;
}
//==============================================================================
stock ShowDialog(playerid, dialog)
{
switch(dialog)
{
case 9954: ShowPlayerDialog(playerid, dialog, DIALOG_STYLE_LIST,"{003399}S{00FF66}hop", "{6600CC}|<-------Weapons------>|\nSniper Rifle [Ammo Price: 50$ ]\nRocket Launcher [Ammo Price: 10.000$ ]\nMolotiv Coctails [Ammo Price: 100$ ]\nCombat Shotgun [Ammo Price: 50$ ]\nShawn-Off Shotgun [Ammo Price: 50$ ]\nDesert Eagle [Ammo Price: 30$ ]\nGranade [Ammo Price: 300$ ]\nMP5 [Ammo Price: 10$ ]","Next", "Cancel");
case 9955: ShowPlayerDialog(playerid, dialog, DIALOG_STYLE_INPUT,"{003399}Sniper Rifle","{00FF66}Type the ammo, what you want for sniper .\n 1 Ammo Price is 50$","Buy","Cancel");
case 9956: ShowPlayerDialog(playerid, dialog, DIALOG_STYLE_INPUT,"{003399}Rocket Launcher","{00FF66}Type the ammo, what you want for rocket launcher .\n 1 Ammo Price is 2000$","Buy","Cancel");
case 9957: ShowPlayerDialog(playerid, dialog, DIALOG_STYLE_INPUT,"{003399}Molotiv Coctails","{00FF66}Type the ammo, what you want for coctails .\n 1 Ammo Price is 100$","Buy","Cancel");
case 9958: ShowPlayerDialog(playerid, dialog, DIALOG_STYLE_INPUT,"{003399}Combat ShotGun","{00FF66}Type the ammo, what you want for shotgun .\n 1 Ammo Price is 50$","Buy","Cancel");
case 9959: ShowPlayerDialog(playerid, dialog, DIALOG_STYLE_INPUT,"{003399}Shawn-Off ShotGun","{00FF66}Type the ammo, what you want for shawn-off .\n 1 Ammo Price is 50$","Buy","Cancel");
case 9960: ShowPlayerDialog(playerid, dialog, DIALOG_STYLE_INPUT,"{003399}Desert Eagle","{00FF66}Type the ammo, what you want for eagle .\n 1 Ammo Price is 30$","Buy","Cancel");
case 9961: ShowPlayerDialog(playerid, dialog, DIALOG_STYLE_INPUT,"{003399}Granades","{00FF66}Type the ammo, what you want for granades .\n 1 Ammo Price is 300$","Buy","Cancel");
case 9962: ShowPlayerDialog(playerid, dialog, DIALOG_STYLE_INPUT,"{003399}MP5","{00FF66}Type the ammo, what you want for MP5 .\n 1 Ammo Price is 10$","Buy","Cancel");
case 9963: ShowPlayerDialog(playerid, dialog, DIALOG_STYLE_MSGBOX, "{FF0000}Shop !","{FF6600}You wan't to {6600CC}open{33CC00}/{00FFFF}close{FF6600} shop ?","Open","Close");
}
return 0;
}
//====================[ BEST PART OF THAT FILTERSCRIPT ]========================
//========================[ THEY CALLED IT THE END ! ]==========================