SA-MP Forums Archive
[Pedido]Restringir veнculos sу para bopes! - 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: [Pedido]Restringir veнculos sу para bopes! (/showthread.php?tid=247068)



[Pedido]Restringir veнculos sу para bopes! - Nake01 - 07.04.2011

Olб galera, veja bem o meu pedido eu gostaria de pedir pra ver se alguem consegue me ajudar, queria um filescript para que os veiculos da policia como 490.... sуmente os bopes conseguem pegar quando algum outro player que nгo for do bope for pegar ele nгo conseguir pegar.

vejгo meu LOOP

new levelbope[MAX_PLAYERS];

e ENUM

pBOPE,

no caso entгo o PlayerInfo para somente os bopes pegarem

if(PlayerInfo[playerid][pBOPE] >= 1)

Grato desde jб!


Re: [PEDIDO]RESTRINGIR VEICULOS SУ PARA BOPES ! - Diogo_Bras - 07.04.2011

pawn Код:
new BOPE[MAX_PLAYERS];
new Veiculo;

//OnGameModeInit
Veiculo = CreateVehicle(ID, Cord:x, Cord:y, Cord:Z, angle, cor1, cor2, 50000);

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER && BOPE[playerid]=1) != 0
    GetPlayerVehicleID(playerid) ==  Veiculo)
    {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid, 0xFFF000AA, "[BOPE] Vocк nгo tem autorizaзгo para usar este veнculo!");
    }
    return 1;
}



Re: [PEDIDO]RESTRINGIR VEICULOS SУ PARA BOPES ! - zSuYaNw - 07.04.2011

Menas linhas.

pawn Код:
#define BOPE 0
new BOPE[MAX_PLAYERS];
new Veiculo;

//OnGameModeInit
Veiculo = CreateVehicle(ID, Cord:x, Cord:y, Cord:Z, angle, cor1, cor2, 50000);

public OnPlayerEnterVehicle(/* nгo me lembro os parвmetros */)
{
    if(IsPlayerInVehicle(GetPlayerVehicleID(playerid) ==  Veiculo))
    {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid, 0xFFF000AA, "[BOPE] Vocк nгo tem autorizaзгo para usar este veнculo!");
        return 0;
    }
    return 1;
}



Re: [PEDIDO]RESTRINGIR VEICULOS SУ PARA BOPES ! - Diogo_Bras - 07.04.2011

Quote:
Originally Posted by [Full]Garfield[XDB]
Посмотреть сообщение
Menas linhas.

pawn Код:
#define BOPE 0
new BOPE[MAX_PLAYERS];
new Veiculo;

//OnGameModeInit
Veiculo = CreateVehicle(ID, Cord:x, Cord:y, Cord:Z, angle, cor1, cor2, 50000);

public OnPlayerEnterVehicle(/* nгo me lembro os parвmetros */)
{
    if(IsPlayerInVehicle(GetPlayerVehicleID(playerid) ==  Veiculo))
    {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid, 0xFFF000AA, "[BOPE] Vocк nгo tem autorizaзгo para usar este veнculo!");
        return 0;
    }
    return 1;
}
Nesse caso o "new BOPE[MAX_PLAYERS];" nгo estб a fazer NADA. E nгo defini que o "Veiculo" й sу dos BOPE...
O que vocк fez foi:
TODOS os jogadores que entrarem no "Veiculo" sгo removidos!


Re: [PEDIDO]RESTRINGIR VEICULOS SУ PARA BOPES ! - Nake01 - 07.04.2011

nгo estб removendo


Re: [PEDIDO]RESTRINGIR VEICULOS SУ PARA BOPES ! - Diogo_Bras - 07.04.2011

Sу nгo remove ou tambйm nгo manda a mensagem?


Re: [PEDIDO]RESTRINGIR VEICULOS SУ PARA BOPES ! - Nake01 - 07.04.2011

nenhum dos dois ! nem manda menssagem nem tira do carro.


Re: [PEDIDO]RESTRINGIR VEICULOS SУ PARA BOPES ! - Diogo_Bras - 07.04.2011

Topo do gamemode:
pawn Код:
#define BOPE 0
new Carro;
new Profissao[MAX_PLAYERS];
OnGameModeInit:
pawn Код:
Carro= CreateVehicle(ID, Cord:x, Cord:y, Cord:z, Cor1, Cor2, TempoRespawn);
Public que checa quando alguйm entra no veнculo:
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
   new Veiculo = GetPlayerVehicleID(playerid);
 
   if(newstate == PLAYER_STATE_DRIVER)
   {
      if(Veiculo == Carro)
      {
         if(Profissao[playerid] != BOPE)
         {
            SendClientMessage(playerid, 0xFFFFFFAA, "[BOPE] Vocк nгo tem autorizaзгo para usar este veнculo!");
            RemovePlayerFromVehicle(playerid);
         }
      }
   }
   return 1;
}



Re: [PEDIDO]RESTRINGIR VEICULOS SУ PARA BOPES ! - zSuYaNw - 07.04.2011

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(IsPlayerInVehicle(playerid, Veiculo)
    {
        if(Profissao[playerid] != BOPE)
        {
            // Se o PlayerEstiver no veiculo
            SendClientMessage(playerid, COLOR_RED,"[ERRO] Osteres n'on йis dos bops");
            return false;
        }
   }
   return true;
}



Re: [PEDIDO]RESTRINGIR VEICULOS SУ PARA BOPES ! - Nake01 - 07.04.2011

NГO QUER IR AMIGO QUANDO BOTO ESSE CODIGO O SAMP-SERVER NГO ABRE E NO LOG DELE APARECE ISSO



SA-MP Dedicated Server
----------------------
v0.3c, ©2005-2010 SA-MP Team

[14:44:22]
[14:44:22] Server Plugins
[14:44:22] --------------
[14:44:22] Loaded 0 plugins.

[14:44:22] I couldn't load any gamemode scripts. Please verify your server.cfg
[14:44:22] It needs a gamemode0 line at the very least.