SA-MP Forums Archive
[Ajuda] Problemas com o "else" - 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] Problemas com o "else" (/showthread.php?tid=606629)



Problemas com o "else" - Thompsoon - 07.05.2016

O que tento fazer й um comando (teste), que funcione apenas para quem estб em um determinado veнculo, o problema й que se eu digitar esse comando em qualquer carro vai aparecer sempre a mesma mensagem. "NEGATIVO"

pawn Код:
if(strcmp("/iniciarteste", cmdtext, true) == 0)
        {
            if(IsPlayerInVehicle(playerid, 585))
            {
                SendClientMessage(playerid, COLOR_GREEN, "AFIRMATIVO");
            } else {
                SendClientMessage(playerid, COLOR_GREEN, "NEGATIVO");
            }
            return 1;
        }



Re: Problemas com o "else" - SaDaN - 07.05.2016

https://sampwiki.blast.hk/wiki/GetVehicleModel

Exemplo:
Код:
if(GetPlayerVehicleModel(GetPlayerVehicleID(playerid)) == 585) SendClientMessage(playerid, -1, "Afirmativo");
else SendClientMessage(playerid, -1, "Negativo");



Re: Problemas com o "else" - willttoonn - 07.05.2016

Tente:
if(strcmp("/iniciarteste", cmdtext, true) == 0)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 585)
{
SendClientMessage(playerid, COLOR_GREEN, "AFIRMATIVO");
} else {
SendClientMessage(playerid, COLOR_GREEN, "NEGATIVO");
}
return 1;
}


Re: Problemas com o "else" - ipsLuan - 07.05.2016

PHP код:
VehicleID != ModelVehicle 



Re: Problemas com o "else" - ClaudineiCDS - 07.05.2016

Код:
if(strcmp("/iniciarteste", cmdtext, true) == 0)
{
     if(GetVehicleModel(GetPlayerVehicleID(playerid)) != 585)
	 return SendClientMessage(playerid, -1, "Negativo");

     SendClientMessage(playerid, -1, "Positivo");
     return true;
}



Re: Problemas com o "else" - Thompsoon - 08.05.2016

Valeu a todos foi resolvido