SA-MP Forums Archive
[Ajuda] Pawno Carros ligar/alarme/trancar e Conce - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Pawno Carros ligar/alarme/trancar e Conce (/showthread.php?tid=440437)



Pawno Carros ligar/alarme/trancar e Conce - ViniKuliveguisky - 29.05.2013

Bom pessoal eu so novo aqui no forum e venho pedir uma ajuda porque nгo estou conseguindo fazer.
Eu tenho aqui os comandos de ligar/alarme/trancar/luz/portamalas/capo veiculos e queria que:
1° Quando o player estivesse fora do carro e desse algum desses comandos aparecesse: "Voce nгo esta em um veiculo";
2° Desbugar o alarme e o trancar porque eu do o comando /v alarmeon ou /v alarmeoff e ele aparece duas vezes seguida a mensagem:
[Tal pessoa] ativou o alarme do veiculo.
[Tal pessoa] desativou o alarme do veiculo.
a mesma coisa com o /v trancar

Linhas:
Код:
	if (strcmp("/v ligar", cmdtext, true, 10) == 0 || strcmp("/v l", cmdtext, true, 10) == 0)
	{
		new pname[MAX_PLAYER_NAME];
		new string[70];
		new mot, lu, alar, por, cap, porma, ob;
        new carro = GetPlayerVehicleID(playerid);
        if(carro != INVALID_VEHICLE_ID)
		{
                if(motor[playerid] == 0)
                {
                    GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
                    SetVehicleParamsEx(carro, VEHICLE_PARAMS_ON, lu, alar, por, cap, porma, ob);
                    motor[playerid] = 1;
					SendClientMessage(playerid, 0xFFFFFFAA, "Veiculo {2F991A}Ligado!");
					GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
					format(string, sizeof(string), "%s girou a chave e ligou o veiculo.", pname);
         			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				}
            }
    }
    if (strcmp("/v desligar", cmdtext, true, 10) == 0 || strcmp("/v d", cmdtext, true, 10) == 0)
    {
  		new pname[MAX_PLAYER_NAME];
		new string[70];
		new mot, lu, alar, por, cap, porma, ob;
        new carro = GetPlayerVehicleID(playerid);
        if(carro != INVALID_VEHICLE_ID)
            {
                if(motor[playerid] == 1)
                {
                    GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
                    SetVehicleParamsEx(carro, VEHICLE_PARAMS_OFF, lu, alar, por, cap, porma, ob);
                    motor[playerid] = 0;
                    SendClientMessage(playerid, 0xFFFFFFAA, "Veiculo {E31919}Desligado!");
					GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
					format(string, sizeof(string), "%s girou a chave e desligou o veiculo.", pname);
         			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				}
            }
    }
    if (strcmp("/v farolon", cmdtext, true, 10) == 0)
    {
  		new pname[MAX_PLAYER_NAME];
		new string[70];
		new mot, lu, alar, por, cap, porma, ob;
        new carro = GetPlayerVehicleID(playerid);
        if(carro != INVALID_VEHICLE_ID)
            {
                if(luz[playerid] == 0)
                {
                    GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
                    SetVehicleParamsEx(carro, mot, VEHICLE_PARAMS_ON, alar, por, cap, porma, ob);
                    luz[playerid] = 1;
                    SendClientMessage(playerid, 0xFFFFFFAA, "Farol {2F991A}Ligado!");
					GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
					format(string, sizeof(string), "%s liga o farol do veiculo.", pname);
         			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				}
            }
    }
    if (strcmp("/v faroloff", cmdtext, true, 10) == 0)
    {
  		new pname[MAX_PLAYER_NAME];
		new string[70];
		new mot, lu, alar, por, cap, porma, ob;
        new carro = GetPlayerVehicleID(playerid);
        if(carro != INVALID_VEHICLE_ID)
            {
                if(luz[playerid] == 1)
                {
                    GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
                    SetVehicleParamsEx(carro, mot, VEHICLE_PARAMS_OFF, alar, por, cap, porma, ob);
                    luz[playerid] = 0;
                    SendClientMessage(playerid, 0xFFFFFFAA, "Farol {E31919}Desligado!");
					GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
					format(string, sizeof(string), "%s desliga o farol do veiculo.", pname);
         			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				}
            }
    }
    /*if (strcmp("/v alarmeon", cmdtext, true, 10) == 0)
    {
  		new pname[MAX_PLAYER_NAME];
		new string[70];
		new mot, lu, alar, por, cap, porma, ob;
        new carro = GetPlayerVehicleID(playerid);
        if(carro != INVALID_VEHICLE_ID)
            {
                if(alarme[playerid] == 0)
                {
                    GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
                    SetVehicleParamsEx(carro, mot, lu, VEHICLE_PARAMS_ON, por, cap, porma, ob);
                    alarme[playerid] = 1;
                    SendClientMessage(playerid, 0xFFFFFFAA, "Alarme {2F991A}Ligado!");
					GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
					format(string, sizeof(string), "%s ativou o alarme do veiculo.", pname);
         			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				}
            }
    }
    if (strcmp("/v alarmeoff", cmdtext, true, 10) == 0)
    {
  		new pname[MAX_PLAYER_NAME];
		new string[70];
		new mot, lu, alar, por, cap, porma, ob;
        new carro = GetPlayerVehicleID(playerid);
        if(carro != INVALID_VEHICLE_ID)
            {
                if(alarme[playerid] == 1)
                {
                    GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
                    SetVehicleParamsEx(carro, mot, lu,VEHICLE_PARAMS_OFF, por, cap, porma, ob);
                    alarme[playerid] = 0;
                    SendClientMessage(playerid, 0xFFFFFFAA, "Alarme {E31919}Desligado!");
					GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
					format(string, sizeof(string), "%s desativou o alarme do veiculo.", pname);
         			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				}
            }
    }
    if (strcmp("/v destrancar", cmdtext, true, 10) == 0)
    {
  		new pname[MAX_PLAYER_NAME];
		new string[70];
		new mot, lu, alar, por, cap, porma, ob;
        new carro = GetPlayerVehicleID(playerid);
        if(carro != INVALID_VEHICLE_ID)
            {
                if(portas[playerid] == 0)
                {
                    GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
                    SetVehicleParamsEx(carro, mot, lu, alar, VEHICLE_PARAMS_ON, cap, porma, ob);
                    portas[playerid] = 1;
                    SendClientMessage(playerid, 0xFFFFFFAA, "Portas {2F991A}Abertas!");
					GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
					format(string, sizeof(string), "%s destrancou as portas do veiculo.", pname);
         			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				}
            }
    }
    if (strcmp("/v trancar", cmdtext, true, 10) == 0)
    {
  		new pname[MAX_PLAYER_NAME];
		new string[70];
		new mot, lu, alar, por, cap, porma, ob;
        new carro = GetPlayerVehicleID(playerid);
        if(carro != INVALID_VEHICLE_ID)
            {
                if(portas[playerid] == 1)
                {
                    GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
                    SetVehicleParamsEx(carro, mot, lu, alar, VEHICLE_PARAMS_OFF, cap, porma, ob);
                    portas[playerid] = 0;
                    SendClientMessage(playerid, 0xFFFFFFAA, "Portas {E31919}Fechadas!");
					GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
					format(string, sizeof(string), "%s trancou as portas do veiculo.", pname);
         			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				}
            }
    }*/
    if (strcmp("/v capoabrir", cmdtext, true, 10) == 0)
    {
  		new pname[MAX_PLAYER_NAME];
		new string[70];
		new mot, lu, alar, por, cap, porma, ob;
        new carro = GetPlayerVehicleID(playerid);
        if(carro != INVALID_VEHICLE_ID)
            {
                if(capo[playerid] == 0)
                {
                    GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
                    SetVehicleParamsEx(carro, mot, lu, alar, por, VEHICLE_PARAMS_ON, porma, ob);
                    capo[playerid] = 1;
                    SendClientMessage(playerid, 0xFFFFFFAA, "Capo {2F991A}Aberto!");
					GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
					format(string, sizeof(string), "%s abriu o capo do veiculo", pname);
         			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				}
            }
    }
    if (strcmp("/v capofechar", cmdtext, true, 10) == 0)
    {
  		new pname[MAX_PLAYER_NAME];
		new string[70];
		new mot, lu, alar, por, cap, porma, ob;
        new carro = GetPlayerVehicleID(playerid);
        if(carro != INVALID_VEHICLE_ID)
            {
                if(capo[playerid] == 1)
                {
                    GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
                    SetVehicleParamsEx(carro, mot, lu, alar, por, VEHICLE_PARAMS_OFF, porma, ob);
                    capo[playerid] = 0;
                    SendClientMessage(playerid, 0xFFFFFFAA, "Capo {E31919}Fechado!");
					GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
					format(string, sizeof(string), "%s fechou o capo do veiculo", pname);
         			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				}
            }
    }
    if (strcmp("/v portamalasabrir", cmdtext, true, 10) == 0)
    {
  		new pname[MAX_PLAYER_NAME];
		new string[70];
		new mot, lu, alar, por, cap, porma, ob;
        new carro = GetPlayerVehicleID(playerid);
        if(carro != INVALID_VEHICLE_ID)
            {
                if(portamalas[playerid] == 0)
                {
                    GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
                    SetVehicleParamsEx(carro, mot, lu, alar, por, cap, VEHICLE_PARAMS_ON, ob);
                    portamalas[playerid] = 1;
                    SendClientMessage(playerid, 0xFFFFFFAA, "Portamalas {2F991A}Aberto!");
					GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
					format(string, sizeof(string), "%s abriu o portamalas do veiculo", pname);
         			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				}
            }
    }
    if (strcmp("/v portamalasfechar", cmdtext, true, 10) == 0)
    {
  		new pname[MAX_PLAYER_NAME];
		new string[70];
		new mot, lu, alar, por, cap, porma, ob;
        new carro = GetPlayerVehicleID(playerid);
        if(carro != INVALID_VEHICLE_ID)
            {
                if(portamalas[playerid] == 1)
                {
                    GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
                    SetVehicleParamsEx(carro, mot, lu, alar, por, cap, VEHICLE_PARAMS_OFF, ob);
                    portamalas[playerid] = 0;
                    SendClientMessage(playerid, 0xFFFFFFAA, "Portamalas {E31919}Fechado!");
                    SendClientMessage(playerid, COLOR_DBLUE, "fechou o portamalas do veiculo");
					GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
					format(string, sizeof(string), "%s fechou o portamalas do veiculo", pname);
         			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				}
            }
    }
E sobre a concessionaria:
Eu fiz uma concessionaria por bloco de notas se nгo me engano й GF que se diz, ai voce entra no carro aparece o chatbox para comprar quando voce compra voce sai com esse carro ai eu queria que:
1° Quando comprar o carro nascer um igual em alguma cordenada que for colocado para que esse carro fique ali.

Linhas:

Код:
	if(newstate == 2)
	{
      for(new i = 0; i < sizeof(CarInfo); i++)
	    {
	        new newcar = GetPlayerVehicleID(playerid);
	        new Aluguelbox[256];
	        new string[256];
        	if(newcar == CarInfo[i][ownedvehicle])
        	{
				    if(CarInfo[i][cOwned]==0)
				    {
				        TogglePlayerControllable(playerid, 0);
				        CarOffered[playerid]=1;
				        //format(string,sizeof(string),"~w~Carro: %s~n~Preco: ~g~%d~n~~w~/veiculo comprar para comprar",CarInfo[i][cDescription],CarInfo[i][cValue]);
                        format(Aluguelbox, sizeof(Aluguelbox),"Carro: %s Preco: %d\nGostaria de compra-lo ?", CarInfo[i][cDescription],CarInfo[i][cValue]);
				        TogglePlayerControllable(playerid, 0);
   				        ShowPlayerDialog(playerid,  2624, DIALOG_STYLE_MSGBOX, "Deseja compra-lo?", Aluguelbox, "Sim", "Nгo");
				 	}
        			if(CarInfo[i][cOwned]==1)
				    {
					    new playername[MAX_PLAYER_NAME];
					    GetPlayerName(playerid, playername, sizeof(playername));
					    if(strcmp(playername,CarInfo[i][cOwner],true)==0)
				    {
					    format(string,sizeof(string),"Olб %s Bem vindo ao seu Veiculo.", playerid, CarInfo[i][cGrana]);
					    SendClientMessage(playerid, 0xCCCCFFFF, string);
					    TogglePlayerControllable(playerid, 1);
				    }
	                    else
				    {
					    format(string,sizeof(string),"Veiculo de %s",CarInfo[i][cOwner]);
					    SendClientMessage(playerid, 0xCCCCFFFF, string);
         				RemovePlayerFromVehicle(playerid);
				    }
			    }
			}
		}
	}
Se precisar de mais linhas porfavor peзam que eu coloco sу me diga qual xD


Respuesta: Pawno Carros ligar/alarme/trancar e Conce - ViniKuliveguisky - 30.05.2013

Upp! Por favor me ajudem


Re: Pawno Carros ligar/alarme/trancar e Conce - Cromado - 30.05.2013

Vocк que que apareзa uma mensagem se ele nгo estiver em um veiculo?


Re: Pawno Carros ligar/alarme/trancar e Conce - Don_Speed - 30.05.2013

Isto ira lhe ajudar a verificar se o jogar esta no carro.


Respuesta: Re: Pawno Carros ligar/alarme/trancar e Conce - ViniKuliveguisky - 30.05.2013

Quote:
Originally Posted by Cromado
Посмотреть сообщение
Vocк que que apareзa uma mensagem se ele nгo estiver em um veiculo?
Sim. Se puder ajudar agradeзo e do Rep + xD


Re: Respuesta: Re: Pawno Carros ligar/alarme/trancar e Conce - Don_Speed - 30.05.2013

Quote:
Originally Posted by ViniKuliveguisky
Посмотреть сообщение
Sim. Se puder ajudar agradeзo e do Rep + xD
Quote:
Originally Posted by Don_Speed
Посмотреть сообщение
So clicar



Re: Pawno Carros ligar/alarme/trancar e Conce - Cromado - 30.05.2013

nгo sei se isso ta certo mais... testa
pawn Код:
if (strcmp("/v ligar", cmdtext, true, 10) == 0 || strcmp("/v l", cmdtext, true, 10) == 0)
    {
        new pname[MAX_PLAYER_NAME];
        new string[70];
        new mot, lu, alar, por, cap, porma, ob;
        new carro = GetPlayerVehicleID(playerid);
        if(carro != INVALID_VEHICLE_ID)
        {
                if(motor[playerid] == 0)
                {
                    GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
                    SetVehicleParamsEx(carro, VEHICLE_PARAMS_ON, lu, alar, por, cap, porma, ob);
                    motor[playerid] = 1;
                    SendClientMessage(playerid, 0xFFFFFFAA, "Veiculo {2F991A}Ligado!");
                    GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
                    format(string, sizeof(string), "%s girou a chave e ligou o veiculo.", pname);
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    return 1;
                    }else{
                    SendClientMessage(playerid, 0xFFFFFFAA, "Vocк nгo estб em um veiculo");
                }
            }
    }



Respuesta: Re: Pawno Carros ligar/alarme/trancar e Conce - ViniKuliveguisky - 30.05.2013

Quote:
Originally Posted by Cromado
Посмотреть сообщение
nгo sei se isso ta certo mais... testa
pawn Код:
if (strcmp("/v ligar", cmdtext, true, 10) == 0 || strcmp("/v l", cmdtext, true, 10) == 0)
    {
        new pname[MAX_PLAYER_NAME];
        new string[70];
        new mot, lu, alar, por, cap, porma, ob;
        new carro = GetPlayerVehicleID(playerid);
        if(carro != INVALID_VEHICLE_ID)
        {
                if(motor[playerid] == 0)
                {
                    GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
                    SetVehicleParamsEx(carro, VEHICLE_PARAMS_ON, lu, alar, por, cap, porma, ob);
                    motor[playerid] = 1;
                    SendClientMessage(playerid, 0xFFFFFFAA, "Veiculo {2F991A}Ligado!");
                    GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
                    format(string, sizeof(string), "%s girou a chave e ligou o veiculo.", pname);
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    return 1;
                    }else{
                    SendClientMessage(playerid, 0xFFFFFFAA, "Vocк nгo estб em um veiculo");
                }
            }
    }
Ele troco as bolas :S
Quando ta fora do carro ele diz: girou a chave e ligou o veiculo
e quando ele ta no carro ele diz: Vocк nгo estб em um veiculo

Edit: acho que й pq voce nгo declaro os IsPlayerInAnyVehicle e IsPlayerInVehicle
to tentando aqui.
Se tiver como voces me ajudar nos outros ali Exemplo Conce eu agradeзo