[Ajuda] Fabricaзгo de drogas
#1

Bom dia,
na GM que estou usando existe um comando /bolsa, no qual vocк vai atrбs de produtos para fabricar as drogas, vocк leva mais ou menos 1 hora pra coletar todos, vai no lugar de fabricar e usa o comando /fabricar [crack ou cocaina], a principio tudo funciona bem, porйm quando ele diz pra vocк ir no checkpoint acompanhar a produзгo, nгo acontece nada ao chegar nesse check, como faзo para por, para que quando chegar no checkpoint receba por exemplo 5.000 crack ou cocaina (dependendo da opзгo escolhida) ? Segue o comando /fabricar abaixo:
Quote:

CMD:fabricar(playerid, x_Emprego[])
{
if(isnull(x_Emprego))
{
SendClientMessage(playerid, COLOR_WHITE, "|______________[ Fabricar ]______________|");
SendClientMessage(playerid, COLOR_GRAD1,"USE: /fabricar crack");
SendClientMessage(playerid, COLOR_GRAD1,"USE: /fabricar cocaina");
return true;
}
if(!PlayerToPoint(10.0, playerid, 1453.0837,-1046.7905,213.3828))
{
SendClientMessage(playerid, COLOR_GREY, " Vocк nгo estб no Local de Fabricar Drogas(Trбfico)!");
return true;
}
if(IsACop(playerid))
{
SendClientMessage(playerid, COLOR_GRAD1, "Vocк й um Policial, nгo pode fazer isto!");
return 1;
}
if(PlayerInfo[playerid][pJailed] == 9)
{
SendClientMessage(playerid,COLOR_GRAD1," Vocк nгo pode usar este comando nas Celas da Administraзгo!");
return true;
}
if(!HaveAllIngedients(playerid))
{
SendClientMessage(playerid,COLOR_GRAD1," Complete sua Bolsa Antes! /bolsa");
return true;
}
if(strcmp(x_Emprego,"cocaina",true) == 0)
{
if(PlayerInfo[playerid][pDrogas2] > 4)
{
new string[128];
format(string, sizeof(string), " Vocк ainda tem %d gramas de cocaina, Venda tudo primeiro !", PlayerInfo[playerid][pDrogas2]);
SendClientMessage(playerid, COLOR_GREY, string);
return true;
}
PlayerInfo[playerid][pTempoFDrugs] = 15;
PlayerInfo[playerid][pDrugType] = 1;
SetPlayerCheckpoint(playerid, 1440.2095,-1045.1431,213.3759, 0.5);
PlayerInfo[playerid][pGam] -= 1;
PlayerInfo[playerid][pPFc] -= 4;
PlayerInfo[playerid][pMcr] -= 1;
PlayerInfo[playerid][pCoc] -= 2;
PlayerInfo[playerid][pVam] -= 2;
PlayerInfo[playerid][pVsc] -= 4;
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Vб Atй o Checkpoint ao Lado Acompanhar sua Produзгo!");
return true;
}
else if(strcmp(x_Emprego,"crack",true) == 0)
{
if(PlayerInfo[playerid][pDrogas3] > 4)
{
new string[128];
format(string, sizeof(string), " Vocк ainda tem %d pedras de crack, Venda tudo primeiro !", PlayerInfo[playerid][pDrogas3]);
SendClientMessage(playerid, COLOR_GREY, string);
return true;
}
PlayerInfo[playerid][pTempoFDrugs] = 15;
PlayerInfo[playerid][pDrugType] = 2;
SetPlayerCheckpoint(playerid, 1440.2095,-1045.1431,213.3759, 0.5);
PlayerInfo[playerid][pGam] -= 1;
PlayerInfo[playerid][pPFc] -= 4;
PlayerInfo[playerid][pMcr] -= 1;
PlayerInfo[playerid][pCoc] -= 2;
PlayerInfo[playerid][pVam] -= 2;
PlayerInfo[playerid][pVsc] -= 4;
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Vб Atй o Checkpoint ao Lado Acompanhar sua Produзгo!");
return true;
}
return true;
}

Reply
#2

Код:
//TOPO DO GM
new Fabricando[MAX_PLAYERS];
//

CMD:fabricar(playerid, x_Emprego[])
{
	if(isnull(x_Emprego))
	{
		SendClientMessage(playerid, COLOR_WHITE, "|______________[ Fabricar ]______________|");
		SendClientMessage(playerid, COLOR_GRAD1,"USE: /fabricar crack");
		SendClientMessage(playerid, COLOR_GRAD1,"USE: /fabricar cocaina");
		return true;
	}
	if(!PlayerToPoint(10.0, playerid, 1453.0837,-1046.7905,213.3828))
	{
		SendClientMessage(playerid, COLOR_GREY, " Vocк nгo estб no Local de Fabricar Drogas(Trбfico)!");
		return true;
	}
	if(IsACop(playerid))
	{
		SendClientMessage(playerid, COLOR_GRAD1, "Vocк й um Policial, nгo pode fazer isto!");
		return 1;
	}
	if(PlayerInfo[playerid][pJailed] == 9)
	{
		SendClientMessage(playerid,COLOR_GRAD1," Vocк nгo pode usar este comando nas Celas da Administraзгo!");
		return true;
	}
	if(!HaveAllIngedients(playerid))
	{
		SendClientMessage(playerid,COLOR_GRAD1," Complete sua Bolsa Antes! /bolsa");
		return true;
	}
	if(Fabricando[playerid] == 1)
		return SendClientMessage(playerid,COLOR_GRAD1,"Vocк tem que ir buscar sua droga, siga o checkpoint");
	//variбvel retornando aviso caso vocк ja esteja na missгo de buscar a droga
	if(strcmp(x_Emprego,"cocaina",true) == 0)
	{
		if(PlayerInfo[playerid][pDrogas2] > 4)
		{
			new string[128];
			format(string, sizeof(string), " Vocк ainda tem %d gramas de cocaina, Venda tudo primeiro !", PlayerInfo[playerid][pDrogas2]);
			SendClientMessage(playerid, COLOR_GREY, string);
			return true;
		}
		PlayerInfo[playerid][pTempoFDrugs] = 15;
		PlayerInfo[playerid][pDrugType] = 1;
		SetPlayerCheckpoint(playerid, 1440.2095,-1045.1431,213.3759, 0.5);
		PlayerInfo[playerid][pGam] -= 1;
		PlayerInfo[playerid][pPFc] -= 4;
		PlayerInfo[playerid][pMcr] -= 1;
		PlayerInfo[playerid][pCoc] -= 2;
		PlayerInfo[playerid][pVam] -= 2;
		PlayerInfo[playerid][pVsc] -= 4;
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "Vб Atй o Checkpoint ao Lado Acompanhar sua Produзгo!");
		Fabricando[playerid] = 1;//Dando o valor 1 na variбvel.
		return true;
	}
	else if(strcmp(x_Emprego,"crack",true) == 0)
	{
		if(PlayerInfo[playerid][pDrogas3] > 4)
		{
			new string[128];
			format(string, sizeof(string), " Vocк ainda tem %d pedras de crack, Venda tudo primeiro !", PlayerInfo[playerid][pDrogas3]);
			SendClientMessage(playerid, COLOR_GREY, string);
			return true;
		}
		PlayerInfo[playerid][pTempoFDrugs] = 15;
		PlayerInfo[playerid][pDrugType] = 2;
		SetPlayerCheckpoint(playerid, 1440.2095,-1045.1431,213.3759, 0.5);
		PlayerInfo[playerid][pGam] -= 1;
		PlayerInfo[playerid][pPFc] -= 4;
		PlayerInfo[playerid][pMcr] -= 1;
		PlayerInfo[playerid][pCoc] -= 2;
		PlayerInfo[playerid][pVam] -= 2;
		PlayerInfo[playerid][pVsc] -= 4;
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "Vб Atй o Checkpoint ao Lado Acompanhar sua Produзгo!");
		Fabricando[playerid] = 1;//Dando o valor 1 na variбvel.
		return true;
	}
	return true;
}
public OnPlayerEnterCheckpoint(playerid)
{
    if (Fabricando[playerid] == 1 )//Se estiver fabricando e entrar no checkpoint ele vai iniciar a funзгo
    {
        SendClientMessage (playerid , -1 , "<!> Vocк chegou a sua fabricaзгo da Droga.");//Aqui tu coloca o que ele vai ganhar
        DisablePlayerCheckpoint (playerid);
        return true;
    }
	return 1;
}
Espero ter ajudado
Reply
#3

Sim obrigado amigo, mas dai eu queria por uns 5000 drogas do tipo crack ou cocaina hб um cуdigo para isso mas por algum motivo estб dando erro, segue abaixo:
Код:
/*if(PlayerInfo[playerid][pTempoFDrugs] > 0)
		{
			if(DrugMission[playerid] == 0)
			{
				DrugMission[playerid] = 2;
  			}
		}
		if(DrugMission[playerid] == 2)
		{
			new gstring[195];
		    if (IsPlayerInCheckpoint(playerid))
			{
			   	new estado[45];
			    if(PlayerInfo[playerid][pDrugType] == 1)estado = "~r~~h~Cocaina ~w~Pronta";
			    else if(PlayerInfo[playerid][pDrugType] == 2)estado = "~r~~h~Crack ~w~Pronto";
			    PlayerInfo[playerid][pTempoFDrugs] --;
			    format(gstring, sizeof gstring, "%s em: ~g~~h~%d segundos",
		   		estado, PlayerInfo[playerid][pTempoFDrugs]);
		   		PlayerTextDrawSetString(playerid, TextDrugs[playerid], gstring);
		   		PlayerTextDrawShow(playerid, TextDrugs[playerid]);
			}
			if (!IsPlayerInCheckpoint(playerid))
			{
   				PlayerTextDrawHide(playerid, TextDrugs[playerid]);
			}
			if(PlayerInfo[playerid][pTempoFDrugs] < 0)
			{
			    if(PlayerInfo[playerid][pDrugType] == 1)
			    {
			        new cocainardm = random(1000)+2000;
			        PlayerInfo[playerid][pDrogas2] += cocainardm;
				    format(string, sizeof string, " Cocaina Pronta,Voce Produziu %d Gramas!", cocainardm);
					SendClientMessage(playerid, COLOR_GRAD1, string);
			    }
			    if(PlayerInfo[playerid][pDrugType] == 2)
			    {
			        new crackrdm = random(1000)+1000;
			        PlayerInfo[playerid][pDrogas3] += crackrdm;
				    format(string, sizeof string, " Crack Pronto,Voce Produziu %d Pedras!", crackrdm);
					SendClientMessage(playerid, COLOR_GRAD1, string);
			    }
Como devo adaptar a esse que vocк falou, pode ajudar?
Reply
#4

Код:
if(PlayerInfo[playerid][pTempoFDrugs] > 0)
		{
			if(DrugMission[playerid] == 0)
			{
				DrugMission[playerid] = 2;
  			}
		}
		if(DrugMission[playerid] == 2)
		{
			new gstring[195];
		    if (IsPlayerInCheckpoint(playerid))
			{
			   	new estado[45];
			    if(PlayerInfo[playerid][pDrugType] == 1)estado = "~r~~h~Cocaina ~w~Pronta";
			    else if(PlayerInfo[playerid][pDrugType] == 2)estado = "~r~~h~Crack ~w~Pronto";
			    PlayerInfo[playerid][pTempoFDrugs] --;
			    format(gstring, sizeof gstring, "%s em: ~g~~h~%d segundos",
		   		estado, PlayerInfo[playerid][pTempoFDrugs]);
		   		PlayerTextDrawSetString(playerid, TextDrugs[playerid], gstring);
		   		PlayerTextDrawShow(playerid, TextDrugs[playerid]);
			}
			if (!IsPlayerInCheckpoint(playerid))
			{
   				PlayerTextDrawHide(playerid, TextDrugs[playerid]);
			}
			if(PlayerInfo[playerid][pTempoFDrugs] < 0)
			{
			    if(PlayerInfo[playerid][pDrugType] == 1)
			    {
			   
			        PlayerInfo[playerid][pDrogas2] += 5000;//aqui й o valor da quantidade que ele recebera
				    format(string, sizeof string, " Cocaina Pronta,Voce Produziu %d Gramas!", cocainardm);
					SendClientMessage(playerid, COLOR_GRAD1, string);
			    }
			    if(PlayerInfo[playerid][pDrugType] == 2)
			    {
			  
			        PlayerInfo[playerid][pDrogas3] += 5000;//aqui й o valor da quantidade que ele recebera
				    format(string, sizeof string, " Crack Pronto,Voce Produziu %d Pedras!", crackrdm);
					SendClientMessage(playerid, COLOR_GRAD1, string);
			    }
Reply
#5

Opa, entгo quando coloquei esse ъltimo cуdigo deu o seguinte erro na compilaзгo:
http://imgur.com/a/N4ETS
Daria pra ajeitar ou й melhor adaptar no cуdigo que vocк pфs antes:
Quote:

//TOPO DO GM
new Fabricando[MAX_PLAYERS];
//

CMD:fabricar(playerid, x_Emprego[])
{
if(isnull(x_Emprego))
{
SendClientMessage(playerid, COLOR_WHITE, "|______________[ Fabricar ]______________|");
SendClientMessage(playerid, COLOR_GRAD1,"USE: /fabricar crack");
SendClientMessage(playerid, COLOR_GRAD1,"USE: /fabricar cocaina");
return true;
}
if(!PlayerToPoint(10.0, playerid, 1453.0837,-1046.7905,213.3828))
{
SendClientMessage(playerid, COLOR_GREY, " Vocк nгo estб no Local de Fabricar Drogas(Trбfico)!");
return true;
}
if(IsACop(playerid))
{
SendClientMessage(playerid, COLOR_GRAD1, "Vocк й um Policial, nгo pode fazer isto!");
return 1;
}
if(PlayerInfo[playerid][pJailed] == 9)
{
SendClientMessage(playerid,COLOR_GRAD1," Vocк nгo pode usar este comando nas Celas da Administraзгo!");
return true;
}
if(!HaveAllIngedients(playerid))
{
SendClientMessage(playerid,COLOR_GRAD1," Complete sua Bolsa Antes! /bolsa");
return true;
}
if(Fabricando[playerid] == 1)
return SendClientMessage(playerid,COLOR_GRAD1,"Vocк tem que ir buscar sua droga, siga o checkpoint");
//variбvel retornando aviso caso vocк ja esteja na missгo de buscar a droga
if(strcmp(x_Emprego,"cocaina",true) == 0)
{
if(PlayerInfo[playerid][pDrogas2] > 4)
{
new string[128];
format(string, sizeof(string), " Vocк ainda tem %d gramas de cocaina, Venda tudo primeiro !", PlayerInfo[playerid][pDrogas2]);
SendClientMessage(playerid, COLOR_GREY, string);
return true;
}
PlayerInfo[playerid][pTempoFDrugs] = 15;
PlayerInfo[playerid][pDrugType] = 1;
SetPlayerCheckpoint(playerid, 1440.2095,-1045.1431,213.3759, 0.5);
PlayerInfo[playerid][pGam] -= 1;
PlayerInfo[playerid][pPFc] -= 4;
PlayerInfo[playerid][pMcr] -= 1;
PlayerInfo[playerid][pCoc] -= 2;
PlayerInfo[playerid][pVam] -= 2;
PlayerInfo[playerid][pVsc] -= 4;
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Vб Atй o Checkpoint ao Lado Acompanhar sua Produзгo!");
Fabricando[playerid] = 1;//Dando o valor 1 na variбvel.
return true;
}
else if(strcmp(x_Emprego,"crack",true) == 0)
{
if(PlayerInfo[playerid][pDrogas3] > 4)
{
new string[128];
format(string, sizeof(string), " Vocк ainda tem %d pedras de crack, Venda tudo primeiro !", PlayerInfo[playerid][pDrogas3]);
SendClientMessage(playerid, COLOR_GREY, string);
return true;
}
PlayerInfo[playerid][pTempoFDrugs] = 15;
PlayerInfo[playerid][pDrugType] = 2;
SetPlayerCheckpoint(playerid, 1440.2095,-1045.1431,213.3759, 0.5);
PlayerInfo[playerid][pGam] -= 1;
PlayerInfo[playerid][pPFc] -= 4;
PlayerInfo[playerid][pMcr] -= 1;
PlayerInfo[playerid][pCoc] -= 2;
PlayerInfo[playerid][pVam] -= 2;
PlayerInfo[playerid][pVsc] -= 4;
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Vб Atй o Checkpoint ao Lado Acompanhar sua Produзгo!");
Fabricando[playerid] = 1;//Dando o valor 1 na variбvel.
return true;
}
return true;
}
public OnPlayerEnterCheckpoint(playerid)
{
if (Fabricando[playerid] == 1 )//Se estiver fabricando e entrar no checkpoint ele vai iniciar a funзгo
{
SendClientMessage (playerid , -1 , "<!> Vocк chegou a sua fabricaзгo da Droga.");//Aqui tu coloca o que ele vai ganhar
DisablePlayerCheckpoint (playerid);
return true;
}
return 1;
}

Reply
#6

Adaptando para aquele primeiro cуdigo, ficaria mais ou menos assim?
Код:
 public OnPlayerEnterCheckpoint(playerid)
{
    if (Fabricando[playerid] == 1 )//Se estiver fabricando e entrar no checkpoint ele vai iniciar a funзгo
    {
        layerInfo[playerid][pDrogas2] += 5000;//aqui й o valor da quantidade que ele recebera
		format(string, sizeof string, " Cocaina Pronta,Voce Produziu %d Gramas!", cocainardm);
		SendClientMessage(playerid, COLOR_GRAD1, string);
    }
  	if(PlayerInfo[playerid][pDrugType] == 2)
	{

        PlayerInfo[playerid][pDrogas3] += 5000;//aqui й o valor da quantidade que ele recebera
	    format(string, sizeof string, " Crack Pronto,Voce Produziu %d Pedras!", crackrdm);
		SendClientMessage(playerid, COLOR_GRAD1, string);

		SendClientMessage (playerid , -1 , "Vocк completou a sua fabricaзгo de Drogas.");//Aqui tu coloca o que ele vai ganhar
        DisablePlayerCheckpoint (playerid);
        return true;
    }
	return 1;
}
Reply
#7

Код:
 public OnPlayerEnterCheckpoint(playerid)
{
    if (Fabricando[playerid] == 1 )//Se estiver fabricando e entrar no checkpoint ele vai iniciar a funзгo
    {
        PlayerInfo[playerid][pDrogas2] += 5000;//aqui й o valor da quantidade que ele recebera
		format(string, sizeof string, " Cocaina Pronta,Voce Produziu %d Gramas!", cocainardm);
		SendClientMessage(playerid, COLOR_GRAD1, string);
DisablePlayerCheckpoint (playerid);
    }
  	if(PlayerInfo[playerid][pDrugType] == 2)
	{

        PlayerInfo[playerid][pDrogas3] += 5000;//aqui й o valor da quantidade que ele recebera
	    format(string, sizeof string, " Crack Pronto,Voce Produziu %d Pedras!", crackrdm);
		SendClientMessage(playerid, COLOR_GRAD1, string);

		SendClientMessage (playerid , -1 , "Vocк completou a sua fabricaзгo de Drogas.");//Aqui tu coloca o que ele vai ganhar
        DisablePlayerCheckpoint (playerid);
        return true;
    }
	return 1;
}
Prontinho
Reply
#8

Opa quase lб, deu esses erros:
Reply
#9

OnPlayerEnterCheckpoint ja estб definida no seu gamemode.
string nгo estб definida
Reply
#10

Sim eu encontrei o seguinte cуdigo:
Код:
public OnPlayerEnterCheckpoint(playerid)
{
    new string[MAX_STRING];
    new gstring[128];

    if(GetPVarInt(playerid,"roped") == 1)
    {
        SetPVarInt(playerid,"roped",0);
        SetPVarInt(playerid,"chop_id",0);
        ClearAnimations(playerid);
        TogglePlayerControllable(playerid,0);
        TogglePlayerControllable(playerid,1);
        DisablePlayerCheckpoint(playerid);
        for(new destr4=0;destr4<=ropelength;destr4++)
        {
        	DestroyDynamicObject(r0pes[playerid][destr4]);
       	}
	}


    if(CP[playerid] == 45)
    {
        if(IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid, COLOR_GRAD1, "Vocк precisa estar fora do veiculo.");
        if(!EntregandoPizza[playerid])return SendClientMessage(playerid, COLOR_GRAD1, "Vocк precisa ter uma pizza em mгos.");
        new rdon = random(sizeof(RandomPizzaGorgeta));
        new rdon2 = random(sizeof(RandomPizzaNome));
        new precoentrega = 2500;
        new gorgeta = 0;
        SendClientMessage(playerid, -1, "|____________ Entrega ____________|");
       	format(string, sizeof string, "| *Pizza: %s", RandomPizzaNome[rdon2]);
		SendClientMessage(playerid, COLOR_DBLUE, string);
       	format(string, sizeof string, "| *Entregou para: %s", RandomPizzaGorgeta[rdon]);
		SendClientMessage(playerid, COLOR_DBLUE, string);
       	format(string, sizeof string, "| *Preзo: R$%02d", precoentrega);
		SendClientMessage(playerid, COLOR_DBLUE, string);
		if(TempoEntrega[playerid] > 0)
		{
		    gorgeta = (TempoEntrega[playerid]*20)+random(800);
			format(string, sizeof string, "| *Gorgeta: R$%d", gorgeta);
			SendClientMessage(playerid, COLOR_DBLUE, string);
		}
		else
		{
            format(string, sizeof string, "| *%s diz: Por ter atrasado na entrega, vocк nao ira ganhar gorgeta.", RandomPizzaGorgeta[rdon]);
            SendClientMessage(playerid, COLOR_LIGHTRED, string);
		}
		SendClientMessage(playerid, COLOR_YELLOW, "Agora, vб ate outra residкncia para entregar outra pizza.");
		SendClientMessage(playerid, -1, "__________________________________");
		GiveDinheiro(playerid, precoentrega+gorgeta);
		TempoEntrega[playerid] = 3*60;

	    EntregandoPizza[playerid] = false;

	 	RemovePlayerAttachedObject(playerid, Slot_Pizza);

	 	SetPlayerSpecialAction(playerid, 0);
		new rdon1 = random(sizeof(RandomPizzaPos));
		SetPlayerCheckpoint(playerid, RandomPizzaPos[rdon1][0], RandomPizzaPos[rdon1][1], RandomPizzaPos[rdon1][2], 2.0);
		CP[playerid] = 45;
        return true;
    }
	if(CP[playerid] == 99)
Ele continua, nгo tem sу isso nгo, mas ai se eu colocar :
PHP код:
if (Fabricando[playerid] == )//Se estiver fabricando e entrar no checkpoint ele vai iniciar a funзгo
    
{
        
PlayerInfo[playerid][pDrogas2] += 5000;//aqui й o valor da quantidade que ele recebera
        
format(stringsizeof string" Cocaina Pronta,Voce Produziu %d Gramas!"cocainardm);
        
SendClientMessage(playeridCOLOR_GRAD1string);
DisablePlayerCheckpoint (playerid);
    }
      if(
PlayerInfo[playerid][pDrugType] == 2)
    {

        
PlayerInfo[playerid][pDrogas3] += 5000;//aqui й o valor da quantidade que ele recebera
        
format(stringsizeof string" Crack Pronto,Voce Produziu %d Pedras!"crackrdm);
        
SendClientMessage(playeridCOLOR_GRAD1string);

        
SendClientMessage (playerid , -"Vocк completou a sua fabricaзгo de Drogas.");//Aqui tu coloca o que ele vai ganhar
        
DisablePlayerCheckpoint (playerid);
        return 
true;
    }
    return 
1;

No meio dele irб funcionar? e se sim, ainda sim darб o erro da string nгo definida?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)