Jump to content
  • 0

Problema masini personale.


Bogdan's

Question

Problema intalnita (descriere): Dupa ce dau restart la server masinile nu mai sunt pe numele meu,ci sunt free.Dar la /v tot apar ca si cum ar fi ale mele.
Ero(area / rile) / warning-(ul / urile): -
Liniile de cod / sursa / script-ul(obligatoriu): Spuneti-mi ce sa va dau ca nu stiu.
Imagini / Video (optional): -
Ati incercat sa rezolvati singur?: Nu stiu de unde ar putea fi problema.

Folosesc modul Quit GF.

Link to comment
Share on other sites

12 answers to this question

Recommended Posts

  • 0
2 hours ago, Bogdan's said:

Un UP?

Platesc pentru cine ma ajuta!

Add andrei.dan49 si te ajut.

**********************************

Servicii Scripting de calitate:

*********************************

Future Project: ExpertGame

*********************************

Link to comment
Share on other sites

  • 0
9 minutes ago, Bogdan's said:

Cum m-ai ajutat si cu sistemul de /rob nu?Altcineva?

Ce sistem de rob :?

În fine, verifica dacă se extrage 'userid' la load car

**********************************

Servicii Scripting de calitate:

*********************************

Future Project: ExpertGame

*********************************

Link to comment
Share on other sites

  • 0
PUBLIC: LoadCar()
{
	new arrCoords[31][64];
	new strFromFile2[256];
	new File: file = fopen("personalcars.cfg", io_read);
	if (file)
	{
		new idx = carsonserver;
		while (idx < sizeof(CarInfo))
		{
			fread(file, strFromFile2);
			split(strFromFile2, arrCoords, ',');
			CarInfo[idx][cModel] = strval(arrCoords[0]);
			CarInfo[idx][cLocationx] = floatstr(arrCoords[1]);
			CarInfo[idx][cLocationy] = floatstr(arrCoords[2]);
			CarInfo[idx][cLocationz] = floatstr(arrCoords[3]);
			CarInfo[idx][cAngle] = floatstr(arrCoords[4]);
			CarInfo[idx][cColorOne] = strval(arrCoords[5]);
			CarInfo[idx][cColorTwo] = strval(arrCoords[6]);
			strmid(CarInfo[idx][cOwner], arrCoords[7], 0, strlen(arrCoords[7]), 255);
			strmid(CarInfo[idx][cDescription], arrCoords[8], 0, strlen(arrCoords[8]), 255);
			CarInfo[idx][cValue] = strval(arrCoords[9]);
			strmid(CarInfo[idx][cLicense], arrCoords[10], 0, strlen(arrCoords[10]), 255);
			CarInfo[idx][cOwned] = strval(arrCoords[11]);
			CarInfo[idx][cLock] = strval(arrCoords[12]);
			CarInfo[idx][mod1] = strval(arrCoords[13]);
			CarInfo[idx][mod2] = strval(arrCoords[14]);
			CarInfo[idx][mod3] = strval(arrCoords[15]);
			CarInfo[idx][mod4] = strval(arrCoords[16]);
			CarInfo[idx][mod5] = strval(arrCoords[17]);
			CarInfo[idx][mod6] = strval(arrCoords[18]);
			CarInfo[idx][mod7] = strval(arrCoords[19]);
			CarInfo[idx][mod8] = strval(arrCoords[20]);
			CarInfo[idx][mod9] = strval(arrCoords[21]);
			CarInfo[idx][mod10] = strval(arrCoords[22]);
			CarInfo[idx][mod11] = strval(arrCoords[23]);
			CarInfo[idx][mod12] = strval(arrCoords[24]);
			CarInfo[idx][mod13] = strval(arrCoords[25]);
			CarInfo[idx][mod14] = strval(arrCoords[26]);
			CarInfo[idx][mod15] = strval(arrCoords[27]);
			CarInfo[idx][mod16] = strval(arrCoords[28]);
			CarInfo[idx][mod17] = strval(arrCoords[29]);
			CarInfo[idx][paintjob] = strval(arrCoords[30]);
			printf("CarInfo: %d Owner:%s LicensePlate %s",idx,CarInfo[idx][cOwner],CarInfo[idx][cLicense]);
			idx++;
		}
	}
	return 1;
}

 

Link to comment
Share on other sites

  • 0

Fa o variabilă 'userid' care să stocheza id.ul playerului sau numele acestuia.

**********************************

Servicii Scripting de calitate:

*********************************

Future Project: ExpertGame

*********************************

Link to comment
Share on other sites

  • 0
2 hours ago, DaEdRiC-FoX said:

Fa o variabilă 'userid' care să stocheza id.ul playerului sau numele acestuia.

Este deja "cOwner" .

Functia LoadCar ai bagat-o la OnGamemodeInit ?

In folder-ul scriptfiles ai verificat daca ai fisierul 'personalcars.cfg' ? Daca nu-l ai , creeaza-l .

Link to comment
Share on other sites

  • 0

Da,am.

La OnPlayerStateChange am:

new string[256];
	new name[MAX_PLAYER_NAME], Float:x,Float:y,Float:z;
	new newcar = GetPlayerVehicleID(playerid);
	GetPlayerPos(playerid,x,y,z);
	GetPlayerName(playerid,name,sizeof(name));
		new vehicle = GetPlayerVehicleID(playerid);
	if(newstate == PLAYER_STATE_DRIVER)
	{
		if(IsAnOwnableCar(newcar))
		{
		    if(CarInfo[newcar][cOwned]==1)
		    {
		        format(string,sizeof(string),"* Vehiculul privat al jucatorului {ffffff}%s",CarInfo[newcar][cOwner]);
				SendClientMessage(playerid, COLOR_ORANGE, string);
				if(PlayerInfo[playerid][pPcarkey] == vehicle) { }
				else if(PlayerInfo[playerid][pPcarkey2] == vehicle) { }
				else if(PlayerInfo[playerid][pPcarkey3] == vehicle) { }
				else
				{
				    RemovePlayerFromVehicle(playerid);
				    SendClientMessage(playerid, COLOR_GREY, "* Nu detii keyle acestei masini.");
				}
		    }
		}
	}

Dar dupa Restart la server nu mai apare ca si cum ar fi masina mea,drept urmare nu apare ca am masina asta.

Adica nu apare ca ''Vehiculul privat al jucatorului X"

Edited by Bogdan's
Link to comment
Share on other sites

  • 0

Asta?

PUBLIC: OnCarUpdate()
{
	new idx;
	new File: file2;
	idx = carsonserver;
 	while (idx < sizeof(CarInfo))
	{
		new coordsstring[256];
		format(coordsstring, sizeof(coordsstring), "%d,%f,%f,%f,%f,%d,%d,%s,%s,%d,%s,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
		CarInfo[idx][cModel],
		CarInfo[idx][cLocationx],
		CarInfo[idx][cLocationy],
		CarInfo[idx][cLocationz],
		CarInfo[idx][cAngle],
		CarInfo[idx][cColorOne],
		CarInfo[idx][cColorTwo],
		CarInfo[idx][cOwner],
		CarInfo[idx][cDescription],
		CarInfo[idx][cValue],
		CarInfo[idx][cLicense],
		CarInfo[idx][cOwned],
		CarInfo[idx][cLock],
		CarInfo[idx][mod1],
		CarInfo[idx][mod2],
		CarInfo[idx][mod3],
		CarInfo[idx][mod4],
		CarInfo[idx][mod5],
		CarInfo[idx][mod6],
		CarInfo[idx][mod7],
		CarInfo[idx][mod8],
		CarInfo[idx][mod9],
		CarInfo[idx][mod10],
		CarInfo[idx][mod11],
		CarInfo[idx][mod12],
		CarInfo[idx][mod13],
		CarInfo[idx][mod14],
		CarInfo[idx][mod15],
		CarInfo[idx][mod16],
		CarInfo[idx][mod17],
		CarInfo[idx][paintjob]);
		if(idx == carsonserver)
		{
			file2 = fopen("personalcars.cfg", io_write);
		}
		else
		{
			file2 = fopen("personalcars.cfg", io_append);
		}
		fwrite(file2, coordsstring);
		idx++;
		fclose(file2);
	}
	return 1;
}

 

Link to comment
Share on other sites

  • 0

Totul pare in regula la prima vedere, masina cum se creaza nu am vazut niciunde createvehicle model x y z  a 

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 0
if(listitem==0)
                {
                    if (GetPlayerMoney(playerid) >= 65000)
                    {
                        GivePlayerMoney(playerid,-65000); //Phoenix
                        //new Float:X,Float:Y,Float:Z; GetPlayerPos(playerid, X,Y,Z);
                        new thiscar = CreateVehicle(603,307.1591,-1481.4534,24.3208,234.5908,0,0,99999999);
                        if(PlayerInfo[playerid][pPcarkey] == -1) { PlayerInfo[playerid][pPcarkey] = thiscar; }
                        else if(PlayerInfo[playerid][pPcarkey2] == -1) { PlayerInfo[playerid][pPcarkey2] = thiscar; }
                        else if(PlayerInfo[playerid][pPcarkey3] == -1) { PlayerInfo[playerid][pPcarkey3] = thiscar; }
                        else { return 1; }
                        CarInfo[thiscar][cOwned] = 1; CarInfo[thiscar][cModel] = 603; CarInfo[thiscar][cColorOne] = 0; CarInfo[thiscar][cColorTwo] = 0;
                        CarInfo[thiscar][cLocationx] = 307.1591; CarInfo[thiscar][cLocationy] = -1481.4534; CarInfo[thiscar][cLocationz] = 24.3208; CarInfo[thiscar][cAngle] = 234.5908;
                        CarInfo[thiscar][cValue] = 65000; CarInfo[thiscar][cLock] = 0; CarInfo[thiscar][paintjob] = -1;
                        PutPlayerInVehicle(playerid,thiscar,0); GetPlayerName(playerid, sendername, sizeof(sendername));
                        strmid(CarInfo[thiscar][cOwner], sendername, 0, strlen(sendername), 999); PlayerPlayMusic(playerid);
                        GameTextForPlayer(playerid, "~w~Felicitari~n~Nu uita sa o parchezi cu /v park!", 5000, 3);
                        SendClientMessage(playerid, COLOR_GRAD2, "Felicitari ti-ai cumparat o masina noua!");
                        SendClientMessage(playerid, COLOR_GRAD2, "Scrie /v pentru manualul masini!");
                        format(CarInfo[thiscar][cDescription], 32, "Phoenix"); OnCarUpdate(); SavePlayerData(playerid);
                    }
                    else { SendClientMessage(playerid, COLOR_WHITE, "   Nu ai suficienti bani pentru a cumpara masina aceasta !"); }
                }

Si asa mai departe.

 

Se pare ca am rezolvat cumva. Multumesc de ajutor oricum!

Edited by Bogdan's
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.