[Ajuda] /trancar carro bulgado
#1

Bom Quando alguem compra uma casa no SV tem carros nas casas ae vc tem que dar /trancar para poder abrir ou Veiculo para andar nele Mas ae vo da /trancar o carro nao abre nao tem geito de entrar nele vo postar o CMD embaixo...


Код:
if(strcmp(cmd, "/trancar", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			new carid;
            if (gTeam[playerid] == 2 || gTeam[playerid] == 1)
			{
				if(gLastCar[playerid] == 0 && PlayerInfo[playerid][pPHousekey] == 255)
				{
					SendClientMessage(playerid, COLOR_GRAD2, "Vocк nгo tem um carro de casa/alugado.");
					return 1;
				}
				else if(gLastCar[playerid] != 0 && gLastCar[playerid] != PlayerInfo[playerid][pPHousekey]+totalveiculos)
				{
					if (HireCar[playerid] != gLastCar[playerid] && HireCar[playerid] > 0)
					{
						gLastDriver[HireCar[playerid]] = 300;
						VTrancado[HireCar[playerid]] = 0;
						UnLockCar(HireCar[playerid]);
					}
					HireCar[playerid] = gLastCar[playerid];
				}
			}
			if (PlayerInfo[playerid][pPHousekey] == 255)
			{
				if(HireCar[playerid] == 0)
				{
					SendClientMessage(playerid, COLOR_GRAD2, "Voce nгo tem um carro.");
					return 1;
				}
			}
			carid = PlayerInfo[playerid][pPHousekey]+totalveiculosh;
			if(HireCar[playerid] > 0 && !SwitchKey[playerid])
			{
				carid = HireCar[playerid];
			}
			//new driver = gLastDriver[carid];
			new lockstatus = VTrancado[carid];
			new Float:cx,Float:cy,Float:cz;
			GetVehiclePos(carid, cx, cy, cz);
			switch (lockstatus)
			{
				case 0:
				{
					if(HireCar[playerid] == 0 && PlayerInfo[playerid][pPHousekey] == 255)
					{
						SendClientMessage(playerid, COLOR_GRAD2, "Voce nгo tem um carro");
						return 1;
					}
					if(HireCar[playerid] == carid && !SwitchKey[playerid])
					{
						GameTextForPlayer(playerid, "~w~Veiculo Alugado~r~Fechado", 5000, 6);
						PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
						VTrancado[carid] = 1;
						LockCar(carid);
					}
					else if(PlayerInfo[playerid][pPHouseCarkey] == carid)
					{
						GameTextForPlayer(playerid, "~w~Veiculo da Casa ~r~Fechado", 5000, 6);
						PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
						VTrancado[carid] = 1;
						LockCar(carid);
						return 1;
					}
				}
				case 1:
				{
					if(HireCar[playerid] == 0 && PlayerInfo[playerid][pPHousekey] == 255)
					{
						SendClientMessage(playerid, COLOR_GRAD2, "Voce nгo tem um carro");
						return 1;
					}
					if(HireCar[playerid] == carid && !SwitchKey[playerid])
					{
						GameTextForPlayer(playerid, "~w~Veiculo Alugado~g~Aberto", 5000, 6);
						PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
						VTrancado[carid] = 0;
						UnLockCar(carid);
						SetPlayerVirtualWorld(playerid, 0);
						SetPlayerInterior(playerid, 0);
					}
					if (PlayerInfo[playerid][pPHouseCarkey] == carid)
					{
						GameTextForPlayer(playerid, "~w~Veiculo da Casa ~g~Aberto", 5000, 6);
						PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
						VTrancado[carid] = 0;
						UnLockCar(carid);
                        SetPlayerVirtualWorld(playerid, 0);
                        SetPlayerInterior(playerid, 0);
						return 1;
					}
				}
				default:
				{
					SendClientMessage(playerid, COLOR_GRAD2, "Erro");
				}
			}
			if(carid == 256)
			{
				SendClientMessage(playerid, COLOR_GRAD2, "Voce nгo tem um carro!");
			}
		}
		return 1;
Reply
#2

acho que o problema ta nisso UnLockCar(carid);
Reply
#3

o dificil e arrumar o poblema xD...
Reply
#4

Posta o UnLockCar(carid);
Reply
#5

posta a strtok do UnLockCar...
Reply
#6

Pocha to com o mesmo problema! como eu resolvo? jб vi se й a pasta Scriptfiles sу que nгo й lб porque lб ta tudo certo! nomeu caso й no GM mesmo! alguem pode me ajudar?
Reply
#7

putz ja postei isso tbm ninguem soube me ajuda entao vo posta o UnLockCar eu msm pq to presisando da msm ajuda
peguei todos ki tava 1 diferente do outro por motivo nao sabia qual seria o ideia ;/ , se puderem ajudar eu to com msm erro to acabando com meu gm tentando arumar esse bug ja falei com muitos scripter trokei o codigo /trancar .. (os cara vip e free tah com msm bug ) sу ke o vip ele nao tranca e o da casa nao abre oiwqoiwqo meio tragico neh??


pawn Код:
UnLockCar(HireCar[playerid]);
UnLockCar(oldcar);
UnLockCar(carid);
UnLockCar(car);
UnLockCar(HireCar[giveplayerid]);
forward UnLockCar(carid);
public UnLockCar(carid)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
SetVehicleParamsForPlayer(carid,i,0,0);
}
}
}
encode_tires(tires1, tires2, tires3, tires4)
{
return tires1 | (tires2 << 1) | (tires3 << 2) | (tires4 << 3);
}

nao sei se й 1 desse ;x
Reply
#8

pow ajuda aki й urgente esse bug tah foda de arumar ;x to acabando com meu gm mais nao consigo arumar
Reply
#9

Tenta tirar o /trancar . Depois procura outro sistema de trava e coloca
Reply
#10

Quote:
Originally Posted by histire
Посмотреть сообщение
pow ajuda aki й urgente esse bug tah foda de arumar ;x to acabando com meu gm mais nao consigo arumar

Isto deve resolver o seu problema .



Primeiro apague todas as publics e forwards relativas бs funзхes LockCar e UnLockCar .



Depois, adicione isto no final do seu GameMode :



pawn Код:
stock UnLockCar(carid)
{
    new Config[7];
    if(GetVehicleParamsEx(carid,Config[0],Config[1],Config[2],Config[3],Config[4],Config[5],Config[6]))
    {
        SetVehicleParamsEx(carid,Config[0],Config[1],Config[2],false,Config[4],Config[5],Config[6]);
    }
    return true;
}




stock LockCar(carid)
{
    new Config[7];
    if(GetVehicleParamsEx(carid,Config[0],Config[1],Config[2],Config[3],Config[4],Config[5],Config[6]))
    {
        SetVehicleParamsEx(carid,Config[0],Config[1],Config[2],true,Config[4],Config[5],Config[6]);
    }
    return true;
}

Caso nгo funcione, certifique-se de que as variбveis ou valores usados quando as funзхes sгo chamadas, como este:


Код:
UnLockCar(HireCar[playerid]);

Realmente representam o veнculo do jogador que й dono da casa, por exemplo .



Espero ter ajudado .
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)