Jump to content
  • 0

Question

Posted

Am si eu comanda /buyinsurance pentru masini pers / motoare pers si cand intru pe server si tastez imi zice ca , comanda nu este buna dar merge cand am si masina pers si motor personal cum fac sa mearga daca am doar moto sau doar masina?

if(strcmp(cmd,"/buyinsurance",true)==0)
    {
        if(IsPlayerConnected(playerid))
	    {
           	new x_nr[256];
           	new carid = PlayerInfo[playerid][pCar];
           	new motoid = PlayerInfo[playerid][pMoto];
           	new inscarpricee = CarInfo[carid][cInscarprice];
           	new insmotopricee = CarInfo[motoid][cInsmotoprice];
		  	x_nr = strtok(cmdtext, idx);
		   	if(!strlen(x_nr))
		  	{
				 SCM(playerid, COLOR_WHITE, "Type: /buyinsurance [car or moto]");
		   	     return 1;
		  	}
			if(strcmp(x_nr,"car",true) == 0)
            {
               	if(PlayerInfo[playerid][pCar] != 999)
	       		{
					if (CarInfo[carid][cInsurancecar] == 0)
              		{
                        if(GetPlayerMoney(playerid) >= inscarpricee)
		      			{
                   			CarInfo[carid][cInsurancecar] = 1;
                   			format(string, sizeof(string), "Car Insurance purchased for $%s !", FormatNumber(inscarpricee));
                   		    SCM(playerid, COLOR_CRS2, string);
                   			GivePlayerMoney(playerid, - inscarpricee);
                   			PlayerPlaySound(playerid, 1054, 0.0, 0.0, 10.0)
                   			SaveCarCoords();
                       		OnPropUpdate();
               			}
                        else
                		SCM(playerid, COLOR_GREY, "** You don't have enough cash with you !");
                		PlayerPlaySound(playerid, 1055, 0.0, 0.0, 10.0)
                   		return 1;
                   	}
                   	else if (CarInfo[carid][cInsurancecar] == 1)
              		{
                        if(GetPlayerMoney(playerid) >= inscarpricee)
		      			{
                   			CarInfo[carid][cInsurancecar] = 2;
                   			format(string, sizeof(string), "Car Insurance purchased for $%s !", FormatNumber(inscarpricee));
                   		    SCM(playerid, COLOR_CRS2, string);
                   			GivePlayerMoney(playerid, - inscarpricee);
                   			PlayerPlaySound(playerid, 1054, 0.0, 0.0, 10.0)
                   			SaveCarCoords();
                       		OnPropUpdate();
               			}
                        else
                		SCM(playerid, COLOR_GREY, "** You don't have enough cash with you !");
                		PlayerPlaySound(playerid, 1055, 0.0, 0.0, 10.0)
                   		return 1;
                   	}
                   	else if (CarInfo[carid][cInsurancecar] == 2)
              		{
                        if(GetPlayerMoney(playerid) >= inscarpricee)
		      			{
                   			CarInfo[carid][cInsurancecar] = 3;
                   			format(string, sizeof(string), "Car Insurance purchased for $%s !", FormatNumber(inscarpricee));
                   		    SCM(playerid, COLOR_CRS2, string);
                   		    PlayerPlaySound(playerid, 1054, 0.0, 0.0, 10.0)
                   			GivePlayerMoney(playerid, - inscarpricee);
                   			SaveCarCoords();
                       		OnPropUpdate();
               			}
                        else
                		SCM(playerid, COLOR_GREY, "** You don't have enough cash with you !");
                		PlayerPlaySound(playerid, 1055, 0.0, 0.0, 10.0)
                   		return 1;
                   	}
                   	else if (CarInfo[carid][cInsurancecar] == 3)
              		{
                        if(GetPlayerMoney(playerid) >= inscarpricee)
		      			{
                   			CarInfo[carid][cInsurancecar] = 4;
                   			format(string, sizeof(string), "Car Insurance purchased for $%s !", FormatNumber(inscarpricee));
                   		    SCM(playerid, COLOR_CRS2, string);
                   			GivePlayerMoney(playerid, - inscarpricee);
                   			PlayerPlaySound(playerid, 1054, 0.0, 0.0, 10.0)
                   			SaveCarCoords();
                       		OnPropUpdate();
               			}
                        else
                		SCM(playerid, COLOR_GREY, "** You don't have enough cash with you !");
                		PlayerPlaySound(playerid, 1055, 0.0, 0.0, 10.0)
                   		return 1;
                   	}
                   	else if (CarInfo[carid][cInsurancecar] == 4)
              		{
                        if(GetPlayerMoney(playerid) >= inscarpricee)
		      			{
                   			CarInfo[carid][cInsurancecar] = 5;
                   			format(string, sizeof(string), "Car Insurance purchased for $%s !", FormatNumber(inscarpricee));
                   		    SCM(playerid, COLOR_CRS2, string);
                   			GivePlayerMoney(playerid, - inscarpricee);
                   			PlayerPlaySound(playerid, 1054, 0.0, 0.0, 10.0)
                   			SaveCarCoords();
                       		OnPropUpdate();
               			}
                        else
                        PlayerPlaySound(playerid, 1055, 0.0, 0.0, 10.0)
                		SCM(playerid, COLOR_GREY, "** You don't have enough cash with you !");
                   		return 1;
                   	}
                   	else
	                SCM(playerid, COLOR_GREY, "** You arleady have five insurances for your car !");
	                PlayerPlaySound(playerid, 1055, 0.0, 0.0, 10.0)
	                return 1;
	            }
				else
				SCM(playerid, COLOR_GREY, "** You don't own a car !");
				PlayerPlaySound(playerid, 1055, 0.0, 0.0, 10.0)
				return 1;
	        }
			else if(strcmp(x_nr,"moto",true) == 0)
            {
                if(PlayerInfo[playerid][pMoto] != 9999)
	           	{
                    if (CarInfo[motoid][cInsurancemoto] == 0)
                   	{
                   		if(GetPlayerMoney(playerid) >= insmotopricee)
			       		{
                       		CarInfo[motoid][cInsurancemoto] = 1;
                       		GivePlayerMoney(playerid, - insmotopricee);
                       		format(string, sizeof(string), "Moto Insurance purchased for $%s !", FormatNumber(insmotopricee));
                   		    SCM(playerid, COLOR_CRS2, string);
                   		    PlayerPlaySound(playerid, 1054, 0.0, 0.0, 10.0)
                       		SaveCarCoords();
                       		OnPropUpdate();
                   		}
                   		else
                   		SCM(playerid, COLOR_GREY, "** You don't have enough cash with you !");
                   		PlayerPlaySound(playerid, 1055, 0.0, 0.0, 10.0)
                   		return 1;
                   	}
                   	else if (CarInfo[motoid][cInsurancemoto] == 1)
                   	{
                   		if(GetPlayerMoney(playerid) >= insmotopricee)
			       		{
                       		CarInfo[motoid][cInsurancemoto] = 2;
                       		GivePlayerMoney(playerid, - insmotopricee);
                       		format(string, sizeof(string), "Moto Insurance purchased for $%s !", FormatNumber(insmotopricee));
                   		    SCM(playerid, COLOR_CRS2, string);
                   		    PlayerPlaySound(playerid, 1054, 0.0, 0.0, 10.0)
                       		SaveCarCoords();
                       		OnPropUpdate();
                   		}
                   		else
                   		SCM(playerid, COLOR_GREY, "** You don't have enough cash with you !");
                   		PlayerPlaySound(playerid, 1055, 0.0, 0.0, 10.0)
                   		return 1;
                   	}
                   	else if (CarInfo[motoid][cInsurancemoto] == 2)
                   	{
                   		if(GetPlayerMoney(playerid) >= insmotopricee)
			       		{
                       		CarInfo[motoid][cInsurancemoto] = 3;
                       		GivePlayerMoney(playerid, - insmotopricee);
                       		format(string, sizeof(string), "Moto Insurance purchased for $%s !", FormatNumber(insmotopricee));
                   		    SCM(playerid, COLOR_CRS2, string);
                   		    PlayerPlaySound(playerid, 1054, 0.0, 0.0, 10.0)
                       		SaveCarCoords();
                       		OnPropUpdate();
                   		}
                   		else
                   		SCM(playerid, COLOR_GREY, "** You don't have enough cash with you !");
                   		PlayerPlaySound(playerid, 1055, 0.0, 0.0, 10.0)
                   		return 1;
                   	}
                   	else if (CarInfo[motoid][cInsurancemoto] == 3)
                   	{
                   		if(GetPlayerMoney(playerid) >= insmotopricee)
			       		{
                       		CarInfo[motoid][cInsurancemoto] = 4;
                       		GivePlayerMoney(playerid, - insmotopricee);
                       		format(string, sizeof(string), "Moto Insurance purchased for $%s !", FormatNumber(insmotopricee));
                   		    SCM(playerid, COLOR_CRS2, string);
                   		    PlayerPlaySound(playerid, 1054, 0.0, 0.0, 10.0)
                       		SaveCarCoords();
                       		OnPropUpdate();
                   		}
                   		else
                   		SCM(playerid, COLOR_GREY, "** You don't have enough cash with you !");
                   		PlayerPlaySound(playerid, 1055, 0.0, 0.0, 10.0)
                   		return 1;
                   	}
                   	else if (CarInfo[motoid][cInsurancemoto] == 4)
                   	{
                   		if(GetPlayerMoney(playerid) >= insmotopricee)
			       		{
                       		CarInfo[motoid][cInsurancemoto] = 5;
                       		GivePlayerMoney(playerid, - insmotopricee);
                       		format(string, sizeof(string), "Moto Insurance purchased for $%s !", FormatNumber(insmotopricee));
                   		    SCM(playerid, COLOR_CRS2, string);
                   		    PlayerPlaySound(playerid, 1054, 0.0, 0.0, 10.0)
                       		SaveCarCoords();
                       		OnPropUpdate();
                   		}
                   		else
                   		SCM(playerid, COLOR_GREY, "** You don't have enough cash with you !");
                   		PlayerPlaySound(playerid, 1055, 0.0, 0.0, 10.0)
                   		return 1;
                   	}
					else
	                SCM(playerid, COLOR_GREY, "** You arleady have five insurances for your moto !");
	                PlayerPlaySound(playerid, 1055, 0.0, 0.0, 10.0)
	                return 1;
	           	}
				else
				SCM(playerid, COLOR_GREY, "** You don't own a moto !");
				PlayerPlaySound(playerid, 1055, 0.0, 0.0, 10.0)
				return 1;
	        }
		}
		return 1;
	}

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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.