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



Ajuda no GameTextForPlayer - KrosmoStewart - 16.02.2019

Ai galera, eu nгo estou entendendo, eu fiz tudo do zero mais ta com 2 problema q nгo indentifico



O problema numero 1 й - Nгo esta aparecendo o "danificado"
E o segundo й - A GameTextForPlayer esta aparecendo ao iniciar o server e nгo sai, sendo que й sу para aparecer quando o veiculo estiver muito danificado.

Aqui o meu codigo.


Код:
forward SAvario(playerid);
public SAvario(playerid)
{
    new Float:vidacar;
    new veiculoid = GetPlayerVehicleID(playerid);
    GetVehicleHealth(veiculoid, vidacar);
    if(vidacar <= 300.0)
	{ 
        SetVehicleHealth(veiculoid, 300);
        new motor, farol, alarme, portas, capo, portamalas, objetivo;
        GetVehicleParamsEx(veiculoid, motor, farol, alarme, portas, capo, portamalas, objetivo);
        SetVehicleParamsEx(veiculoid, 0, farol, alarme, portas, capo, portamalas, objetivo);
        GameTextForPlayer(veiculoid, " ~r~~h~ O motor de seu veiculo foi danificado. ", 5000, 3);
    }
    return 0;
}



Re: Ajuda no GameTextForPlayer - AutoMatic2 - 16.02.2019

Testa assim:

PHP код:
forward SAvario(playerid);
public 
SAvario(playerid)
{
    new 
Float:vidacar;
    new 
veiculoid GetPlayerVehicleID(playerid);
    
GetVehicleHealth(veiculoidvidacar);
    if(
vidacar <= 300.0)
    { 
        
SetVehicleHealth(veiculoid300);
        new 
motorfarolalarmeportascapoportamalasobjetivo;
        
GetVehicleParamsEx(veiculoidmotorfarolalarmeportascapoportamalasobjetivo);
        
SetVehicleParamsEx(veiculoid0farolalarmeportascapoportamalasobjetivo);
        
GameTextForPlayer(playerid"~r~~h~ O motor de seu veiculo foi danificado."50003);
    }
    return 
1;




Re: Ajuda no GameTextForPlayer - KrosmoStewart - 16.02.2019

a msm coisa nao mudou nada man


Re: Ajuda no GameTextForPlayer - Japis - 16.02.2019

Tente substituir seu sistema por este

topo gm
Код:
forward UpdatePlayecar(playerid);
new bool:Playercar[MAX_PLAYERS];
new PlayerTimerCar[MAX_PLAYERS];
OnPlayerDisconnect:
Код:
if (Playercar[playerid]) {
            KillTimer(PlayerTimerCar[playerid]);
        }
final da gm:

Код:
public UpdatePlayercar(playerid) {

	new playervehicle;

	if ( (playervehicle = GetPlayerVehicleID(playerid)) != INVALID_VEHICLE_ID) {

		new string_velo[15];
    	new  lu, alar, por, cap, porma, ob;
		new carro = GetPlayerVehicleID(playerid);
		static Float:health;
		GetVehicleHealth(GetPlayerVehicleID(playerid),health);
		if(health <= 350)
		{

			SendClientMessage(playerid, VERMELHO_COR, "Seu motor estragou");
 			SetVehicleParamsEx(carro, VEHICLE_PARAMS_OFF, lu, alar, por, cap, porma, ob);
                        HidePlayercar(playerid);
 			Playercar[playerid] = false ;
                        KillTimer(PlayerTimerCar[playerid]);
			return 0;
		}
}
	return 1;
}
public OnPlayerStateChange
Код:
  if ( newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER) {
		ParouDeFunfar(playerid) ;
	} else {
		HidePlayercar(playerid) ;
	}
final da gm
Код:
stock ParouDeFunfar(playerid) {
        if ( Playercar[playerid] ) {
            return 0;
        }

        Playercar[playerid] = true ;
        PlayerTimerCar[playerid] = SetTimerEx("UpdatePlayercar", 100, true, "i", playerid);
        return 1;
}

stock HidePlayercar(playerid) {
        if ( !Playercar[playerid] ) {
            return 0;
        }
        Playercar[playerid] = false ;
        KillTimer(PlayerTimerCar[playerid]);
        return 1;
}



Re: Ajuda no GameTextForPlayer - KrosmoStewart - 16.02.2019

Quote:
Originally Posted by Japis
Посмотреть сообщение
Tente substituir seu sistema por este

topo gm
Код:
forward UpdatePlayecar(playerid);
new bool:Playercar[MAX_PLAYERS];
new PlayerTimerCar[MAX_PLAYERS];
OnPlayerDisconnect:
Код:
if (Playercar[playerid]) {
            KillTimer(PlayerTimerCar[playerid]);
        }
final da gm:

Код:
public UpdatePlayercar(playerid) {

	new playervehicle;

	if ( (playervehicle = GetPlayerVehicleID(playerid)) != INVALID_VEHICLE_ID) {

		new string_velo[15];
    	new  lu, alar, por, cap, porma, ob;
		new carro = GetPlayerVehicleID(playerid);
		static Float:health;
		GetVehicleHealth(GetPlayerVehicleID(playerid),health);
		if(health <= 350)
		{

			SendClientMessage(playerid, VERMELHO_COR, "Seu motor estragou");
 			SetVehicleParamsEx(carro, VEHICLE_PARAMS_OFF, lu, alar, por, cap, porma, ob);
                        HidePlayercar(playerid);
 			Playercar[playerid] = false ;
                        KillTimer(PlayerTimerCar[playerid]);
			return 0;
		}
}
	return 1;
}
public OnPlayerStateChange
Код:
  if ( newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER) {
		ParouDeFunfar(playerid) ;
	} else {
		HidePlayercar(playerid) ;
	}
final da gm
Код:
stock ParouDeFunfar(playerid) {
        if ( Playercar[playerid] ) {
            return 0;
        }

        Playercar[playerid] = true ;
        PlayerTimerCar[playerid] = SetTimerEx("UpdatePlayercar", 100, true, "i", playerid);
        return 1;
}

stock HidePlayercar(playerid) {
        if ( !Playercar[playerid] ) {
            return 0;
        }
        Playercar[playerid] = false ;
        KillTimer(PlayerTimerCar[playerid]);
        return 1;
}
Ficou assim:
Код:
F:\Users\krosmo\Desktop\samp GM\gamemodes\SSAML.pwn(287) : warning 235: public function lacks forward declaration (symbol "UpdatePlayercar")
F:\Users\krosmo\Desktop\samp GM\gamemodes\SSAML.pwn(293) : warning 204: symbol is assigned a value that is never used: "string_velo"
F:\Users\krosmo\Desktop\samp GM\gamemodes\SSAML.pwn(291) : warning 204: symbol is assigned a value that is never used: "playervehicle"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Warnings.



Re: Ajuda no GameTextForPlayer - Japis - 16.02.2019

Remova do topo:
Код:
forward UpdatePlayecar(playerid);
e adicione antes da public abaixo:

Код:
forward UpdatePlayercar(playerid);
public UpdatePlayercar(playerid) {

	new playervehicle;
	if ( (playervehicle = GetPlayerVehicleID(playerid)) != INVALID_VEHICLE_ID) {

         	new  lu, alar, por, cap, porma, ob;
		new carro = GetPlayerVehicleID(playerid);
		static Float:health;
		GetVehicleHealth(GetPlayerVehicleID(playerid),health);
		if(health <= 350)
		{

			SendClientMessage(playerid, VERMELHO_COR, "Seu motor estragou");
 			SetVehicleParamsEx(carro, VEHICLE_PARAMS_OFF, lu, alar, por, cap, porma, ob);
                        HidePlayercar(playerid);
 			Playercar[playerid] = false ;
                        KillTimer(PlayerTimerCar[playerid]);
			return 0;
		}
}
	return 1;
}



Re: Ajuda no GameTextForPlayer - KrosmoStewart - 16.02.2019

Continua o msm

Код:
F:\Users\krosmo\Desktop\samp GM\gamemodes\SSAML.pwn(286) : warning 235: public function lacks forward declaration (symbol "UpdatePlayercar")
F:\Users\krosmo\Desktop\samp GM\gamemodes\SSAML.pwn(292) : warning 204: symbol is assigned a value that is never used: "string_velo"
F:\Users\krosmo\Desktop\samp GM\gamemodes\SSAML.pwn(290) : warning 204: symbol is assigned a value that is never used: "playervehicle"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Warnings.



Re: Ajuda no GameTextForPlayer - Japis - 16.02.2019

Estranho eu removi elas do cуdigo nгo eram pra dar warning mais pesquise na sua game mode por : string_velo

se achar algo apague.

Se vocк tiver discord passa pra mim que fica mais fбcil de nos comunicarmos.

Mesmo com os warnings experimente depois entrar no servidor e testar as funзхes.


Re: Ajuda no GameTextForPlayer - KrosmoStewart - 16.02.2019

Quote:
Originally Posted by Japis
Посмотреть сообщение
Estranho eu removi elas do cуdigo nгo eram pra dar warning mais pesquise na sua game mode por : string_velo

se achar algo apague.

Se vocк tiver discord passa pra mim que fica mais fбcil de nos comunicarmos.

Mesmo com os warnings experimente depois entrar no servidor e testar as funзхes.
Krosmo_Stewart#0468 <--- esse й o meu Discord


Re: Ajuda no GameTextForPlayer - KrosmoStewart - 17.02.2019

Ja foi resolvido obg.