15.01.2013, 14:43
hey i got 2 fs using dialogs but when using them both, one of them does not work. how do i fix this?
codes:
fs 1: (vehicle spawning)
fs 2 (weapon shop)
codes:
fs 1: (vehicle spawning)
pawn Код:
#include <a_samp>
//#define IGNORE_WARP_INTO_VEHICLE
//#define IGNORE_VIRTUAL_WORLDS
#define IGNORE_SPAWN_MESSAGES
//#define IGNORE_VEHICLE_ACTIVATION
//#define IGNORE_VEHICLE_DELETION
#define DIA1_EMBED {AA3333}
#define DIA2_EMBED {F0F8FF}
#define DIA4_EMBED {0000BB}
#define DIA5_EMBED {FFC0CB}
#define DIA6_EMBED {FF6347}
#define DIA7_EMBED {33AA33}
#define DIA8_EMBED {000080}
#define DIA9_EMBED {808000}
#define DIA10_EMBED {AA3333}
#define DIA11_EMBED {A52A2A}
#define DIA12_EMBED {B8860B}
#define DEFAULT_RESPAWN_TIME 60 /* ten minutes */
#if !defined IGNORE_VEHICLE_DELETION
new
bool:gDialogCreated[ MAX_VEHICLES ] = { false, ... };
#endif
CreatePlayerVehicle( playerid, modelid )
{
new
vehicle,
Float:x,
Float:y,
Float:z,
Float:angle;
if ( GetPlayerState( playerid ) == PLAYER_STATE_DRIVER )
{
vehicle = GetPlayerVehicleID( playerid );
GetVehiclePos( vehicle, x, y, z );
GetVehicleZAngle( vehicle, angle );
DestroyVehicle( vehicle );
}
else
{
GetPlayerPos( playerid, x, y, z );
GetPlayerFacingAngle( playerid, angle );
}
vehicle = CreateVehicle( modelid, x, y, ( z + 1 ), angle, -1, -1, DEFAULT_RESPAWN_TIME );
LinkVehicleToInterior( vehicle, GetPlayerInterior( playerid ) );
#if !defined IGNORE_VIRTUAL_WORLDS
SetVehicleVirtualWorld( vehicle, GetPlayerVirtualWorld( playerid ) );
#endif
#if !defined IGNORE_WARP_INTO_VEHICLE
PutPlayerInVehicle( playerid, vehicle, 0 );
#endif
#if !defined IGNORE_VEHICLE_DELETION
gDialogCreated[ vehicle ] = true;
#endif
return 1;
}
ShowPlayerDefaultDialog( playerid )
{
ShowPlayerDialog( playerid, 3434, DIALOG_STYLE_LIST, "{AA3333}Vehicles by InsanityStunt", "{F0F8FF}Airplanes\n{B8860B}Helicopters\n{0000BB}Bikes\n{FFC0CB}Convertibles\n{FF6347}Industrial\n{33AA33}Lowriders\n{000080}Off Road\n{808000}Public Service Vehicles\n{AA3333}Saloons\n{A52A2A}Sport Vehicles\n{B8860B}Station wagons", "Select", "Cancel" );
return 1;
}
public OnFilterScriptInit()
{
printf( " * vDialog version 0.2a loaded * " );
return 1;
}
public OnFilterScriptExit()
{
printf( " * vDialog version 0.2a unloaded * " );
return 1;
}
public OnPlayerSpawn( playerid )
{
#if !defined IGNORE_SPAWN_MESSAGES
SendClientMessage( playerid, 0xFFFFFFFF, "[vDialog]: Use the command '/vdialog' to activate the vehicle dialog" );
#endif
return 1;
}
public OnPlayerCommandText( playerid, cmdtext[] )
{
if ( strcmp( cmdtext, "/v", true, 8 ) == 0 )
{
if ( GetPlayerState( playerid ) == PLAYER_STATE_DRIVER )
{
#if !defined IGNORE_VEHICLE_ACTIVATION
ShowPlayerDefaultDialog( playerid );
return 1;
#endif
}
if ( GetPlayerState( playerid ) != PLAYER_STATE_PASSENGER ) ShowPlayerDefaultDialog( playerid );
return 1;
}
return 0;
}
public OnVehicleSpawn( vehicleid )
{
#if !defined IGNORE_VEHICLE_DELETION
if ( gDialogCreated[ vehicleid ] )
{
DestroyVehicle( vehicleid );
gDialogCreated[ vehicleid ] = false;
}
#endif
return 1;
}
public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[] )
{
if ( response )
{
switch ( dialogid )
{
case 3434 :
{
switch ( listitem )
{
case 0 : ShowPlayerDialog( playerid, 3435, DIALOG_STYLE_LIST, "{AA3333}Airplanes", "{B8860B}Andromada\n{B8860B}AT-400\n{B8860B}Beagle\n{B8860B}Cropduster\n{B8860B}Dodo\n{B8860B}Hydra\n{B8860B}Nevada\n{B8860B}Rustler\n{B8860B}Shamal\n{B8860B}Skimmer\n{B8860B}Stuntplane\nBack", "Select", "Cancel" ); // done
case 1 : ShowPlayerDialog( playerid, 3436, DIALOG_STYLE_LIST, "{AA3333}Helicopters", "{B8860B}Cargobob\n{B8860B}Hunter\n{B8860B}Leviathan\n{B8860B}Maverick\n{B8860B}News Maverick\n{B8860B}Police Maverick\n{B8860B}Raindance\n{B8860B}Seasparrow\n{B8860B}Sparrow\nBack", "Select", "Cancel" ); // done
case 2 : ShowPlayerDialog( playerid, 3437, DIALOG_STYLE_LIST, "{AA3333}Bikes", "{B8860B}BF-400\n{B8860B}Bike\nBMX\n{B8860B}Faggio\n{B8860B}FCR-900\n{B8860B}Freeway\n{B8860B}Mountain Bike\n{B8860B}NRG-500\n{B8860B}PCJ-600\n{B8860B}Pizzaboy\n{B8860B}Quad\n{B8860B}Sanchez\n{B8860B}Wayfarer\nBack", "Select", "Cancel" ); // done
case 3 : ShowPlayerDialog( playerid, 3438, DIALOG_STYLE_LIST, "{AA3333}Convertibles", "Comet\nFeltzer\nStallion\nWindsor\nBack","Select", "Cancel" );
case 4 : ShowPlayerDialog( playerid, 3439, DIALOG_STYLE_LIST, "{AA3333}Industrial", "Benson\nBobcat\nBurrito\nBoxville\nBoxburg\nCement Truck\nDFT-30\nFlatbed\nLinerunner\nMule\nNewsvan\nPacker\nPetrol Tanker\nPony\nRoadtrain\nRumpo\nSadler\nBroken Sadler\nTopfun\nTractor\nTrashmaster\nUtility Van\nWalton\nYankee\nYosemite\nBack", "Select", "Cancel" ); // done
case 5 : ShowPlayerDialog( playerid, 3440, DIALOG_STYLE_LIST, "{AA3333}Lowriders", "{B8860B}Blade\n{B8860B}Broadway\n{B8860B}Remington\n{B8860B}Savanna\n{B8860B}Slamvan\n{B8860B}Tahoma\n{B8860B}Tornado\n{B8860B}Voodoo\nBack", "Select", "Cancel" ); // done
case 6 : ShowPlayerDialog( playerid, 3441, DIALOG_STYLE_LIST, "{AA3333}Off Road", "{B8860B}Bandito\n{B8860B}BF Injection\n{B8860B}Dune\n{B8860B}Huntley\n{B8860B}Landstalker\n{B8860B}Mesa\n{B8860B}Monster\n{B8860B}Monster A\n{B8860B}Monster B\n{B8860B}Patriot\n{B8860B}Rancher A\n{B8860B}Rancher B\n{B8860B}Sandking\nBack", "Select", "Cancel" ); // done
case 7 : ShowPlayerDialog( playerid, 3442, DIALOG_STYLE_LIST, "{AA3333}Public Service Vehicles", "{B8860B}Ambulance\n{B8860B}Barracks\n{B8860B}Bus\n{B8860B}Cabbie\n{B8860B}Coach\n{B8860B}Cop Bike (HPV-1000)\n{B8860B}Enforcer\n{B8860B}FBI Rancher\n{B8860B}FBI Truck\n{B8860B}Firetruck\n{B8860B}Firetruck LA\n{B8860B}Police Car (LSPD)\n{B8860B}Police Car (LVPD)\n{B8860B}Police Car (SFPD)\n{B8860B}Ranger\n{B8860B}Rhino\n{B8860B}S.W.A.T\n{B8860B}Taxi\nBack", "Select", "Cancel" ); // done
case 8 : ShowPlayerDialog( playerid, 3443, DIALOG_STYLE_LIST, "Saloons", "Admiral\nBloodring Banger\nBravura\nBuccaneer\nCadrona\nClover\nElegant\nElegy\nEmperor\nEsperanto\nFortune\nBroken Glendale\nGlendale\nGreenwood\nHermes\nIntruder\nMajestic\nManana\nMerit\nNebula\nOceanic\nPicador\nPremier\nPrevion\nPrimo\nSentinel\nStafford\nSultan\nSunrise\nTampa\nVincent\nVirgo\nWillard\nWashington\nBack", "Select", "Cancel" );
case 9 : ShowPlayerDialog( playerid, 3444, DIALOG_STYLE_LIST, "{AA3333}Sport Vehicles", "{B8860B}Alpha\n{B8860B}Banshee\n{B8860B}Blista Compact\n{B8860B}Buffalo\n{B8860B}Bullet\n{B8860B}Cheetah\n{B8860B}Club\n{B8860B}Euros\n{B8860B}Flash\n{B8860B}Hotring Racer\n{B8860B}Hotring Racer A\n{B8860B}Hotring Racer B\n{B8860B}Infernus\n{B8860B}Jester\n{B8860B}Phoenix\n{B8860B}Sabre\n{B8860B}Super GT\n{B8860B}Turismo\n{B8860B}Uranus\n{B8860B}ZR-350\nBack", "Select", "Cancel" ); //done
case 10 : ShowPlayerDialog( playerid, 3445, DIALOG_STYLE_LIST, "{AA3333}Station Wagons", "{B8860B}Moonbeam\n{B8860B}Perenniel\n{B8860B}Regina\n{B8860B}Solair\n{B8860B}Stratum\nBack", "Select", "Cancel" ); //done
case 11 : ShowPlayerDialog( playerid, 3446, DIALOG_STYLE_LIST, "Boats", "{B8860B}Coastguard\nDinghy\nJetmax\nLaunch\nMarquis\nPredator\nReefer\nSpeeder\nSquallo\nTropic\nBack", "Select", "Cancel" ); //blocked from here
case 12 : ShowPlayerDialog( playerid, 3447, DIALOG_STYLE_LIST, "Trailers", "{B8860B}Article Trailer\nArticle Trailer 2\nArticle Trailer 3\nBaggage Trailer A\nBaggage Trailer B\nFarm Trailer\nFreight Flat Trailer (Train)\nFreight Box Trailer (Train)\nPetrol Trailer\nStreak Trailer (Train)\nStairs Trailer\nUtility Trailer\nBack", "Select", "Cancel" );
case 13 : ShowPlayerDialog( playerid, 3448, DIALOG_STYLE_LIST, "Unique Vehicles", "Baggage\nBrownstreak (Train)\nCaddy\nCamper\nCamper A\nCombine Harvester\nDozer\nDumper\nForklift\nFreight (Train)\nHotknife\nHustler\nHotdog\nKart\nMower\nMr Whoopee\nRomero\nSecuricar\nStretch\nSweeper\nTram\nTowtruck\nTug\nVortex\nBack", "Select", "Cancel" );
case 14 : ShowPlayerDialog( playerid, 3449, DIALOG_STYLE_LIST, "RC Vehicles", "RC Bandit\nRC Baron\nRC Raider\nRC Goblin\nRC Tiger\nRC Cam\nBack", "Select", "Cancel" );
}
}
case 3435 :
{
if ( listitem > 10 ) return ShowPlayerDefaultDialog( playerid );
new
model_array[] = { 592, 577, 511, 512, 593, 520, 553, 476, 519, 460, 513 };
return CreatePlayerVehicle( playerid, model_array[ listitem ] );
}
case 3436 :
{
if ( listitem > 8 ) return ShowPlayerDefaultDialog( playerid );
new
model_array[] = { 548, 425, 417, 487, 488, 497, 563, 447, 469 };
return CreatePlayerVehicle( playerid, model_array[ listitem ] );
}
case 3437 :
{
if ( listitem > 12 ) return ShowPlayerDefaultDialog( playerid );
new
model_array[] = { 581, 509, 481, 462, 521, 463, 510, 522, 461, 448, 471, 468, 586 };
return CreatePlayerVehicle( playerid, model_array[ listitem ] );
}
case 3438 :
{
if ( listitem > 3 ) return ShowPlayerDefaultDialog( playerid );
new
model_array[] = { 480, 533, 439, 555 };
return CreatePlayerVehicle( playerid, model_array[ listitem ] );
}
case 3439 :
{
if ( listitem > 24 ) return ShowPlayerDefaultDialog( playerid );
new
model_array[] = { 499, 422, 482, 498, 609, 524, 578, 455, 403, 414, 582, 443, 514, 413, 515, 440, 543, 605, 459, 531, 408, 552, 478, 456, 554 };
return CreatePlayerVehicle( playerid, model_array[ listitem ] );
}
case 3440 :
{
if ( listitem > 7 ) return ShowPlayerDefaultDialog( playerid );
new
model_array[] = { 536, 575, 534, 567, 535, 566, 576, 412 };
return CreatePlayerVehicle( playerid, model_array[ listitem ] );
}
case 3441 :
{
if ( listitem > 12 ) return ShowPlayerDefaultDialog( playerid );
new
model_array[] = { 568, 424, 573, 579, 400, 500, 444, 556, 557, 470, 489, 505, 495 };
return CreatePlayerVehicle( playerid, model_array[ listitem ] );
}
case 3442 :
{
if ( listitem > 17 ) return ShowPlayerDefaultDialog( playerid );
new
model_array[] = { 416, 433, 431, 438, 437, 523, 427, 490, 528, 407, 544, 596, 598, 597, 599, 432, 601, 420 };
return CreatePlayerVehicle( playerid, model_array[ listitem ] );
}
case 3443 :
{
if ( listitem > 33 ) return ShowPlayerDefaultDialog( playerid );
new
model_array[] = { 445, 504, 401, 518, 527, 542, 507, 562, 585, 419, 526, 604, 466, 492, 474, 546, 517, 410, 551, 516, 467, 600, 426, 436, 547, 405, 580, 560, 550, 549, 540, 491, 529, 421 };
return CreatePlayerVehicle( playerid, model_array[ listitem ] );
}
case 3444 :
{
if ( listitem > 19 ) return ShowPlayerDefaultDialog( playerid );
new
model_array[] = { 602, 429, 496, 402, 541, 415, 589, 587, 565, 494, 502, 503, 411, 559, 603, 475, 506, 451, 558, 477 };
return CreatePlayerVehicle( playerid, model_array[ listitem ] );
}
case 3445 :
{
if ( listitem > 4 ) return ShowPlayerDefaultDialog( playerid );
new
model_array[] = { 418, 404, 479, 458, 561 };
return CreatePlayerVehicle( playerid, model_array[ listitem ] );
}
case 3446 :
{
if ( listitem > 9 ) return ShowPlayerDefaultDialog( playerid );
new
model_array[] = { 472, 473, 493, 595, 484, 430, 453, 452, 446, 454 };
return CreatePlayerVehicle( playerid, model_array[ listitem ] );
}
case 3447 :
{
if ( listitem > 11 ) return ShowPlayerDefaultDialog( playerid );
new
model_array[] = { 435, 450, 591, 606, 607, 610, 569, 590, 584, 570, 608, 611 };
return CreatePlayerVehicle( playerid, model_array[ listitem ] );
}
case 3448 :
{
if ( listitem > 23 ) return ShowPlayerDefaultDialog( playerid );
new
model_array[] = { 485, 537, 457, 483, 508, 532, 486, 406, 530, 538, 434, 545, 588, 571, 572, 423, 442, 428, 409, 574, 449, 525, 583, 539 };
return CreatePlayerVehicle( playerid, model_array[ listitem ] );
}
case 3449 :
{
if ( listitem > 5 ) return ShowPlayerDefaultDialog( playerid );
new
model_array[] = { 441, 464, 465, 501, 564, 594 };
return CreatePlayerVehicle( playerid, model_array[ listitem ] );
}
}
}
return 0;
}
pawn Код:
//Weapon Shop
#include <a_samp>
#define COLOR_RED 0xAA3333AA
#define COLOR_LIME 0x10F441AA
#define WEAPONS 2222
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/ws", cmdtext, true, 10) == 0)
{
ShowPlayerDialog(playerid, 2222, DIALOG_STYLE_LIST, "Weapon Shop", "Health - $50\nArmour - $100\n9mm - $275\nSilence Pistol - $310\nDesert Eagle - $450\nShotgun - $520\nSawn-Off Shotgun - $800\nCombat Shotgun - $845\nMicro SMG - $1000\nMP5 - $1200\nTec-9 - $3400\nAK-47 - $4000\nM4 - $4500\nCountry Rifle - $5000\nSniper Rifle - $5000", "Purchase", "Cancel");
return 1;
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 2222)
{
if(response)
{
if(listitem == 0)
{
if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, COLOR_RED, "You need $50. (/cashhelp)");
GivePlayerMoney(playerid, -50);
SetPlayerHealth(playerid, 100); //Health
}
if(listitem == 1)
{
if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid, COLOR_RED, "You need $100. (/cashhelp)");
GivePlayerMoney(playerid, -100);
SetPlayerArmour(playerid, 100); //Armour
}
if(listitem == 2)
{
if(GetPlayerMoney(playerid) < 275) return SendClientMessage(playerid, COLOR_RED, "You need $275. (/cashhelp)");
GivePlayerMoney(playerid, -275);
GivePlayerWeapon(playerid, 22, 1500); //9mm
}
if(listitem == 3)
{
if(GetPlayerMoney(playerid) < 310) return SendClientMessage(playerid, COLOR_RED, "You need $310. (/cashhelp)");
GivePlayerMoney(playerid, -310);
GivePlayerWeapon(playerid, 23, 1500); //Silence Pistol
}
if(listitem == 4)
{
if(GetPlayerMoney(playerid) < 450) return SendClientMessage(playerid, COLOR_RED, "You need $450. (/cashhelp)");
GivePlayerMoney(playerid, -450);
GivePlayerWeapon(playerid, 24, 1500); //Desert Eagle
}
if(listitem == 5)
{
if(GetPlayerMoney(playerid) < 520) return SendClientMessage(playerid, COLOR_RED, "You need $520. (/cashhelp)");
GivePlayerMoney(playerid, -520);
GivePlayerWeapon(playerid, 25, 1500); //Shotgun
}
if(listitem == 6)
{
if(GetPlayerMoney(playerid) < 800) return SendClientMessage(playerid, COLOR_RED, "You need $800. (/cashhelp)");
GivePlayerMoney(playerid, -800);
GivePlayerWeapon(playerid, 26, 1500); //Sawn-off
}
if(listitem == 7)
{
if(GetPlayerMoney(playerid) < 845) return SendClientMessage(playerid, COLOR_RED, "You need $845. (/cashhelp)");
GivePlayerMoney(playerid, -845);
GivePlayerWeapon(playerid, 27, 1500); //Combat Shotgun
}
if(listitem == 8)
{
if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid, COLOR_RED, "You need $1000. (/cashhelp)");
GivePlayerMoney(playerid, -1000);
GivePlayerWeapon(playerid, 28, 1500); //Micro SMG
}
if(listitem == 9)
{
if(GetPlayerMoney(playerid) < 1200) return SendClientMessage(playerid, COLOR_RED, "You need $1200. (/cashhelp)");
GivePlayerMoney(playerid, -1200);
GivePlayerWeapon(playerid, 29, 1500); //MP5
}
if(listitem == 10)
{
if(GetPlayerMoney(playerid) < 3400) return SendClientMessage(playerid, COLOR_RED, "You need $3400. (/cashhelp)");
GivePlayerMoney(playerid, -3400);
GivePlayerWeapon(playerid, 32, 1500); //Tec-9
}
if(listitem == 11)
{
if(GetPlayerMoney(playerid) < 4000) return SendClientMessage(playerid, COLOR_RED, "You need $4000. (/cashhelp)");
GivePlayerMoney(playerid, -4000);
GivePlayerWeapon(playerid, 30, 1500); //AK-47
}
if(listitem == 12)
{
if(GetPlayerMoney(playerid) < 4500) return SendClientMessage(playerid, COLOR_RED, "You need $4500. (/cashhelp)");
GivePlayerMoney(playerid, -4500);
GivePlayerWeapon(playerid, 31, 1500); //M4
}
if(listitem == 13)
{
if(GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid, COLOR_RED, "You need $5000. (/cashhelp)");
GivePlayerMoney(playerid, -5000);
GivePlayerWeapon(playerid, 33, 1500); //Country Rifle
}
if(listitem == 14)
{
if(GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid, COLOR_RED, "You need $5000. (/cashhelp)");
GivePlayerMoney(playerid, -5000);
GivePlayerWeapon(playerid, 34, 1500); //Sniper Rifle
}
}else return SendClientMessage(playerid, COLOR_LIME, "Weapon shop closed. (/ws)");
}
return 1;
}