Jump to content
  • 0

Comanda


xSeNz0o

Question

Problema intalnita (descriere): Cand dau /lock mi se incurca toate masinile pe care le detin ingame.
Ero(area / rile) / warning-(ul / urile): Nu stiu cum sa rezolv sa fac dintr-o singura comanda mai multe..Ca de ex: /lockmoto(sa se inchida/deschida doar motocicleta)/lock(sa se inchida/deschida masina pers1)/lock2(sa se inchida/deschida masina pers2) /lockab(sa se inchida/deschida avionul/barca) /lockrent(sa se inchida/deschida masina de rent)..Am incercat sa modific si eu comenzile sa le fac separat dar nu mi-a iesit..Sper ca puteti sa ma ajutati..
Liniile de cod / sursa / script-ul(obligatoriu):

if(strcmp(cmd, "/lock", true) == 0)
	{
            if(SwitchKey[playerid] == 5)
		    {
			    new carid = PlayerData[playerid][pPcarkey1];
			    if(CarData[carid][cLockk] == 0)
			    {
			    	GameTextForPlayer(playerid, "~w~Masina Personala2 ~r~Incuiat", 5000, 5);
					PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
					CarData[carid][cLockk] = 1;
					VehLocked[carid+PreVehicle] = 1;
					GetVehicleParamsEx(carid+PreVehicle,engine,lights,alarm,doors,bonnet,boot,objective);
					SetVehicleParamsEx(carid+PreVehicle,engine,lights,alarm,1,bonnet,boot,objective);
			        return 1;

				}
				else
				{
				    GameTextForPlayer(playerid, "~w~Masina Personala2 ~g~Descuiat", 5000, 5);
					PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
				    CarData[carid][cLockk] = 0;
				    VehLocked[carid+PreVehicle] = 0;
					GetVehicleParamsEx(carid+PreVehicle,engine,lights,alarm,doors,bonnet,boot,objective);
					SetVehicleParamsEx(carid+PreVehicle,engine,lights,alarm,0,bonnet,boot,objective);
			        return 1;
				}
			}
			if(SwitchKey[playerid] == 1)
		    {
			    new carid = PlayerData[playerid][pPcarkey];
			    if(CarData[carid][cLockk] == 0)
			    {
			    	GameTextForPlayer(playerid, "~w~Masina Personala ~r~Incuiat", 5000, 5);
					PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
					CarData[carid][cLockk] = 1;
					VehLocked[carid+PreVehicle] = 1;
					GetVehicleParamsEx(carid+PreVehicle,engine,lights,alarm,doors,bonnet,boot,objective);
					SetVehicleParamsEx(carid+PreVehicle,engine,lights,alarm,1,bonnet,boot,objective);
			        return 1;

				}
				else
				{
				    GameTextForPlayer(playerid, "~w~Masina Personala ~g~Descuiat", 5000, 5);
					PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
				    CarData[carid][cLockk] = 0;
				    VehLocked[carid+PreVehicle] = 0;
					GetVehicleParamsEx(carid+PreVehicle,engine,lights,alarm,doors,bonnet,boot,objective);
					SetVehicleParamsEx(carid+PreVehicle,engine,lights,alarm,0,bonnet,boot,objective);
			        return 1;
				}
			}
			if(SwitchKey[playerid] == 2)
		    {
			    new carid = PlayerData[playerid][pPcarkey2];
			    if(CarData[carid][cLockk] == 0)
			    {
			    	GameTextForPlayer(playerid, "~w~Motocicleta Personala ~r~Incuiat", 5000, 5);
					PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
					CarData[carid][cLockk] = 1;
					VehLocked[carid+PreVehicle] = 1;
					GetVehicleParamsEx(carid+PreVehicle,engine,lights,alarm,doors,bonnet,boot,objective);
					SetVehicleParamsEx(carid+PreVehicle,engine,lights,alarm,1,bonnet,boot,objective);
			        return 1;

				}
				else
				{
				    GameTextForPlayer(playerid, "~w~Motocicleta Personala ~g~Descuiat", 5000, 5);
					PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
				    CarData[carid][cLockk] = 0;
				    VehLocked[carid+PreVehicle] = 0;
					GetVehicleParamsEx(carid+PreVehicle,engine,lights,alarm,doors,bonnet,boot,objective);
					SetVehicleParamsEx(carid+PreVehicle,engine,lights,alarm,0,bonnet,boot,objective);
			        return 1;
				}
			}
			if(SwitchKey[playerid] == 3)
		    {
			    new carid = PlayerData[playerid][pPcarkey3];
			    if(CarData[carid][cLockk] == 0)
			    {
			    	GameTextForPlayer(playerid, "~w~Barca/Avionul ~r~Incuiat", 5000, 5);
					PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
					CarData[carid][cLockk] = 1;
					VehLocked[carid+PreVehicle] = 1;
					GetVehicleParamsEx(carid+PreVehicle,engine,lights,alarm,doors,bonnet,boot,objective);
					SetVehicleParamsEx(carid+PreVehicle,engine,lights,alarm,1,bonnet,boot,objective);
			        return 1;

				}
				else
				{
				    GameTextForPlayer(playerid, "~w~Barca/Avionul ~g~Descuiat", 5000, 5);
					PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
				    CarData[carid][cLockk] = 0;
				    VehLocked[carid+PreVehicle] = 0;
					GetVehicleParamsEx(carid+PreVehicle,engine,lights,alarm,doors,bonnet,boot,objective);
					SetVehicleParamsEx(carid+PreVehicle,engine,lights,alarm,0,bonnet,boot,objective);
			        return 1;
				}
			}
			else if(SwitchKey[playerid] == 4)
			{
			    new carid = HireCar[playerid];
			    if(CarLocked[HireCar[playerid]] == 0)
			    {
			    	GameTextForPlayer(playerid, "~w~Masina Inciriata ~r~Incuiat", 5000, 5);
					PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
					CarLocked[HireCar[playerid]] = 1;
					VehLocked[carid] = 1;
					GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
					SetVehicleParamsEx(carid,engine,lights,alarm,1,bonnet,boot,objective);
			        return 1;

				}
				else
				{
				    GameTextForPlayer(playerid, "~w~Masina Inchiriata ~g~Descuiat", 5000, 5);
					PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
				    CarLocked[HireCar[playerid]] = 0;
				    VehLocked[carid] = 0;
					GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
					SetVehicleParamsEx(carid,engine,lights,alarm,0,bonnet,boot,objective);
			        return 1;
				}
			}
			else if(PlayerData[playerid][pPcarkey] != 999)
			{
			    new carid = PlayerData[playerid][pPcarkey];
			    if(CarData[carid][cLockk] == 0)
			    {
			    	GameTextForPlayer(playerid, "~w~Masina Personala ~n~~r~Incuiata", 5000, 5);
					PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
					CarData[carid][cLockk] = 1;
                    VehLocked[carid+PreVehicle] = 1;
                    GetVehicleParamsEx(carid+PreVehicle,engine,lights,alarm,doors,bonnet,boot,objective);
					SetVehicleParamsEx(carid+PreVehicle,engine,lights,alarm,1,bonnet,boot,objective);
			        return 1;

				}
				else
				{
				    GameTextForPlayer(playerid, "~w~Masina Personala ~n~~g~Descuiata", 5000, 5);
					PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
				    CarData[carid][cLockk] = 0;
				    VehLocked[carid+PreVehicle] = 0;
					GetVehicleParamsEx(carid+PreVehicle,engine,lights,alarm,doors,bonnet,boot,objective);
					SetVehicleParamsEx(carid+PreVehicle,engine,lights,alarm,0,bonnet,boot,objective);
			        return 1;
				}
			}
			else if(PlayerData[playerid][pPcarkey1] != 999)
			{
			    new carid = PlayerData[playerid][pPcarkey1];
			    if(CarData[carid][cLockk] == 0)
			    {
			    	GameTextForPlayer(playerid, "~w~Masina Personala2 ~n~~r~Incuiata", 5000, 5);
					PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
					CarData[carid][cLockk] = 1;
                    VehLocked[carid+PreVehicle] = 1;
                    GetVehicleParamsEx(carid+PreVehicle,engine,lights,alarm,doors,bonnet,boot,objective);
					SetVehicleParamsEx(carid+PreVehicle,engine,lights,alarm,1,bonnet,boot,objective);
			        return 1;

				}
				else
				{
				    GameTextForPlayer(playerid, "~w~Masina Personala2 ~n~~g~Descuiata", 5000, 5);
					PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
				    CarData[carid][cLockk] = 0;
				    VehLocked[carid+PreVehicle] = 0;
					GetVehicleParamsEx(carid+PreVehicle,engine,lights,alarm,doors,bonnet,boot,objective);
					SetVehicleParamsEx(carid+PreVehicle,engine,lights,alarm,0,bonnet,boot,objective);
			        return 1;
				}
			}
			else if(PlayerData[playerid][pPcarkey2] != 999)
			{
			    new carid = PlayerData[playerid][pPcarkey2];
			    if(CarData[carid][cLockk] == 0)
			    {
			    	GameTextForPlayer(playerid, "~w~Motocicleta Personala ~r~--", 5000, 5);
					PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
					CarData[carid][cLockk] = 1;
                    VehLocked[carid+PreVehicle] = 1;
                    GetVehicleParamsEx(carid+PreVehicle,engine,lights,alarm,doors,bonnet,boot,objective);
					SetVehicleParamsEx(carid+PreVehicle,engine,lights,alarm,1,bonnet,boot,objective);
			        return 1;

				}
				else
				{
				    GameTextForPlayer(playerid, "~w~Motocicleta Personala ~g~--", 5000, 6);
					PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
				    CarData[carid][cLockk] = 0;
				    VehLocked[carid+PreVehicle] = 0;
					GetVehicleParamsEx(carid+PreVehicle,engine,lights,alarm,doors,bonnet,boot,objective);
					SetVehicleParamsEx(carid+PreVehicle,engine,lights,alarm,0,bonnet,boot,objective);
			        return 1;
				}
			}
			else if(PlayerData[playerid][pPcarkey3] != 999)
			{
			    new carid = PlayerData[playerid][pPcarkey3];
			    if(CarData[carid][cLockk] == 0)
			    {
			    	GameTextForPlayer(playerid, "~w~Barca/Avion ~r~--", 5000, 5);
					PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
					CarData[carid][cLockk] = 1;
                    VehLocked[carid+PreVehicle] = 1;
                    GetVehicleParamsEx(carid+PreVehicle,engine,lights,alarm,doors,bonnet,boot,objective);
					SetVehicleParamsEx(carid+PreVehicle,engine,lights,alarm,1,bonnet,boot,objective);
			        return 1;

				}
				else
				{
				    GameTextForPlayer(playerid, "~w~Barca/Avion ~g~--", 5000, 5);
					PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
				    CarData[carid][cLockk] = 0;
				    VehLocked[carid+PreVehicle] = 0;
					GetVehicleParamsEx(carid+PreVehicle,engine,lights,alarm,doors,bonnet,boot,objective);
					SetVehicleParamsEx(carid+PreVehicle,engine,lights,alarm,0,bonnet,boot,objective);
			        return 1;
				}
			}
			else if(HireCar[playerid] != 299)
			{
			    if(CarLocked[HireCar[playerid]] == 0)
			    {
			    	GameTextForPlayer(playerid, "~w~Masina Inchiriata ~n~~r~Incuiata", 5000, 5);
					PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
					CarLocked[HireCar[playerid]] = 1;
			        VehLocked[HireCar[playerid]] = 1;
			        GetVehicleParamsEx(HireCar[playerid],engine,lights,alarm,doors,bonnet,boot,objective);
					SetVehicleParamsEx(HireCar[playerid],engine,lights,alarm,1,bonnet,boot,objective);
			        return 1;

				}
				else
				{
				    GameTextForPlayer(playerid, "~w~Masina Inchiriata ~n~~g~Descuiata", 5000, 5);
					PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
				    CarLocked[HireCar[playerid]] = 0;
				    VehLocked[HireCar[playerid]] = 0;
					GetVehicleParamsEx(HireCar[playerid],engine,lights,alarm,doors,bonnet,boot,objective);
					SetVehicleParamsEx(HireCar[playerid],engine,lights,alarm,1,bonnet,boot,objective);
			        return 1;
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_PURPLE, "Nu ai cheile la vre-o masina !");
	            return 1;
			}
	}

Imagini / Video (optional): -
Ati incercat sa rezolvati singur?: Da si chiar nu imi dau seama..Va implor ajutatima..

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0
new vID=0,Float:vPos[3],Float:pPos[3];
GetPlayerPos(playerid,pPos[0],pPos[1],pPos[2]);
while((vID < MAX_VEHICLES))
{
	vID++;
	GetVehiclePos(vID,vPos[0],vPos[1],vPos[2]);
	if((floatabs(pPos[0]-vPos[0]) < 7.0) && (floatabs(pPos[1]-vPos[1]) < 7.0) && (floatabs(pPos[2]-vPos[2]) < 7.0))
	{
	    if(vID == PlayerData[playerid][pPcarkey])
	    {
	        if(CarData[PlayerData[playerid][pPcarkey]][cLockk] == 0)
	        {
	            //Inchizi masina
	        }
	        else
	        {
	            //Deschizi masina
	        }
	    }
	}
}

Ceva de acest gen trebuie sa faci :) , cum scrie si la semnatura mea , "In topicuri , nu mai dau scripturi creeate de mine , deoarece asa nu se va invata absolut nimic. "

Link to comment
Share on other sites

  • 0

new vID=0,Float:vPos[3],Float:pPos[3];
GetPlayerPos(playerid,pPos[0],pPos[1],pPos[2]);
while((vID < MAX_VEHICLES))
{
	vID++;
	GetVehiclePos(vID,vPos[0],vPos[1],vPos[2]);
	if((floatabs(pPos[0]-vPos[0]) < 7.0) && (floatabs(pPos[1]-vPos[1]) < 7.0) && (floatabs(pPos[2]-vPos[2]) < 7.0))
	{
	    if(vID == PlayerData[playerid][pPcarkey])
	    {
	        if(CarData[PlayerData[playerid][pPcarkey]][cLockk] == 0)
	        {
	            //Inchizi masina
	        }
	        else
	        {
	            //Deschizi masina
	        }
	    }
	}
}

Ceva de acest gen trebuie sa faci :) , cum scrie si la semnatura mea , "In topicuri , nu mai dau scripturi creeate de mine , deoarece asa nu se va invata absolut nimic. "

 

Imi da pwno livrary has stopped working..

 

	if(strcmp(cmd, "/lock", true) == 0)
	{
		new vID=0,Float:vPos[3],Float:pPos[3];
		GetPlayerPos(playerid,pPos[0],pPos[1],pPos[2]);
		while((vID < MAX_VEHICLES))
		{
			vID++;
			GetVehiclePos(vID,vPos[0],vPos[1],vPos[2]);
			if((floatabs(pPos[0]-vPos[0]) < 7.0) && (floatabs(pPos[1]-vPos[1]) < 7.0) && (floatabs(pPos[2]-vPos[2]) < 7.0))
			{
			    if(vID == PlayerData[playerid][pPcarkey])
			    {
			        if(CarData[PlayerData[playerid][pPcarkey]][cLockk] == 0)
			        {
   			    	GameTextForPlayer(playerid, "~r~Locked", 5000, 5);
					PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
					CarData[vID][cLockk] = 1;
					VehLocked[vID+PreVehicle] = 1;
					GetVehicleParamsEx(vID+PreVehicle,engine,lights,alarm,doors,bonnet,boot,objective);
					SetVehicleParamsEx(vID+PreVehicle,engine,lights,alarm,1,bonnet,boot,objective);
			        return 1;
			        }
			        else
			        {
   				    GameTextForPlayer(playerid, "~g~Unlocked", 5000, 5);
					PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
				    CarData[vID][cLockk] = 0;
				    VehLocked[vID+PreVehicle] = 0;
					GetVehicleParamsEx(vID+PreVehicle,engine,lights,alarm,doors,bonnet,boot,objective);
					SetVehicleParamsEx(vID+PreVehicle,engine,lights,alarm,0,bonnet,boot,objective);
			        return 1;
			        }
			    }
			}
		}
       }

Edited by xSeNz0o
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.