Jump to content
  • 0

Vinde masina.


Question

Posted (edited)

Problema intalnita (descriere): Salut, am testat ds si am cumparat o masina dar cand doresc sa o cumpar imi zice "Trebuie sa fi in masina ca sa o poti vinde! ".. desi sunt in masina pe care am cumparat-o
Ero(area / rile) / warning-(ul / urile):
Liniile de cod / sursa / script-ul:

if(strcmp(cmd, "/vindemasina", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(GetPlayerVehicleID(playerid) == PlayerData[playerid][pPcarkey]+PreVehicle)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
new ownvehkey;
if(GetPlayerVehicleID(playerid) == PlayerData[playerid][pPcarkey]+PreVehicle) { ownvehkey = PlayerData[playerid][pPcarkey]; }
else { return 1; }
if(strcmp(sendername, CarData[ownvehkey][cOwner], true) == 0)
{
new carsellprice = CarData[ownvehkey][cValue] / 4 * 3;
CarData[ownvehkey][cOwned] = 0;
CarData[ownvehkey][cLockk] = 0;
strmid(CarData[ownvehkey][cOwner], "Dealership", 0, strlen("Dealership"), 999);
GivePlayerCash(playerid,carsellprice);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "~w~Ti-ai vandut masina personala cu: ~n~~g~$%d", carsellprice);
GameTextForPlayer(playerid, string, 10000, 3);
if(GetPlayerVehicleID(playerid) == PlayerData[playerid][pPcarkey]+PreVehicle)
{
PlayerData[playerid][pPcarkey] = 999;
format(string, sizeof(string), "UPDATE players SET Car='%d' WHERE id=%d", PlayerData[playerid][pPcarkey], PlayerData[playerid][pSQLID]);
mysql_query(string);
}
TogglePlayerControllable(playerid, 1);
CarData[ownvehkey][cLocationx] = CarData[ownvehkey][cSaLocationx];
CarData[ownvehkey][cLocationy] = CarData[ownvehkey][cSaLocationy];
CarData[ownvehkey][cLocationz] = CarData[ownvehkey][cSaLocationz];
CarData[ownvehkey][cAngle] = CarData[ownvehkey][cSaAngle];
DestroyVehicle(ownvehkey+PreVehicle);
CreateVehicle(CarData[ownvehkey][cModel],CarData[ownvehkey][cLocationx],CarData[ownvehkey][cLocationy],CarData[ownvehkey][cLocationz]+1.0,CarData[ownvehkey][cAngle],CarData[ownvehkey][cColorOne],CarData[ownvehkey][cColorTwo],60000);
format(string, sizeof(string), "UPDATE cars SET Locationx='%f' WHERE id=%d", CarData[ownvehkey][cLocationx], ownvehkey);
mysql_query(string);
format(string, sizeof(string), "UPDATE cars SET Locationy='%f' WHERE id=%d", CarData[ownvehkey][cLocationy], ownvehkey);
mysql_query(string);
format(string, sizeof(string), "UPDATE cars SET Locationz='%f' WHERE id=%d", CarData[ownvehkey][cLocationz], ownvehkey);
mysql_query(string);
format(string, sizeof(string), "UPDATE cars SET Angle='%f' WHERE id=%d", CarData[ownvehkey][cAngle], ownvehkey);
mysql_query(string);
format(string, sizeof(string), "UPDATE cars SET Owned='%d' WHERE id=%d", CarData[ownvehkey][cOwned], ownvehkey);
mysql_query(string);
format(string, sizeof(string), "UPDATE cars SET Owner='%s' WHERE id=%d", CarData[ownvehkey][cOwner], ownvehkey);
mysql_query(string);
format(string, sizeof(string), "UPDATE cars SET Lockk='%d' WHERE id=%d", CarData[ownvehkey][cLockk], ownvehkey);
mysql_query(string);
new year,month,day,hour,minute,second;
getdate(year, month, day);
gettime(hour,minute,second);
format(string, sizeof(string), "AdmCmd: %s a vandut id %d in %d/%d/%d ora %d-%d-%d",PlayerData[playerid][pNume],ownvehkey,month,day,year,hour,minute,second);
PropertyLog(string);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Trebuie sa fi in masina ca sa o poti vinde! ");
return 1;
}
}
return 1;
}

Imagini / Video (optional):
Ati incercat sa rezolvati singur?: Nu ma prea pricep..

Edited by Seven

3 answers to this question

Recommended Posts

  • 0
Posted

Foloseste comanda:

if(strcmp(cmd, "/vindemasina", true) == 0)
{
	if(IsPlayerConnected(playerid))
	{
		printf("Vehicle ID: %d",PlayerData[playerid][pPcarkey]+PreVehicle);
	}
	return 1;
}

si vezi ID-ul carui vehicul ti-l afiseaza in consola. Acela trebuie sa fie egal cu cel al vehiculului pe care il conduci.

 

1859311972_BANNER-GIREADAcopy-min.thumb.png.48e5e420ae2185dce5b244965a1d2601.png

 

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.