[Ajuda] Zumbis nгo dirigem + Alarme
#1

Bom estб funcionando certinho, sу que os zumbis podem apertar G no veiculo e ficar de boa no carro do humano, muito escroto, quando o zumbi entra no carro de enter, da um aviso e remove ele do carro:

pawn Код:
if(newstate == PLAYER_STATE_DRIVER && Team[playerid] == ZOMBIE)
    {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid,white,"* "cred"[x] Vocк й um zumbi e nгo pode dirigir.");
    }
eu queria que acontecesse a mesma coisa quando ele entrasse de carona (g)

Outra coisa que eu queria pedir, (procurei e n achei), um sistema assim em que todos os veiculos do servidor ficassem com o farol dianteiro e traseiro piscando + buzinando, e quando a pessoa entrasse no carro parava, ou seja й um servidor apocalypse, ia ficar massa um sistema assim, nem precisa ser todos os veiculos, mas se alguem conseguir fazer, ja tentei usar o setplayerparams algo assim vi na wiki e nao consegui.

@Edit SetVehicleParamsEx
pawn Код:
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective); //
acho que й isso ai, mas onde eu coloco? eu nгo quero que quando o cara entra no carro comeзa o alarme, eu quero q o alarme ja fica no carro disparando sem parar, ai quando ele entra no carro o alarme para, entendeu?
Reply
#2

pawn Код:
if( (newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER) && Team[playerid] == ZOMBIE) {

    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid,white,"* "cred"[x] Vocк й um zumbi e nгo pode dirigir.");
    return 1;
}
@editado

Existe um jeito bem melhor de fazer isto.

pawn Код:
public OnGameModeInit() {

    static i;

    for ( i = 1; i <= MAX_VEHICLES; ++i ) {

        SetVehicleParamsEx(i, 1, 1, 1, 1, 0, 0, 0);
    }
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate) {

    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER) {

        static
            engine,
            lights,
            alarm,
            doors,
            bonnet,
            boot,
            objective,
            vehicleid
        ;

        vehicleid = GetPlayerVehicleID(playerid);

        GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
        SetVehicleParamsEx(vehicleid, engine, lights, 0, doors, bonnet, boot, objective);
    }
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid) {

    static
        engine,
        lights,
        alarm,
        doors,
        bonnet,
        boot,
        objective
    ;

    GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
    SetVehicleParamsEx(vehicleid, engine, lights, 1, doors, bonnet, boot, objective);

    return 1;
}
Reply
#3

Quote:
Originally Posted by iCasTiel
Посмотреть сообщение
[...]
Уtimo uso do static... mas pode ser mais otimizado

pawn Код:
public OnGameModeInit() {

    static i;


    // Percorrer em todos os veнculos EXISTENTES!
     for ( i = 1; GetVehicleModel(i) ^ 0; ++i ) {
        SetVehicleParamsEx(i, 1, 1, 1, 1, 0, 0, 0);
    }
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate) {

    static
        engine,lights,alarm,doors,bonnet,boot,objective,vehicleid
    ;


    vehicleid = GetPlayerVehicleID(playerid);

    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER) {

        GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
        SetVehicleParamsEx(vehicleid, engine, lights, 0, doors, bonnet, boot, objective);
    }

    if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT){
        GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
        SetVehicleParamsEx(vehicleid, engine, lights, 1, doors, bonnet, boot, objective);
    }
    return 1;
}
Reply
#4

cara deu varios warnings tipo numers of matchin sei la do que na linha do for i algo assim, ai eu troquei de i para ii
vai dar problema? (resolveu os warnings)
Reply
#5

Quote:
Originally Posted by zSuYaNw
Посмотреть сообщение
Уtimo uso do static... mas pode ser mais otimizado

pawn Код:
public OnGameModeInit() {

    static i;


    // Percorrer em todos os veнculos EXISTENTES!
     for ( i = 1; GetVehicleModel(i) ^ 0; ++i ) {
        SetVehicleParamsEx(i, 1, 1, 1, 1, 0, 0, 0);
    }
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate) {

    static
        engine,lights,alarm,doors,bonnet,boot,objective,vehicleid
    ;


    vehicleid = GetPlayerVehicleID(playerid);

    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER) {

        GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
        SetVehicleParamsEx(vehicleid, engine, lights, 0, doors, bonnet, boot, objective);
    }

    if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT){
        GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
        SetVehicleParamsEx(vehicleid, engine, lights, 1, doors, bonnet, boot, objective);
    }
    return 1;
}


Lembrando que quando o jogador estiver a pй nгo й possнvel "getar" o ID do veнculo como foi feito acima.

Quote:
Originally Posted by eNtinityGaming
Посмотреть сообщение
cara deu varios warnings tipo numers of matchin sei la do que na linha do for i algo assim, ai eu troquei de i para ii
vai dar problema? (resolveu os warnings)
Poste as linhas relacionadas aos erros/warings, assim fica mais fбcil lhe ajudar.
Reply
#6

Quote:
Originally Posted by eNtinityGaming
Посмотреть сообщение
cara deu varios warnings tipo numers of matchin sei la do que na linha do for i algo assim, ai eu troquei de i para ii
vai dar problema? (resolveu os warnings)
й porque vocк ja tinha o 'i' Definido, pode ser trocado sim.

@Obs

Troque por um J ou um K que й para evitar conflitos futuros
Reply
#7

nгo funcionou o alarme, + alguem?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)