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



Getando cidade. - Luiiiz - 05.02.2017

Queria saber o que eu deveria usar para getar a cidade do player? (Quero usar para fazer quando ele morrer, ele ir pro hospital da cidade.)
Entгo queria saber quais os comandos que eu devo utilizar para isso.
Pensei em usar gangzone. Mas teria como eu colocar a cor da gangzone transparente?


Re: Getando cidade. - johntrybescripter - 05.02.2017

gangzonehideforall, n precisa por transparente...

faz uma identificaзгo do local tipo "IsPlayerLS" e se ele tiver ali vai pro hosp de LS e assim vai..


Re: Getando cidade. - Luiiiz - 05.02.2017

Ah, entгo mesmo ela escondida, ela ainda tem a funзгo dela?


Re: Getando cidade. - ThuuGLif3 - 05.02.2017

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.


Re: Getando cidade. - Luiiiz - 05.02.2017

PHP код:
Undefined symbol "GetPlayerDistanceToPoint" 
Deu isso 7x (todas as vezes que usou).
EDIT:
Arrumei e nгo funcionou a camera ficou focada pro Hospital de LS e nгo spawna, nгo faz nada.


Re: Getando cidade. - ThuuGLif3 - 05.02.2017

stock do GetPlayerDistance,

Код:
stock GetPlayerDistanceToPoint( playerid, Float:x, Float:y )
{
    new Float:tmpdis;
    new Float:x1, Float:y1, Float:z1;
    GetPlayerPos( playerid, x1, y1, z1 );
    tmpdis = floatsqroot( floatpower( floatabs( floatsub( x,x1 )),2 )+floatpower( floatabs( floatsub( y,y1 )),2 ));
    return floatround( tmpdis );
}
Vai lб no seu OnPlayerSpawn e coloca isso aqui fion,

Код:
		   	if( pInfo[ playerid ][ Hosp ] == 0 )
			{
				SetPlayerPos( playerid, 1173.1145,-1323.7125,15.3962 );
				SetPlayerFacingAngle( playerid, 268.1490 );
				SetCameraBehindPlayer( playerid );
				pInfo[ playerid ][ Hosp ] = -1;
			}
			else if( pInfo[ playerid ][ Hosp ] == 1 )
			{
				SetPlayerPos( playerid, 2036.5521,-1412.5513,16.9922 );
				SetPlayerFacingAngle( playerid, 135.5749 );
				SetCameraBehindPlayer( playerid );
				pInfo[ playerid ][ Hosp ] = -1;
			}
			else if( pInfo[ playerid ][ Hosp ] == 2 )
			{
				SetPlayerPos( playerid, 1607.4396,1819.1462,10.8280 );
				SetPlayerFacingAngle( playerid, 359.6572 );
				SetCameraBehindPlayer( playerid );
				pInfo[ playerid ][ Hosp ] = -1;
			}
			else if( pInfo[ playerid ][ Hosp ] == 3 )
			{
				SetPlayerPos( playerid, -2665.0503,636.5155,14.4531 );
				SetPlayerFacingAngle( playerid, 177.0288 );
				SetCameraBehindPlayer( playerid );
				pInfo[ playerid ][ Hosp ] = -1;
			}
		    else if( pInfo[ playerid ][ Hosp ] == 4 )
			{
                SetPlayerPos( playerid, -315.0838,1050.7095,20.3403 );
                SetPlayerFacingAngle( playerid, 359.3905 );
				SetCameraBehindPlayer( playerid );
				pInfo[ playerid ][ Hosp ] = -1;
			}
			else if( pInfo[ playerid ][ Hosp ] == 5 )
			{
                SetPlayerPos( playerid, -1514.6455,2523.4263,55.8138 );
                SetPlayerFacingAngle( playerid, 359.6804 );
				SetCameraBehindPlayer( playerid );
				pInfo[ playerid ][ Hosp ] = -1;
			}
			else if( pInfo[ playerid ][ Hosp ] == 6 )
			{
                SetPlayerPos( playerid, -2208.2485,-2286.8516,30.6250 );
                SetPlayerFacingAngle( playerid, 319.4752 );
				SetCameraBehindPlayer( playerid );
				pInfo[ playerid ][ Hosp ] = -1;
			}
Veja fion.