SA-MP Forums Archive
[Ajuda] Carro comprado - 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] Carro comprado (/showthread.php?tid=364917)



Carro comprado - caoraivoso3 - 01.08.2012

Boas mala,tenho um problema,quando eu compro um carro bem tudo direitinho,quando vou entrar aquilo diz que pertence a uma faction,mas se for outra pessoa diz que o carro nao te pertence. Esta tudo bem,mas se o carro e meu,nao deveria aparecer como sendo da faction tenho a public
Код:
OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
e vou passar a parte onde deve ter algum erro e que eu nao descobri nada

Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	new string[128];
    new Float:playerposx, Float:playerposy, Float:playerposz;
	PlayerActionMessage(playerid,15.0,"entra no veiculo");
	if(VehicleLocked[vehicleid] == 1)
	{
		GetPlayerPos(playerid, playerposx, playerposy, playerposz);
		if(AdminDuty[playerid] == 0 || PlayerInfo[playerid][mstrvbcGm] == 0)
		{
			SetPlayerPos(playerid,playerposx, playerposy, playerposz);
			if(AlarmStatus[vehicleid] == 1)
			{
				SetVehicleAlarmOn(vehicleid);
			}
		}
		SendClientMessage(playerid,COLOR_WHITE,"[VEICULO:] Veiculo trancado.");
	}
	if(Car[vehicleid][Owned] == 1)
	{
		if(PlayerInfo[playerid][msCarKey1] == vehicleid || PlayerInfo[playerid][msCarKey2] == vehicleid || PlayerInfo[playerid][msCarKey3] == vehicleid || PlayerInfo[playerid][msCarKey4] == vehicleid || entrar[playerid]== vehicleid || arrombarcarro[playerid] == 1)
		{
		    entrar[playerid]= 0;
		}
		else
		{
			GetPlayerPos(playerid, playerposx, playerposy, playerposz);
			if(AdminDuty[playerid] == 0 || PlayerInfo[playerid][mstrvbcGm] == 0)
			{
				SetPlayerPos(playerid,playerposx, playerposy, playerposz);
				if(AlarmStatus[vehicleid] == 1)
				{
					SetVehicleAlarmOn(vehicleid);
				}
			}
			SendClientMessage(playerid,COLOR_WHITE,"[VEICULO:] Este veiculo nгo te pertence.");
		}
	}
	if(Car[vehicleid][Owned] == 0 && Car[vehicleid][Locked] == 1)
	{
		GetPlayerPos(playerid, playerposx, playerposy, playerposz);
		if(AdminDuty[playerid] == 0 || PlayerInfo[playerid][mstrvbcGm] == 0)
		{
			SetPlayerPos(playerid,playerposx, playerposy, playerposz);
			if(AlarmStatus[vehicleid] == 1)
			{
				SetVehicleAlarmOn(vehicleid);
			}
		}
		SendClientMessage(playerid,COLOR_WHITE,"[VEICULO:] Este veiculo nгo te pertence.");
	}
e ainda nesta public tem
pawn Код:
if(DynamicCars[vehicleid-1][FactionCar] != 255)
    {
        if(PlayerInfo[playerid][msFaction] != DynamicCars[vehicleid-1][FactionCar])
        {
            if(GetPlayerState(playerid) != ispassenger)
            {
                GetPlayerPos(playerid, playerposx, playerposy, playerposz);
                if(DynamicFactions[DynamicCars[vehicleid-1][FactionCar]][fType] == 1)
                {
                    if(AdminDuty[playerid] == 0 || PlayerInfo[playerid][mstrvbcGm] == 0)
                    {
                        SetPlayerPos(playerid,playerposx, playerposy, playerposz);
                        if(AlarmStatus[vehicleid] == 1)
                        {
                            SetVehicleAlarmOn(vehicleid);
                        }
                    }
                    format(string, sizeof(string), "[PSP:] %s foi avistado a tentar roubar um veiculo da Policia.", GetPlayerNameEx(playerid));
                    SendFactionTypeMessage(1,COLOR_LSPD,string);
                    new location[MAX_ZONE_NAME];
                    GetPlayer2DZone(playerid, location, MAX_ZONE_NAME);
                    format(string, sizeof(string), "[PSP:] Todas as unidas a procura de %s - Ultima pessoa activa: %s.", GetPlayerNameEx(playerid),location);
                    SendFactionTypeMessage(1,COLOR_LSPD,string);
                    SendClientMessage(playerid,COLOR_WHITE,"[VEICULO:] Foste avistado a tentar roubar um veiculo da Policia!");
                    SetPlayerWantedLevelEx(playerid,GetPlayerWantedLevel(playerid)+1);
                }
                if(AdminDuty[playerid] == 0 || PlayerInfo[playerid][mstrvbcGm] == 0)
                {
                    SetPlayerPos(playerid,playerposx, playerposy, playerposz);
                    if(AlarmStatus[vehicleid] == 1)
                    {
                        SetVehicleAlarmOn(vehicleid);
                    }
                }
                format(string, sizeof(string), "[FACTION:] Este veiculo nгo te pertence, pertence a %s.",DynamicFactions[DynamicCars[vehicleid-1][FactionCar]][fName]);
                SendClientMessage(playerid,COLOR_WHITE, string);
            }
        }
    }
mas e que todos os players que compram vem sendo da faction 0 '-' tem como resolver isso? e que nao encontro mesmo a porcaria do erro