Jump to content
  • 0

[PROBLEMA]Sistem de nrg si masini personale


Question

Posted

Salut, am si eu o problema cu sistemul de nrg si masini personale. Adica am o comanda care creeze orice masina/nrg vreau si cand dau restart la server se strica, adica daca creez masina si nrg daia se incurca. Cum fac sa nu se mai intample asta? Comanda este /acreatecar

5 answers to this question

Recommended Posts

Posted

Uite comanda.

	if(strcmp(cmd, "/acreatecar", true) == 0)
	{
	    if(PlayerInfo[playerid][pAdmin] >= 1338 || PlayerInfo[playerid][pSpecialAdmin] >= 1)
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "{00A1FF}USAGE{FFFFFF}: /acreatecar [carid] [culoare1] [culoare2] [Pretul]");
				return 1;
			}
			new car;
			car = strval(tmp);
			if(car < 400 || car > 611) { SendClientMessage(playerid, COLOR_WHITE, " Vehicle Number can't be below 400 or above 611 !"); return 1; }
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "{00A1FF}USAGE{FFFFFF}: /acreatecar [carid] [culoare1] [culoare2] [Pretul]");
				return 1;
			}
			new color1;
			color1 = strval(tmp);
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "{00A1FF}USAGE{FFFFFF}: /acreatecar [carid] [culoare1] [culoare2] [Pretul]");
				return 1;
			}
			new color2;
			color2 = strval(tmp);
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "{00A1FF}USAGE{FFFFFF}: /acreatecar [carid] [culoare1] [culoare2] [Pretul]");
				return 1;
			}
			new value;
			value = strval(tmp);
			new Float:X,Float:Y,Float:Z; GetPlayerPos(playerid, X,Y,Z);
            new thiscar = CreateVehicle(car,X,Y,Z,1,color1,color2,99999999);
            format(CarInfo[thiscar][cLicense], 32 ,"ForSale");
	        SetVehicleNumberPlate(vehid,CarInfo[thiscar][cLicense]);
			CarInfo[thiscar][cOwned] = 0; CarInfo[thiscar][cModel] = car; CarInfo[thiscar][cColorOne] = color1; CarInfo[thiscar][cColorTwo] = color2;
			CarInfo[thiscar][cLocationx] = X; CarInfo[thiscar][cLocationy] = Y; CarInfo[thiscar][cLocationz] = Z; CarInfo[thiscar][cAngle] = 1;
			CarInfo[thiscar][cValue] = value; CarInfo[thiscar][cLock] = 0; CarInfo[thiscar][paintjob] = -1; LoadComponents(thiscar);
			PutPlayerInVehicle(playerid,thiscar,0);
			strmid(CarInfo[vehid][cOwner], "Dealership", 0, strlen("Dealership"), 999);
			format(CarInfo[thiscar][cDescription], 32, "%s",vehName[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
			format(string, sizeof(string), " Masina %d a fost creata cu succes!.", thiscar);
			SendClientMessage(playerid, COLOR_BLUE, string);
		}
		else
		{
		    SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!");
			return 1;
		}
		return 1;
	}

Si daca poti face cumva cand da altcineva F pe nrg altuia sa nu se poata urca, sa zica gen Aceasta Masina ii apartine lui X.

Posted

Uite comanda.

	if(strcmp(cmd, "/acreatecar", true) == 0)
	{
	    if(PlayerInfo[playerid][pAdmin] >= 1338 || PlayerInfo[playerid][pSpecialAdmin] >= 1)
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "{00A1FF}USAGE{FFFFFF}: /acreatecar [carid] [culoare1] [culoare2] [Pretul]");
				return 1;
			}
			new car;
			car = strval(tmp);
			if(car < 400 || car > 611) { SendClientMessage(playerid, COLOR_WHITE, " Vehicle Number can't be below 400 or above 611 !"); return 1; }
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "{00A1FF}USAGE{FFFFFF}: /acreatecar [carid] [culoare1] [culoare2] [Pretul]");
				return 1;
			}
			new color1;
			color1 = strval(tmp);
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "{00A1FF}USAGE{FFFFFF}: /acreatecar [carid] [culoare1] [culoare2] [Pretul]");
				return 1;
			}
			new color2;
			color2 = strval(tmp);
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "{00A1FF}USAGE{FFFFFF}: /acreatecar [carid] [culoare1] [culoare2] [Pretul]");
				return 1;
			}
			new value;
			value = strval(tmp);
			new Float:X,Float:Y,Float:Z; GetPlayerPos(playerid, X,Y,Z);
            new thiscar = CreateVehicle(car,X,Y,Z,1,color1,color2,99999999);
            format(CarInfo[thiscar][cLicense], 32 ,"ForSale");
	        SetVehicleNumberPlate(vehid,CarInfo[thiscar][cLicense]);
			CarInfo[thiscar][cOwned] = 0; CarInfo[thiscar][cModel] = car; CarInfo[thiscar][cColorOne] = color1; CarInfo[thiscar][cColorTwo] = color2;
			CarInfo[thiscar][cLocationx] = X; CarInfo[thiscar][cLocationy] = Y; CarInfo[thiscar][cLocationz] = Z; CarInfo[thiscar][cAngle] = 1;
			CarInfo[thiscar][cValue] = value; CarInfo[thiscar][cLock] = 0; CarInfo[thiscar][paintjob] = -1; LoadComponents(thiscar);
			PutPlayerInVehicle(playerid,thiscar,0);
			strmid(CarInfo[vehid][cOwner], "Dealership", 0, strlen("Dealership"), 999);
			format(CarInfo[thiscar][cDescription], 32, "%s",vehName[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
			format(string, sizeof(string), " Masina %d a fost creata cu succes!.", thiscar);
			SendClientMessage(playerid, COLOR_BLUE, string);
		}
		else
		{
		    SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!");
			return 1;
		}
		return 1;
	}

Si daca poti face cumva cand da altcineva F pe nrg altuia sa nu se poata urca, sa zica gen Aceasta Masina ii apartine lui X.

Ma mai ajuta cineva?

Posted

Te ajut eu ;)

Iti spun ceva , mai bine baga un sistem /v  in loc de /acreatecar

Am avut si eu GM-ul asta (THEG...)

P.S: Ia-ti sistem /v

Posted

Incearca sa faci un folder in ScriptFiles numit Vehicles ca sa se salveze acolo masinile create.

Pune la inceputul Scriptului :

#define VEHICLE_FILE_PATH "Vehicles/"

iar in comanda

format(filename, sizeof(filename), VEHICLE_FILE_PATH "%d.ini", i);

sau

{

format(filename, sizeof(filename), VEHICLE_FILE_PATH "v%d.ini", i);

if(!fexist(filename)) continue;

handle = fopen(filename, io_read);

while(fread(handle, line))

{

Sper sa mearga

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.