[Ajuda] Getando cidade.
#4

Topo,

Код:
enum PlayerInfo
{
	Hosp
};
new pInfo[MAX_PLAYERS][PlayerInfo];
OnPlayerDeath,

Код:
if( GetPlayerHospital( playerid ) == 0 )
{
	pInfo[playerid][Hosp] = 0; SetHospital( playerid );
}
else if( GetPlayerHospital( playerid ) == 1 )
{
	pInfo[playerid][Hosp] = 1; SetHospital( playerid );
}
else if( GetPlayerHospital( playerid ) == 2 )
{
	pInfo[playerid][Hosp] = 2; SetHospital( playerid );
}
else if( GetPlayerHospital( playerid ) == 3 )
{
	pInfo[playerid][Hosp] = 3; SetHospital( playerid );
}
else if( GetPlayerHospital( playerid ) == 4 )
{
	pInfo[playerid][Hosp] = 4; SetHospital( playerid );
}
else if( GetPlayerHospital( playerid ) == 5 )
{
	pInfo[playerid][Hosp] = 5; SetHospital( playerid );
}
else if( GetPlayerHospital( playerid ) == 6 )
{
	pInfo[playerid][Hosp] = 6; SetHospital( playerid );
}
Stocks, etc,

Код:
 stock SetHospital( playerid )
{
	TogglePlayerControllable( playerid, false );
	SetPlayerPos( playerid, 1183.4017,-1297.4088,14.2143 );
	SetPlayerCameraPos( playerid, 1197.5721,-1325.6716,26.9214 );
	SetPlayerCameraLookAt( playerid, 1177.6808,-1324.3663,14.0827 );
}

forward GetPlayerHospital( playerid );
public GetPlayerHospital( playerid )
{
    if( !IsPlayerConnected( playerid ))
    {
		return -1;
    }
    new
		Float:dist,
		prevhosp
	;
	new Float:distancia = 100000.000;

	for( new hospid = 0; hospid < 6; hospid++ )
	{
        if( hospid == 0 )
	        dist = GetPlayerDistanceToPoint( playerid, 1173.1145, -1323.7125 ); // Hospital de Los Santos Perto da Ammu-Nation
        else if( hospid == 1 )
			dist = GetPlayerDistanceToPoint( playerid, 2036.5521, -1412.5513 ); // Hospital de Los Santos Perto da Favela
        else if( hospid == 2 )
			dist = GetPlayerDistanceToPoint( playerid, 1607.4396, 1819.1462 ); // Hspital de Las Venturas
        else if( hospid == 3 )
			dist = GetPlayerDistanceToPoint( playerid, -2665.0503, 636.5155 ); // Hospital de San Fierro
        else if( hospid == 4 )
			dist = GetPlayerDistanceToPoint( playerid, -315.0838, 1050.7095 ); // Hospital de Fort Carson
        else if( hospid == 5 )
			dist = GetPlayerDistanceToPoint( playerid, -1514.6455, 2523.4263 ); // Hospital de El-Quebrados
        else if( hospid == 6 )
			dist = GetPlayerDistanceToPoint( playerid, -2208.2485, -2286.8516 ); // Hospital de Angel Pine
        if(( dist < distancia ))
		{
            distancia = dist;
		    prevhosp = hospid;
		}
	}
	return prevhosp;
}
Adapte de sua forma.
Reply


Messages In This Thread
Getando cidade. - by Luiiiz - 05.02.2017, 00:42
Re: Getando cidade. - by johntrybescripter - 05.02.2017, 00:54
Re: Getando cidade. - by Luiiiz - 05.02.2017, 01:06
Re: Getando cidade. - by ThuuGLif3 - 05.02.2017, 01:23
Re: Getando cidade. - by Luiiiz - 05.02.2017, 01:38
Re: Getando cidade. - by ThuuGLif3 - 05.02.2017, 01:57

Forum Jump:


Users browsing this thread: 2 Guest(s)