SA-MP Forums

Go Back   SA-MP Forums > Non-English > Languages > Română/Romanian

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 11/06/2014, 06:25 PM   #1
PabLoHenriique
Big Clucker
 
PabLoHenriique's Avatar
 
Join Date: Jan 2014
Location: Brazil
Posts: 129
Reputation: 1
Lightbulb [Ajutor] concesionar System.

Salut oameni care se bucurau de joacă o mămăligă, astăzi vreau să fie rapid și simplu. Am o mare utilitate singur sistem, plus că lipsește incomplet de "scriptfiles" și mai nu știu ce vreau să vă ajute să se stabilească acest sistem utilitar rece, deoarece nu are vehiculul la dealer arata la un client fantomă dealership nu va cumpăra un vehicul pe fiecare produs? și pentru că ajutor de la tine este un utilitar de sistem excelent este singur server Brasil New Life un server de mare care este on-line 4 ani, aici este ip: gta.brasil-nl.com.br:7777, nu va suparati dacă cineva obține acest sistem pentru că nu va primi consertarr apoi am presisar ajutor.

HTML Code:
enum cInfo
{
	cModel,
	Float:cLocationx,
	Float:cLocationy,
	Float:cLocationz,
	Float:cAngle,
	cColorOne,
	cColorTwo,
	cOwner[MAX_PLAYER_NAME],
	cDescription[MAX_PLAYER_NAME],
	cValue,
	cLicense,
	cRegistration,
	cOwned,
	cLock,
	ownedvehicle,
};

new CarInfo[504][cInfo];

public OnPlayerRename(name[],string[],playerid)
{
   {
			if (ckey != 255 && strcmp(playername,CarInfo[ckey][cOwner],true) == 0)
			{
				strmid(CarInfo[ckey][cOwner],name,0,strlen(name),255);
			}
			OnPropUpdate();
		}
}

public CheckOwner(playerid)
{
	if(IsPlayerConnected(playerid))
	{
	    for(new i = 1; i < sizeof(CarInfo); i++)
	    {
	        new playername[MAX_PLAYER_NAME];
	        GetPlayerName(playerid,playername,sizeof(playername));
	        if(strcmp(playername,CarInfo[i][cOwner],true)==0)
	        {
	            PlayerInfo[i][pCarro] = i;
				return i;
	        }
 		}
	}
	return 1;
}

public OnPlayerStateChange(playerid,newstate,oldstate)
{ 
		  for(new i = 1; i < sizeof(CarInfo); i++)
	    {
		    if(newcar == CarInfo[i][ownedvehicle])
			{
                new playername[MAX_PLAYER_NAME];
			    GetPlayerName(playerid,playername,sizeof(playername));
	    	    new tgt[256];
			    if(CarInfo[i][cOwned]==0)
			    {
			        TogglePlayerControllable(playerid,0);
			        format(string,sizeof(string),"~g~Dono: %s~w~~n~Veiculo: %s~n~Preco: %d~n~~r~/auto comprar~n~~w~ou /sair",CarInfo[i][cOwner],CarInfo[i][cDescription],CarInfo[i][cValue]);
					GameTextForPlayer(playerid,string,10000,5);
					return 1;
				}
    			if(strcmp(playername,CarInfo[i][cOwner],true) == 0)
    			{
    				format(tgt,sizeof(tgt),"Bem - Vindo ao seu veiculo %s , modelo: %s",CarInfo[i][cOwner],CarInfo[CheckOwner(playerid)][cDescription]);
    				SendClientMessage(playerid,COLOR_YELLOW,tgt);
    				return 1;
				}
				else
				{
					format(tgt,sizeof(tgt),"DONO: %s Modelo: %s",CarInfo[i][cOwner],CarInfo[i][cDescription]);
    				SendClientMessage(playerid,COLOR_YELLOW,tgt);
                	SendClientMessage(playerid,COLOR_WHITE,"Este carro nao e seu!");
					RemovePlayerFromVehicle(playerid);
					Descongelar(playerid);
    			}
		    }
	  }
	}
	
public LoadCar()
{
	new arrCoords[13][64];
	new strFromFile2[256];
	new File: file = fopen("Carros.cfg", io_read);
	if (file)
	{
		new idx = 0;
		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]);
			CarInfo[idx][cLicense] = strval(arrCoords[10]);
			CarInfo[idx][cOwned] = strval(arrCoords[11]);
			CarInfo[idx][cLock] = strval(arrCoords[12]);
			printf("CarInfo: %d Owner:%s LicensePlate %s",idx,CarInfo[idx][cOwner],CarInfo[idx][cLicense]);
			idx++;
		}
	}
	return 1;
}

public SaveCars()
{
	new idx;
	new File: file2;
	while (idx < sizeof(CarInfo))
	{
	    new coordsstring[256];
		format(coordsstring, sizeof(coordsstring), "%d,%f,%f,%f,%f,%d,%d,%s,%s,%d,%s,%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]);
		if(idx == 0)
		{
			file2 = fopen("Carros.cfg", io_write);
		}
		else
		{
			file2 = fopen("Carros.cfg", io_append);
		}
		fwrite(file2, coordsstring);
		idx++;
		fclose(file2);
	}
	return 1;
}

public OnGameModeInit()
{
  for(new i = 0; i < sizeof(CarInfo); i++)//Spawn carro para comprar
	{
		CarInfo[i][ownedvehicle] = CreateVehicle(CarInfo[i][cModel],CarInfo[i][cLocationx],CarInfo[i][cLocationy],CarInfo[i][cLocationz],CarInfo[i][cAngle],CarInfo[i][cColorOne],CarInfo[i][cColorTwo],300000);
	}
	SetTimer("CheckOwner",5000,1);
}

//--------------------------------------------------------------------//
		if(strcmp(tmp,"comprar",true) == 0)
		{
		    if(IsPlayerConnected(playerid))
		    {
                if(SBizzInfo[23][sbProdutos] == 0)
				{
					GameTextForPlayer(playerid,"~r~Falta Produto na empresa",5000,1);
					return 1;
				}
		        for(new i = 0; i < sizeof(CarInfo); i++)
		        {
					if(CarInfo[i][ownedvehicle] == vehid)
					{
						if(PlayerInfo[playerid][pCarro]!=255)
						{
							SendClientMessage(playerid,COLOR_WHITE, "Você ja possui um carro!");
							return 1;
						}
						if(PlayerInfo[playerid][pLevel] < 3)
						{
							SendClientMessage(playerid,COLOR_WHITE, "Você precisa ter nivel 3 para ter um carro!");
							return 1;
						}
						if(CarInfo[i][cOwned]==1)
						{
						    SendClientMessage(playerid,COLOR_WHITE, "Este carro ja tem dono!");
						    return 1;
						}
						if(GetPlayerMoney(playerid) >= CarInfo[i][cValue])
						{
							PlayerInfo[playerid][pCarro] = i;
							CarInfo[i][cOwned] = 1;
							GetPlayerName(playerid, sendername, sizeof(sendername));
							strmid(CarInfo[i][cOwner], sendername, 0, strlen(sendername), 999);
							GivePlayerMoneyEx(playerid,-CarInfo[i][cValue]);
							GameTextForPlayer(playerid,"Parabens Pelo Seu carro",5000,3);
							SendClientMessage(playerid,COLOR_WHITE, "Duvidas use /auto manual");
							TogglePlayerControllable(playerid,1);
							SBizzInfo[23][sbTill] += CarInfo[i][cValue];
                            SBizzInfo[23][sbProdutos]--;
							SaveCars();
							OnPropUpdate();
						    OnPlayerUpdate(playerid);
							return 1;
						}
						else
						{
							SendClientMessage(playerid,COLOR_WHITE, "Você nao tem dinheiro suficiente!");
							return 1;
						}
					}
				}
			}
			return 1;
		}
		if(strcmp(tmp,"vender",true) == 0)
		{
		    if(IsPlayerConnected(playerid))
			{
				GetPlayerName(playerid, playername, sizeof(playername));
				if(PlayerInfo[playerid][pCarro] == 255)
				{
					SendClientMessage(playerid,COLOR_WHITE,"Você não tem um veiculo!");
					return 1;
				}
				if(Concessionaria(playerid))
				{
				  if(PlayerInfo[playerid][pCarro] != 0 && strcmp(playername, CarInfo[PlayerInfo[playerid][pCarro]][cOwner], true) == 0)
				  {
                     new carro = PlayerInfo[playerid][pCarro];
					 CarInfo[carro][cOwned] = 0;
					 GetPlayerName(playerid, sendername, sizeof(sendername));
					 strmid(CarInfo[carro][cOwner], "Concessionaria", 0, strlen("Concessionaria"), 999);
					 GivePlayerMoneyEx(playerid,CarInfo[carro][cValue]/2);
					 SBizzInfo[23][sbTill] -= CarInfo[carro][cValue]/2;
					 format(string, sizeof(string), "~w~Parabens, Voce vendeu o carro por: ~n~~g~%d", CarInfo[carro][cValue]/2);
					 GameTextForPlayer(playerid, string, 10000, 3);
					 RemovePlayerFromVehicle(playerid);
					 TogglePlayerControllable(playerid, 1);
					 PlayerInfo[playerid][pCarro] = 255;
					 SaveCars();
                     OnPropUpdate();
					 OnPlayerUpdate(playerid);
					 return 1;
				  }
				}
				else
				{
                    SendClientMessage(playerid,COLOR_WHITE,"Voce tem que estar na concessionaria para vender o seu veiculo!");
					return 1;
				}
			}
			return 1;
		}
//--------------------------------------------------------------------//
  if(strcmp(cmd,"/AdmVcarro",true) == 0)
	{
	    if(IsPlayerConnected(playerid))
		{
			GetPlayerName(playerid,playername,sizeof(playername));
			tmp = strtok(cmdtext,idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid,COLOR_GRAD1,"USE: /AdmVcarro [ID do carro]");
				return 1;
			}
			new carro = strval(tmp);
			if(PlayerInfo[playerid][pAdmin] >= 1300)
			{
				CarInfo[carro][cOwned] = 0;
				strmid(CarInfo[carro][cOwner],"Concessionaria",0,strlen("Concessionaria"),255);
				format(string,sizeof(string),"~w~Voce vendeu o carro");
				GameTextForPlayer(playerid,string,10000,3);
				OnPropUpdate();
				return 1;
			}
			else
			{
				SendClientMessage(playerid,COLOR_WHITE,"Você não é um administrador!");
			}
		}
		return 1;
	}
PabLoHenriique is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 05:34 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.