Bug :-?
#1

Salutare am o problema la sistemul de masini personale atunci cand dau restart la server pot cumpara o masina chiar daca nu am bani la mine ..

Код:
public InsertCar(playerid,model,value,namecar[],type,stockid)
{
    new string[128],sendername[25];
    new idd = Findcar();
    GetPlayerName(playerid,sendername,sizeof(sendername));
    if(idd != 0)
    {
        if(GetPlayerCash(playerid) < value) return SCM(playerid,COLOR_WHITE,"{FFB870}You do not have enough money.");
        if(type == 1)
        {
			if(PlayerInfo[playerid][pPcarkey] == 0)
			{
				PlayerInfo[playerid][pPcarkey] = idd;
		        Update(playerid,pPcarkeyx);
		        CarInfo[idd][cLocationx] = 1098.5378;
				CarInfo[idd][cLocationy] = -1769.7567;
				CarInfo[idd][cLocationz] = 13.0752;
		        CarInfo[idd][cAngle] = 89.8502;
			}
			else
			{
				if(PlayerInfo[playerid][pPremiumAccount] == 1)
				{
					if(PlayerInfo[playerid][pprcarkey] == 0)
					{
						PlayerInfo[playerid][pprcarkey] = idd;
				        Update(playerid,pprcarkeyx);
				        CarInfo[idd][cLocationx] = 1098.5378;
						CarInfo[idd][cLocationy] = -1769.7567;
						CarInfo[idd][cLocationz] = 13.0752;
				        CarInfo[idd][cAngle] = 89.8502;
					}
					else return SCM(playerid,COLOR_WHITE,"{FFB870}Already own a premium car.");
				}
				else return SCM(playerid,COLOR_WHITE,"{FFB870}You own a car and for own two cars you need Premium Account.");
			}
        }
        else if(type == 2)
        {
        	if(PlayerInfo[playerid][pmotokey] == 0)
			{
	        	PlayerInfo[playerid][pmotokey] = idd;
				Update(playerid,pmotokeyx);
		        CarInfo[idd][cLocationx] = 1098.5378;
				CarInfo[idd][cLocationy] = -1769.7567;
				CarInfo[idd][cLocationz] = 13.0752;
		        CarInfo[idd][cAngle] = 89.8502;
			}
			else return SCM(playerid,COLOR_WHITE,"{FFB870}Already own a bike.");
		}
        else if(type == 3)
        {
        	if(PlayerInfo[playerid][phelikey] == 0)
			{
	        	PlayerInfo[playerid][phelikey] = idd;
				Update(playerid,phelikeyx);
		        CarInfo[idd][cLocationx] = 1098.5378;
				CarInfo[idd][cLocationy] = -1769.7567;
				CarInfo[idd][cLocationz] = 13.0752;
		        CarInfo[idd][cAngle] = 89.8502;
			}
			else return SCM(playerid,COLOR_WHITE,"{FFB870}Already own a plane.");
	    }

    	Stock[stockid][vStock]--;
        format(string, sizeof(string), "UPDATE stock SET Stock='%d' WHERE ID='%d'", Stock[stockid][vStock],stockid);
		mysql_query(SQL,string);

		if(personalcar[playerid] != 0)
		{
			DestroyVehicle(personalcar[playerid]);
			OwnedVeh(personalcar[playerid]) = 0;
			personalcar[playerid] = 0;
		}

		GivePlayerCash(playerid,-value);
		Update(playerid,pCashx);
		
		CarInfo[idd][cSell] = 1;
        CarInfo[idd][cID] = idd;
        CarInfo[idd][cModel] = model;

        CarInfo[idd][cColorOne] = 1;
		CarInfo[idd][cColorTwo] = 1;
        strmid(CarInfo[idd][cOwner], sendername, 0, strlen(sendername), 255);
        strmid(CarInfo[idd][cDescription],namecar, 0, strlen(namecar), 255);
        CarInfo[idd][cValue] = value;
        strmid(CarInfo[idd][cLicense], "NewCar", 0, 6, 255);
        CarInfo[idd][cOwned] = 1;
		CarInfo[idd][cLock] = 0;
		CarInfo[idd][cTimed] = 0;
		CarInfo[idd][cInscarprice] = 100;
		CarInfo[idd][cInsurancecar] = 4;
		CarInfo[idd][cKM] = 0.0;
		CarInfo[idd][cPaintJ] = 6;
		CarInfo[idd][mod1] = 0;
		CarInfo[idd][mod2] = 0;
		CarInfo[idd][mod3] = 0;
		CarInfo[idd][mod4] = 0;
		CarInfo[idd][mod5] = 0;
		CarInfo[idd][mod6] = 0;
		CarInfo[idd][mod7] = 0;
		CarInfo[idd][mod8] = 0;
		CarInfo[idd][mod9] = 0;
		CarInfo[idd][mod10] = 0;
		CarInfo[idd][mod11] = 0;
		CarInfo[idd][mod12] = 0;
		CarInfo[idd][mod13] = 0;
		CarInfo[idd][mod14] = 0;
		CarInfo[idd][mod15] = 0;
		CarInfo[idd][mod16] = 0;
		CarInfo[idd][mod17] = 0;
		
		vUpdate(idd, cModsx); //
		vUpdate(idd, cPaintJx); //
		vUpdate(idd, cSellx); //
		vUpdate(idd, cLocationxx); //
		vUpdate(idd, cLocationyx); //
		vUpdate(idd, cLocationzx); //
		vUpdate(idd, cAnglex); //
		vUpdate(idd, cModelx); //
		vUpdate(idd, cColorOnex); //
		vUpdate(idd, cColorTwox); //
		vUpdate(idd, cOwnerx); //
		vUpdate(idd, cValuex); //
		vUpdate(idd, cLicensex); //
		vUpdate(idd, cDescriptionx); //
		vUpdate(idd, cLockx); //
		vUpdate(idd, cTimedx); //
		vUpdate(idd, cInscarpricex); //
		vUpdate(idd, cInsurancecarx); //
		vUpdate(idd, cKMx); //
		vUpdate(idd, cOwnedx); //

        new car = CreateVehicle(CarInfo[idd][cModel],CarInfo[idd][cLocationx],CarInfo[idd][cLocationy],CarInfo[idd][cLocationz],CarInfo[idd][cAngle],1,1,500000);
        SetVehicleNumberPlate(car,CarInfo[idd][cLicense]);
        
        new disp[184];
        format(disp,sizeof(disp),"You bought %s.Please take your car and park it elsewhere.",CarInfo[idd][cDescription]);
		SCM(playerid,COLOR_LIGHTBLUE,disp);
		
		OwnedVeh(car) = idd;
		personalcar[playerid] = car;
        masini++;
        SwitchKey[playerid] = 1;
    }
    if(idd == 0)
    {
		mysql_query(SQL,"SELECT * FROM `cars`");
		mysql_store_result();
		idd = mysql_num_rows()+1;
		mysql_free_result();

        if(type == 1)
        {
			if(PlayerInfo[playerid][pPcarkey] == 0)
			{
				PlayerInfo[playerid][pPcarkey] = idd;
		        Update(playerid,pPcarkeyx);
		        CarInfo[idd][cLocationx] = 1098.5378;
				CarInfo[idd][cLocationy] = -1769.7567;
				CarInfo[idd][cLocationz] = 13.0752;
		        CarInfo[idd][cAngle] = 89.8502;
			}
			else
			{
				if(PlayerInfo[playerid][pPremiumAccount] == 1)
				{
					if(PlayerInfo[playerid][pprcarkey] == 0)
					{
						PlayerInfo[playerid][pprcarkey] = idd;
				        Update(playerid,pprcarkeyx);
				        CarInfo[idd][cLocationx] = 1098.5378;
						CarInfo[idd][cLocationy] = -1769.7567;
						CarInfo[idd][cLocationz] = 13.0752;
				        CarInfo[idd][cAngle] = 89.8502;
					}
					else return SCM(playerid,COLOR_WHITE,"{FFB870}Already own a premium car.");
				}
				else return SCM(playerid,COLOR_WHITE,"{FFB870}You own a car and for own two cars you need Premium Account.");
			}
        }
        else if(type == 2)
        {
        	if(PlayerInfo[playerid][pmotokey] == 0)
			{
	        	PlayerInfo[playerid][pmotokey] = idd;
				Update(playerid,pmotokeyx);
		        CarInfo[idd][cLocationx] = 1098.5378;
				CarInfo[idd][cLocationy] = -1769.7567;
				CarInfo[idd][cLocationz] = 13.0752;
		        CarInfo[idd][cAngle] = 89.8502;
			}
			else return SCM(playerid,COLOR_WHITE,"{FFB870}Already own a bike.");
		}
        else if(type == 3)
        {
        	if(PlayerInfo[playerid][phelikey] == 0)
			{
	        	PlayerInfo[playerid][phelikey] = idd;
				Update(playerid,phelikeyx);
		        CarInfo[idd][cLocationx] = 1098.5378;
				CarInfo[idd][cLocationy] = -1769.7567;
				CarInfo[idd][cLocationz] = 13.0752;
		        CarInfo[idd][cAngle] = 89.8502;
			}
			else return SCM(playerid,COLOR_WHITE,"{FFB870}Already own a plane.");
	    }

	    if(personalcar[playerid] != 0)
		{
			DestroyVehicle(personalcar[playerid]);
			OwnedVeh(personalcar[playerid]) = 0;
			personalcar[playerid] = 0;
		}

        CarInfo[idd][cID] = idd;
        CarInfo[idd][cModel] = model;

        CarInfo[idd][cColorOne] = 1;
		CarInfo[idd][cColorTwo] = 1;
        strmid(CarInfo[idd][cOwner], sendername, 0, strlen(sendername), 255);
        strmid(CarInfo[idd][cDescription],namecar, 0, strlen(namecar), 255);
        CarInfo[idd][cValue] = value;
        strmid(CarInfo[idd][cLicense], "NewCar", 0, 6, 255);
        CarInfo[idd][cOwned] = 1;
		CarInfo[idd][cLock] = 0;
		CarInfo[idd][cTimed] = 0;
		CarInfo[idd][cInscarprice] = 100;
		CarInfo[idd][cInsurancecar] = 4;
		CarInfo[idd][cKM] = 0.0;
		CarInfo[idd][cSell] = 1;
		CarInfo[idd][cPaintJ] = 6;
		CarInfo[idd][mod1] = 0;
		CarInfo[idd][mod2] = 0;
		CarInfo[idd][mod3] = 0;
		CarInfo[idd][mod4] = 0;
		CarInfo[idd][mod5] = 0;
		CarInfo[idd][mod6] = 0;
		CarInfo[idd][mod7] = 0;
		CarInfo[idd][mod8] = 0;
		CarInfo[idd][mod9] = 0;
		CarInfo[idd][mod10] = 0;
		CarInfo[idd][mod11] = 0;
		CarInfo[idd][mod12] = 0;
		CarInfo[idd][mod13] = 0;
		CarInfo[idd][mod14] = 0;
		CarInfo[idd][mod15] = 0;
		CarInfo[idd][mod16] = 0;
		CarInfo[idd][mod17] = 0;

        format(string, sizeof(string),"INSERT INTO cars (ID, Model) VALUES (%d, %d)",  idd, CarInfo[idd][cModel]);
        mysql_query(SQL,string);

		vUpdate(idd, cModsx); //
		vUpdate(idd, cPaintJx); //
		vUpdate(idd, cSellx); //
		vUpdate(idd, cLocationxx); //
		vUpdate(idd, cLocationyx); //
		vUpdate(idd, cLocationzx); //
		vUpdate(idd, cAnglex); //
		vUpdate(idd, cColorOnex); //
		vUpdate(idd, cColorTwox); //
		vUpdate(idd, cOwnerx); //
		vUpdate(idd, cValuex); //
		vUpdate(idd, cLicensex); //
		vUpdate(idd, cDescriptionx); //
		vUpdate(idd, cLockx); //
		vUpdate(idd, cTimedx); //
		vUpdate(idd, cInscarpricex); //
		vUpdate(idd, cInsurancecarx); //
		vUpdate(idd, cKMx); //
		vUpdate(idd, cOwnedx); //

        new car = CreateVehicle(CarInfo[idd][cModel],CarInfo[idd][cLocationx],CarInfo[idd][cLocationy],CarInfo[idd][cLocationz],CarInfo[idd][cAngle],1,1,500000);
        SetVehicleNumberPlate(car,CarInfo[idd][cLicense]);

        new disp[184];
        format(disp,sizeof(disp),"You bought %s.Please take your car and park it elsewhere.",CarInfo[idd][cDescription]);
		SCM(playerid,COLOR_LIGHTBLUE,disp);

		OwnedVeh(car) = idd;
		personalcar[playerid] = car;

        masini++;
        SwitchKey[playerid] = 1;
    }
    return 1;
}
Chiar nu inteleg ce are am cumparat un infernus si aveam 0$ dupa care am incercat sa mai iau 1 dar spunea ca nu am bani.
Reply
#2

Fa debug.
Reply
#3

Am incercat dar nu mi-a iesit.

P.S: am uitat sa precizez ca nici stock-ul nu se schimba EX( sunt 3 masini pe stock daca cumperi o masina tot nu se da - 1 )

Stock[stockid][vStock]--;
Reply
#4

Quote:
Originally Posted by DyduShxD
Посмотреть сообщение
Am incercat dar nu mi-a iesit.

P.S: am uitat sa precizez ca nici stock-ul nu se schimba EX( sunt 3 masini pe stock daca cumperi o masina tot nu se da - 1 )

Stock[stockid][vStock]--;
Pune print(f)() unde crezi ca-i problema, o sa-ti dai mai usor seama.
Reply
#5

pawn Код:
printf(%d", integer);
Reply
#6

Am incercat sa fac acest debug dar nu mi-a iesit .. dar sunt 100% sigur ca de aici e problema cunosc pe cineva care are acelasi gm ca al meu el a reusit sa rezolve problema si mi-a dat doar un indiciu " public InsertCar " dar nu vad care ar fi problema e pusa restrictia la fel si - pentru stock.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)