[Ajuda] Veнculo Desligado
#1

Eu fiz um comando simples de ligar veнculo... Desligar tambйm!
Sу que quando eu entro no veнculo, Ele jб estб ligado! Como vou fazer para que eu entre no veнculo e ele esteja DESLIGADO? Ai eu uso o comando /ligarveiculo pra ligar..
Reply
#2

ManualVehicleEngineAndLights
Reply
#3

Olha uma base
Код:
if(!CarrosVIP(vid))
			{
                if(EngineCarro[vid] == 0)
		        {
                     GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            	     SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
            	     SendClientMessage(playerid, 0xFFFFFFFF, "Veiculo: {228B22}Ligado!");
            	     EngineCarro[vid] = 1;
    		    }
0 = LIGADO | 1 = DESLIGADO -
Reply
#4

Quote:
Originally Posted by M0yy
Посмотреть сообщение
Eu adicionei isso em public OnGameModeInit!
Mas deixou de funcionar os comandos do meu servidor...
Toda vez que eu tento usar um comando aparece: Vocк nгo estб em um veiculo!
Sу funciona os comandos "/LigarVeiculo" e "/DesligarVeнculo" !
Help?
Reply
#5

Criei um pequeno exemplo pra vocк

PHP код:
new CarrosServe[2]; //carros do seu servidor
new enginelightsalarmdoorsbonnetbootobjective//variaveis para usar nos params do veiculo
public OnGameModeInit()
{
    
//CarrosServe[0] = //createvehicle ou AddStaticVehicle ou da maneira q estiver no seu gamemode
    //CarrosServe[1] = //
    
    
for(new 0sizeof(CarrosServe); i++)
    {
        
GetVehicleParamsEx(CarrosServe[i], enginelightsalarmdoorsbonnetbootobjective);
        
SetVehicleParamsEx(CarrosServe[i], VEHICLE_PARAMS_OFFlightsalarmdoorsbonnetbootobjective);
    }
    return 
1;

Reply
#6

Continua a mesma coisa!
Reply
#7

colocou o esse loop:

PHP код:
    for(new 0sizeof(CarrosServe); i++) 
    { 
        
GetVehicleParamsEx(CarrosServe[i], enginelightsalarmdoorsbonnetbootobjective); 
        
SetVehicleParamsEx(CarrosServe[i], VEHICLE_PARAMS_OFFlightsalarmdoorsbonnetbootobjective); 
    } 
no final da public ongamemodeinit ?
Reply
#8

Achei aqui na internet esse filterscript, provavelmente й funcional.

pawn Код:
/* ---------------------------------- */
// Engine System
// Create: Pawno Scripter
//
/* ---------------------------------- */


/* ---------------------------------- */
// Includes
#include <a_samp>
#include <zcmd>
/* ---------------------------------- */

/* ---------------------------------- */
// Defines / Variables
new Engine[MAX_VEHICLES];
new Lights[MAX_VEHICLES];
/* ---------------------------------- */

/* ---------------------------------- */
// Color Defines
#define COLOR_AQUA        0x7CFC00AA
#define COLOR_GREY        0xAFAFAFAA
#define COLOR_GREEN       0x33AA33AA
#define COLOR_BRIGHTRED   0xFF0000AA
#define COLOR_DARKRED     0xC60000FF
#define COLOR_YELLOW      0xFFFF00AA
/* ---------------------------------- */

public OnFilterScriptInit()
{
    ManualVehicleEngineAndLights();
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    Engine[vehicleid] = 0;
    Lights[vehicleid] = 0;
    return 1;
}

COMMAND:motor(playerid, params[])
{
    if(strcmp(params,"ligar",true) == 0)
    {
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new Vehicle = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            SendClientMessage(playerid, COLOR_GREEN, "Motor ligado!");
            Engine[Vehicle] = 1, SetVehicleParamsEx(Vehicle, 1, lights, alarm, doors, bonnet, boot, objective);
        }
    }
    if(strcmp(params,"desligar",true) == 0)
    {
         if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new Vehicle = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            SendClientMessage(playerid, COLOR_DARKRED, "Motor desligado!");
            Engine[Vehicle] = 0, SetVehicleParamsEx(Vehicle, 0, lights, alarm, doors, bonnet, boot, objective);
        }
    }
    return 1;
}

COMMAND:farois(playerid, params[])
{
    if(strcmp(params,"ligar",true) == 0)
    {
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new Vehicle = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            SendClientMessage(playerid, COLOR_YELLOW, "Farois ligado!");
            Lights[Vehicle] = 1, SetVehicleParamsEx(Vehicle, engine, 1, alarm, doors, bonnet, boot, objective);
        }
    }
    if(strcmp(params,"desligar",true) == 0)
    {
         if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new Vehicle = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            SendClientMessage(playerid, COLOR_YELLOW, "Farois desligado!");
            Lights[Vehicle] = 0, SetVehicleParamsEx(Vehicle, engine, 0, alarm, doors, bonnet, boot, objective);
        }
    }
    return 1;
}
COMMAND:capo(playerid, params[])
{
    if(strcmp(params,"abrir",true) == 0)
    {
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new Vehicle = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            SendClientMessage(playerid, COLOR_YELLOW, "Capo aberto!");
            Lights[Vehicle] = 1, SetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, 1, boot, objective);
        }
    }
    if(strcmp(params,"fechar",true) == 0)
    {
         if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new Vehicle = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            SendClientMessage(playerid, COLOR_YELLOW, "Capo fechado!");
            Lights[Vehicle] = 0, SetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, 0, boot, objective);
        }
    }
    return 1;
}
COMMAND:portamalas(playerid, params[])
{
    if(strcmp(params,"abrir",true) == 0)
    {
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new Vehicle = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            SendClientMessage(playerid, COLOR_YELLOW, "Porta-malas aberto!");
            Lights[Vehicle] = 1, SetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, 1, objective);
        }
    }
    if(strcmp(params,"fechar",true) == 0)
    {
         if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new Vehicle = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            SendClientMessage(playerid, COLOR_YELLOW, "Porta-malas fechado!");
            Lights[Vehicle] = 0, SetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, 0, objective);
        }
    }
    return 1;
}
Tambйm precisa ter a include zcmd
Reply
#9

Nгo gosto muito de usar Filter... Prefiro adicionar no GM!
Entгo.. Obrigado a todos que ajudaram! Agora preciso de que quando o player entra no carro apareзa a mensagem para ele ligar! Qual funзгo posso usar?

E tambйm, Alguйm sabe de um site que deixa o cуdigo correto? Ou seja, Sem Lose indentation (Nгo sei como pronunciar/escrever)
Reply
#10

https://sampwiki.blast.hk/wiki/OnPlayerEnterVehicle
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)