Jump to content
  • 0

Problema /sellcar /asellcar


Bogdan's

Question

Problema intalnita (descriere): Salut,am intampinat si eu o problema si anume,am modificat comenzile /sellcar si /asellcar,bon,mi-a reusit,doar ca dau de o ''eroare'' daca ii pot spune asa,si anume aceea cand dau restart la server imi da masina inapoi la dealership,unde a fost ea.

Am folosit functia DestroyVehicle pentru a distruge vehiculul,dar am impresia ca masina exista in cars.cfg din scriptfilles.Daca ma puteti ajuta v-as fi recunoscator(+++).

 

Bun asta la comanda /sellcar,la /asellcar pe de alta parte,am adaugat tot destroyvehicle si la fel ca sus.As dori inca ceva.cum as putea sa fac ca la /asellcar cand vinde masina un admin sa ii stearga de la stats masina playerului care a fost vanduta?
Ero(area / rile) / warning-(ul / urile):
Liniile de cod / sursa / script-ul(obligatoriu):

Comanda /asellcar

if(!strcmp(cmdtext, "/asellcar", true)) // By Joe
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if(gPlayerLogged[playerid] == 0)
	        {
	            SendClientMessage(playerid, COLOR_GREY, "   Trebuie sa fii logat pentru acesta comanda !");
	            return 1;
	        }
	        if(!IsAtDealership(playerid))
	        {
	            SendClientMessage(playerid, COLOR_GREY, "   Nu esti la un showroom ! ");
	            return 1;
	        }
	        if(PlayerInfo[playerid][pAdmin] >= 1337)
	        {
	            new vehid = GetPlayerVehicleID(playerid);
	            new Float:x,Float:y,Float:z;
         		new Float:a;
         		new vehi = GetPlayerVehicleID(playerid);
           		DestroyVehicle(vehi);
           		CarInfo[vehid][cOwned] = 0;
           		strmid(CarInfo[vehid][cOwner], "Dealer", 0, strlen("Dealer"), 999);
         		PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
         		GameTextForPlayer(playerid, "~w~Ai vandut masina ca admin", 1000, 3);
         		GetVehiclePos(vehid, x, y, z);
         		GetVehicleZAngle(vehid, a);
         		OnPropUpdate();
         		SetVehicleToRespawn(vehid);
				SetVehiclePos(vehid, CarInfo[vehid][cLocationx],CarInfo[vehid][cLocationy],CarInfo[vehid][cLocationz]+0.2);
	            ChangeVehicleColor(vehid, CarInfo[vehid][cColorOne],CarInfo[vehid][cColorTwo]);
				PutPlayerInVehicle(playerid, vehid, 0);
				engineOn[vehid] = false;
				gEngine[playerid] = 0;
	            SetVehicleZAngle(vehid, a);
				return 1;
	        }
	        else
	        {
	            SendClientMessage(playerid, COLOR_GREY, "   Nu esti autorizat sa folosesti comanda !");
	            return 1;
	        }
	    }
	    return 1;
	}

Comanda /sellcar:

if(strcmp(cmd, "/sellcar", true) == 0||strcmp(cmd, "/sellboat", true) == 0||strcmp(cmd, "/sellbike", true) == 0||strcmp(cmd, "/sellaero", true) == 0)
	{
				if(IsAtDealership(playerid))
	            {
	                    new vehid;
	                    if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey1]) { vehid = PlayerInfo[playerid][pPcarkey1]; }
	                    else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2]) { vehid = PlayerInfo[playerid][pPcarkey2]; }
	                    else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey3]) { vehid = PlayerInfo[playerid][pPcarkey3]; }
	                    else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey4]) { vehid = PlayerInfo[playerid][pPcarkey4]; }
	                    else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey5]) { vehid = PlayerInfo[playerid][pPcarkey5]; }
	                    else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey6]) { vehid = PlayerInfo[playerid][pPcarkey6]; }
	                    else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey7]) { vehid = PlayerInfo[playerid][pPcarkey7]; }
	                    else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey8]) { vehid = PlayerInfo[playerid][pPcarkey8]; }
	                    else { return 1; }
						new Float:x, Float:y, Float:z, Float:a;
						GetVehiclePos(vehid, x, y, z);
						GetVehicleZAngle(vehid, a);
	                    GetPlayerName(playerid, sendername, sizeof(sendername));
	                    if(strcmp(sendername, CarInfo[vehid][cOwner], true) == 0)
	                    {
	                        new vehi = GetPlayerVehicleID(playerid);
	                        new carsellprice = CarInfo[vehid][cValue] / 2;
	                        DestroyVehicle(vehi);
	                        format(string, sizeof(string), "~w~ai vandut masina pentru: ~n~~g~$%d", carsellprice);
	                        GameTextForPlayer(playerid, string, 1000, 3);
	                        CarInfo[vehid][cOwned] = 0;
	                        SetVehicleToRespawn(vehid);
                         	strmid(CarInfo[vehid][cOwner], "Dealer", 0, strlen("Dealer"), 999);
	                        SafeGivePlayerMoney(playerid,carsellprice);
	                        if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey1]) { PlayerInfo[playerid][pPcarkey1] = 9999; }
	                        else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2]) { PlayerInfo[playerid][pPcarkey2] = 9999; }
	                        else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey3]) { PlayerInfo[playerid][pPcarkey3] = 9999; }
	                        else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey4]) { PlayerInfo[playerid][pPcarkey4] = 9999; }
	                        else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey5]) { PlayerInfo[playerid][pPcarkey5] = 9999; }
	                        else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey6]) { PlayerInfo[playerid][pPcarkey6] = 9999; }
	                        else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey7]) { PlayerInfo[playerid][pPcarkey7] = 9999; }
	                        else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey8]) { PlayerInfo[playerid][pPcarkey8] = 9999; }
	                        RemovePlayerFromVehicle(playerid);
	                        TogglePlayerControllable(playerid, 1);
	                        OnPropUpdate();
	                        OnPlayerUpdateEx(playerid);
							return 1;
		                }
		                else
		                {
		                    SendClientMessage(playerid, COLOR_GREY, "  Nu esti in masina ta! ");
		                    return 1;
		                }
	            }
	            else
	            {
	                SendClientMessage(playerid, COLOR_GREY, "Nu esti la centrul de vanzare");
	                return 1;
	            }
	}

Imagini / Video (optional):-
Ati incercat sa rezolvati singur?:Mi-am batut capul de aseara si nu reusesc sa ii dau de capat. Va rog daca se poate un raspuns cat mai rapid.

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0

Incearca comanda asta:

if(strcmp(cmd, "/sellcar", true) == 0||strcmp(cmd, "/sellboat", true) == 0||strcmp(cmd, "/sellbike", true) == 0||strcmp(cmd, "/sellaero", true) == 0)
{
			if(IsAtDealership(playerid))
			{
					new vehid;
					if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey1]) { vehid = PlayerInfo[playerid][pPcarkey1]; }
					else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2]) { vehid = PlayerInfo[playerid][pPcarkey2]; }
					else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey3]) { vehid = PlayerInfo[playerid][pPcarkey3]; }
					else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey4]) { vehid = PlayerInfo[playerid][pPcarkey4]; }
					else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey5]) { vehid = PlayerInfo[playerid][pPcarkey5]; }
					else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey6]) { vehid = PlayerInfo[playerid][pPcarkey6]; }
					else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey7]) { vehid = PlayerInfo[playerid][pPcarkey7]; }
					else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey8]) { vehid = PlayerInfo[playerid][pPcarkey8]; }
					else { return 1; }
					new Float:x, Float:y, Float:z, Float:a;
					GetVehiclePos(vehid, x, y, z);
					GetVehicleZAngle(vehid, a);
					GetPlayerName(playerid, sendername, sizeof(sendername));
					if(strcmp(sendername, CarInfo[vehid][cOwner], true) == 0)
					{
						new vehi = GetPlayerVehicleID(playerid);
						new carsellprice = CarInfo[vehid][cValue] / 2;
						format(string, sizeof(string), "~w~ai vandut masina pentru: ~n~~g~$%d", carsellprice);
						GameTextForPlayer(playerid, string, 1000, 3);
						strmid(CarInfo[vehid][cOwner], "None", 0, strlen("None"), 999);
						strmid(CarInfo[vehid][cDescription], "None", 0, strlen("None"), 999);
						strmid(CarInfo[vehid][cNume], "None", 0, strlen("None"), 999);
						CarInfo[vehid][cModel] = 0;
						CarInfo[vehid][cLocationx] = 0.0;
						CarInfo[vehid][cLocationy] = 0.0;
						CarInfo[vehid][cLocationz] = 0.0;
						CarInfo[vehid][cAngle] = 0.0;
						CarInfo[vehid][cColorOne] = 0;
						CarInfo[vehid][cColorTwo] = 0;
						CarInfo[vehid][cValue] = 0;
						CarInfo[vehid][cLicense] = 0;
						CarInfo[vehid][cOwned] = 0;
						CarInfo[vehid][cLock] = 0;
						CarInfo[vehid][cOras] = 0;
						CarInfo[vehid][cNumar] = 0;
						CarInfo[vehid][cMod1] = 0;
						CarInfo[vehid][cMod2] = 0;
						CarInfo[vehid][cMod3] = 0;
						CarInfo[vehid][cMod4] = 0;
						CarInfo[vehid][cMod5] = 0;
						CarInfo[vehid][cMod6] = 0;
						CarInfo[vehid][cMod7] = 0;
						CarInfo[vehid][cMod8] = 0;
						CarInfo[vehid][cMod9], = 0;
						CarInfo[vehid][cMod10] = 0;
						CarInfo[vehid][cMod11] = 0;
						CarInfo[vehid][cMod12] = 0;
						CarInfo[vehid][cMod13] = 0;
						CarInfo[vehid][cMod14] = 0;
						CarInfo[vehid][cMod15] = 0;
						CarInfo[vehid][cMod16] = 0;
						CarInfo[vehid][cMod17] = 0;
						CarInfo[vehid][cPaintJob] = 0;
						CarInfo[vehid][cDist] = 0;
						CarInfo[vehid][cLockTrunk] = 0;
						CarInfo[vehid][cAlarmInst] = 0;
						CarInfo[vehid][cAlarm] = 0;
						CarInfo[vehid][cDate ] = 0;
						CarInfo[vehid][cNeon] = 0;
						CarInfo[vehid][cNeonActiv] = 0;
						CarInfo[vehid][cBass] = 0;
						RemovePlayerFromVehicle(playerid);
						DestroyVehicle(vehi);
						OnPropUpdate();
						OnPlayerUpdateEx(playerid);
						SafeGivePlayerMoney(playerid,carsellprice);
						if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey1]) { PlayerInfo[playerid][pPcarkey1] = 9999; }
						else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2]) { PlayerInfo[playerid][pPcarkey2] = 9999; }
						else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey3]) { PlayerInfo[playerid][pPcarkey3] = 9999; }
						else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey4]) { PlayerInfo[playerid][pPcarkey4] = 9999; }
						else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey5]) { PlayerInfo[playerid][pPcarkey5] = 9999; }
						else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey6]) { PlayerInfo[playerid][pPcarkey6] = 9999; }
						else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey7]) { PlayerInfo[playerid][pPcarkey7] = 9999; }
						else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey8]) { PlayerInfo[playerid][pPcarkey8] = 9999; }
						TogglePlayerControllable(playerid, 1);
						return 1;
					}
					else
					{
						SendClientMessage(playerid, COLOR_GREY, "  Nu esti in masina ta! ");
						return 1;
					}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "Nu esti la centrul de vanzare");
				return 1;
			}
}
Edited by andy47
  • Upvote 1
Link to comment
Share on other sites

  • 0
public OnPropUpdate()
{
	new idx;
	new File: file2;
	while (idx < sizeof(HouseInfo))
	{
		new coordsstring[256];
		format(coordsstring, sizeof(coordsstring), "%f,%f,%f,%f,%f,%f,%d,%d,%d,%d,%d,%d,%s,%s,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%dn",
		HouseInfo[idx][hEntrancex],
		HouseInfo[idx][hEntrancey],
		HouseInfo[idx][hEntrancez],
		HouseInfo[idx][hExitx],
		HouseInfo[idx][hExity],
		HouseInfo[idx][hExitz],
		HouseInfo[idx][hHealthx],
		HouseInfo[idx][hHealthy],
		HouseInfo[idx][hHealthz],
		HouseInfo[idx][hArmourx],
		HouseInfo[idx][hArmoury],
		HouseInfo[idx][hArmourz],
		HouseInfo[idx][hOwner],
		HouseInfo[idx][hDiscription],
		HouseInfo[idx][hValue],
		HouseInfo[idx][hHel],
		HouseInfo[idx][hArm],
		HouseInfo[idx][hInt],
		HouseInfo[idx][hLock],
		HouseInfo[idx][hOwned],
		HouseInfo[idx][hRooms],
		HouseInfo[idx][hRent],
		HouseInfo[idx][hRentabil],
		HouseInfo[idx][hTakings],
		HouseInfo[idx][hVec],
		HouseInfo[idx][hVcol1],
		HouseInfo[idx][hVcol2],
		HouseInfo[idx][hDate],
		HouseInfo[idx][hLevel],
		HouseInfo[idx][hWorld]);

		HouseInfo[idx][hWorld] = idx;
		if(idx == 0)
		{
			file2 = fopen("property.cfg", io_write);
		}
		else
		{
			file2 = fopen("property.cfg", io_append);
		}
		fwrite(file2, coordsstring);
		idx++;
		fclose(file2);
	}
	idx = 0;
	while (idx < sizeof(BizzInfo))
	{
		new coordsstring[256];
		format(coordsstring, sizeof(coordsstring), "%d|%s|%s|%s|%f|%f|%f|%f|%f|%f|%d|%d|%d|%d|%d|%d|%d|%d|%dn",
		BizzInfo[idx][bOwned],
		BizzInfo[idx][bOwner],
		BizzInfo[idx][bMessage],
		BizzInfo[idx][bExtortion],
		BizzInfo[idx][bEntranceX],
		BizzInfo[idx][bEntranceY],
		BizzInfo[idx][bEntranceZ],
		BizzInfo[idx][bExitX],
		BizzInfo[idx][bExitY],
		BizzInfo[idx][bExitZ],
		BizzInfo[idx][bLevelNeeded],
		BizzInfo[idx][bBuyPrice],
		BizzInfo[idx][bEntranceCost],
		BizzInfo[idx][bTill],
		BizzInfo[idx][bLocked],
		BizzInfo[idx][bInterior],
		BizzInfo[idx][bProducts],
		BizzInfo[idx][bMaxProducts],
		BizzInfo[idx][bPriceProd]);
		if(idx == 0)
		{
			file2 = fopen("bizz.cfg", io_write);
		}
		else
		{
			file2 = fopen("bizz.cfg", io_append);
		}
		fwrite(file2, coordsstring);
		idx++;
		fclose(file2);
	}
	idx = 0;
	while (idx < sizeof(SBizzInfo))
	{
		new coordsstring[256];
		format(coordsstring, sizeof(coordsstring), "%d|%s|%s|%s|%f|%f|%f|%d|%d|%d|%d|%d|%d|%d|%d|%dn",
		SBizzInfo[idx][sbOwned],
		SBizzInfo[idx][sbOwner],
		SBizzInfo[idx][sbMessage],
		SBizzInfo[idx][sbExtortion],
		SBizzInfo[idx][sbEntranceX],
		SBizzInfo[idx][sbEntranceY],
		SBizzInfo[idx][sbEntranceZ],
		SBizzInfo[idx][sbLevelNeeded],
		SBizzInfo[idx][sbBuyPrice],
		SBizzInfo[idx][sbEntranceCost],
		SBizzInfo[idx][sbTill],
		SBizzInfo[idx][sbLocked],
		SBizzInfo[idx][sbInterior],
		SBizzInfo[idx][sbProducts],
		SBizzInfo[idx][sbMaxProducts],
		SBizzInfo[idx][sbPriceProd]);
		if(idx == 0)
		{
			file2 = fopen("sbizz.cfg", io_write);
		}
		else
		{
			file2 = fopen("sbizz.cfg", io_append);
		}
		fwrite(file2, coordsstring);
		idx++;
		fclose(file2);
	}
	idx = Numar_Total_Masini;
 	while (idx < sizeof(CarInfo))
	{
		new coordsstring[256]; //                   1 , 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42
		format(coordsstring, sizeof(coordsstring), "%d,%f,%f,%f,%f,%d,%d,%s,%s,%d,%d,%d,%d,%d,%s,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%dn",
		CarInfo[idx][cModel],//1
		CarInfo[idx][cLocationx],//2
		CarInfo[idx][cLocationy],//3
		CarInfo[idx][cLocationz],//4
		CarInfo[idx][cAngle],//5
		CarInfo[idx][cColorOne],//6
		CarInfo[idx][cColorTwo],//7
		CarInfo[idx][cOwner],//8
		CarInfo[idx][cDescription],//9
		CarInfo[idx][cValue],//10
		CarInfo[idx][cLicense],//11
		CarInfo[idx][cOwned],//12
		CarInfo[idx][cLock],//13
		CarInfo[idx][cOras],//14
		CarInfo[idx][cNumar],//15
		CarInfo[idx][cNume],//16
		CarInfo[idx][cMod1],//17
		CarInfo[idx][cMod2],//18
		CarInfo[idx][cMod3],//19
		CarInfo[idx][cMod4],//20
		CarInfo[idx][cMod5],//21
		CarInfo[idx][cMod6],//22
		CarInfo[idx][cMod7],//23
		CarInfo[idx][cMod8],//24
		CarInfo[idx][cMod9],//25
		CarInfo[idx][cMod10],//26
		CarInfo[idx][cMod11],//27
		CarInfo[idx][cMod12],//28
		CarInfo[idx][cMod13],//29
		CarInfo[idx][cMod14],//30
		CarInfo[idx][cMod15],//31
		CarInfo[idx][cMod16],//32
		CarInfo[idx][cMod17],//33
		CarInfo[idx][cPaintJob],//34
		CarInfo[idx][cDist],//35
		CarInfo[idx][cLockTrunk],//36
		CarInfo[idx][cAlarmInst],//37
		CarInfo[idx][cAlarm],//38
		CarInfo[idx][cDate],//39
		CarInfo[idx][cNeon],//40
		CarInfo[idx][cNeonActiv],//41
		CarInfo[idx][cBass]);//42
		if(idx == Numar_Total_Masini)
		{
			file2 = fopen("cars.cfg", io_write);
		}
		else
		{
			file2 = fopen("cars.cfg", io_append);
		}
		fwrite(file2, coordsstring);
		idx++;
		fclose(file2);
	}
	return 1;
}
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.