SA-MP Forums Archive
Buy boat command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Buy boat command (/showthread.php?tid=597964)



Buy boat command - Mikeydoo - 07.01.2016

Hey guys I started editing a sell boat command and I was wondering how to deal with its dialog. So to make it simple, my script has a /buyboat command when I enter it it pops me another script dialog. Which i dont want to see. Any idea on how to create a new dialog for those six boats im trying to sell. Thanks so much , here's the script

Код:
CMD:buyboat(playerid, params[])
{
	new string[128];
   	if(!IsPlayerLoggedIn(playerid) || PlayerInfo[playerid][pAsshole] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are not allowed to use command.");
	if(!IsPlayerInRangeOfPoint(playerid, 10, 830.0919,-2061.3379,12.8672)) return SendClientMessage(playerid, COLOR_GREY, "You are not near the boat dealership.");
	//if(PlayerInfo[playerid][pVIP] >= 2)
	//{
		if(PlayerInfo[playerid][vModel] && PlayerInfo[playerid][vVModel])
		{
			format(string, sizeof(string), "You already own  ID %d and %d.", PlayerInfo[playerid][pVeh], PlayerInfo[playerid][pVVeh]);
			SendClientMessage(playerid, COLOR_GREY, string);
		    return 1;
		}
		else ShowDialog(playerid, 37);
	    return 1;
	/*}
	if(PlayerInfo[playerid][vModel])
	{
		format(string, sizeof(string), "You already own vehicle ID %d.", PlayerInfo[playerid][pVeh]);
		SendClientMessage(playerid, COLOR_GREY, string);
	    return 1;
	}
	ShowDialog(playerid, 37);
	return 1;*/
}
Код:
else if(dialogid == 37) // Boats
	{
	    new string[128], carid, price;
	    if(response)
	    {
	        switch(listitem)
	        {
	            case 0: {carid = 446; price = 25000;} 
	            case 1: {carid = 452; price = 35000;} 
	            case 2: {carid = 453; price = 30000;} 
	            case 3: {carid = 454; price = 25000;} 
	            case 4: {carid = 472; price = 27000;}
	            case 5: {carid = 473; price = 24000;} 
	            case 6: {carid = 484; price = 30000;} 
	            case 7: {carid = 493; price = 30000;} 
	        }
	        if(price > PlayerInfo[playerid][pMoney]) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money on you.");
            GiveDodMoney(playerid, -price);
         	format(string, sizeof(string), " You have purchased a %s. (Unlock it using /lock)", RVN(carid));
            ++PlayerCars;
			SendClientMessage(playerid, COLOR_GREEN, string);
	        //if(PlayerInfo[playerid][pVIP] >= 2 && PlayerInfo[playerid][vModel])
	        if(PlayerInfo[playerid][vModel])
	        {
	            PlayerInfo[playerid][pVVeh] = CreateVehicle(carid, 826.8421,-2078.9644,-0.1015,87.8349,0,0,1200);
		        SetVehicleParamsEx(PlayerInfo[playerid][pVVeh], 0, 0, 0, 1, 0, 0, 0);
		        PlayerInfo[playerid][vVLocked] = 1;
		        PlayerInfo[playerid][vVModel] = carid;
				GetVehiclePos(PlayerInfo[playerid][pVVeh], PlayerInfo[playerid][vVX], PlayerInfo[playerid][vVY], PlayerInfo[playerid][vVZ]);
				GetVehicleZAngle(PlayerInfo[playerid][pVVeh], PlayerInfo[playerid][vVA]);
				PlayerInfo[playerid][vVC1] = 0;
				PlayerInfo[playerid][vVC2] = 0;
				return 1;
	        }
	        PlayerInfo[playerid][pVeh] = CreateVehicle(carid, 826.8421,-2078.9644,-0.1015,87.8349,0,0,1200);
	        SetVehicleParamsEx(PlayerInfo[playerid][pVeh], 0, 0, 0, 1, 0, 0, 0);
	        PlayerInfo[playerid][vLocked] = 1;
	        PlayerInfo[playerid][vModel] = carid;
			GetVehiclePos(PlayerInfo[playerid][pVeh], PlayerInfo[playerid][vX], PlayerInfo[playerid][vY], PlayerInfo[playerid][vZ]);
			GetVehicleZAngle(PlayerInfo[playerid][pVeh], PlayerInfo[playerid][vA]);
			PlayerInfo[playerid][vC1] = 0;
			PlayerInfo[playerid][vC2] = 0;
	    }
	}
I have no idea what dialog 37 is in my script. How can I get it to refer to another dialog ? thanks sooo much !


Re: Buy boat command - colonel-top - 07.01.2016

Maybe you can change Dialog ID like 37 to 137 ... and maybe your Dialog ID same as Another Dialog id ?


Re: Buy boat command - FreAkeD - 07.01.2016

Try returning 0 on OnDialogResponse. This will then not conflict any other dialogs from other scripts.


Re: Buy boat command - Mikeydoo - 07.01.2016

Thansk for your quick reply guys, i tried what you says and returned 0 for the dialog, also changed the dialog id to 440 which doesnt exist. When i try the command it says i aint at the boat dealership. when i get to the boat dealership, I dont get any messages and the dialog box doesnt appear.. Im going crazy