[Ayuda] Traba en autos
#3

https://sampwiki.blast.hk/wiki/PutPlayerInVehicle
https://sampwiki.blast.hk/wiki/OnPlayerStateChange
https://sampwiki.blast.hk/wiki/GetPlayerVehicleSeat
https://sampwiki.blast.hk/wiki/GetPlayerVehicleID
https://sampwiki.blast.hk/wiki/OnPlayerEnterVehicle

pawn Код:
new bool:Asegurado[MAX_PLAYERS],
VehiculoAsegurado[MAX_PLAYERS],
AsientoAsegurado[MAX_PLAYERS],
bool:VehiculoBloqueado[MAX_VEHICLES];
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate){

    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER){ //cuando sube al vehiculo
        if(Asegurado[playerid] == false){
            SendClientMessage(playerid,-1,"no tienes seguro");
        }
    }

    if(newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER){ //cuando baja del vehiculo
        if(Asegurado[playerid] == true){
            SendClientMessage(playerid,-1,"si tienes seguro");
            PutPlayerInVehicle(playerid, VehiculoAsegurado[playerid], AsientoAsegurado[playerid]);
        }
    }

    return true;
}
pawn Код:
// en el comando para colocar el seguro
new vehicleid = GetPlayerVehicleID(playerid);
Asegurado[playerid] = true;
VehiculoAsegurado[playerid] = vehicleid;
AsientoAsegurado[playerid] = GetPlayerVehicleSeat(playerid);
pawn Код:
// en el comando para quitar el seguro
new vehicleid = GetPlayerVehicleID(playerid);
Asegurado[playerid] = false;
VehiculoAsegurado[playerid] = -1;
AsientoAsegurado[playerid] = -1;
pawn Код:
//en el comando para bloquear el vehiculo
new vehicleid = GetPlayerVehicleID(playerid);
VehiculoBloqueado[vehicleid] = true;
pawn Код:
//en el comando para desbloquear el vehiculo
new vehicleid = GetPlayerVehicleID(playerid);
VehiculoBloqueado[vehicleid] = false;
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger){

    if(VehiculoBloqueado[vehicleid] == true){
        SendClientMessage(playerid,-1,"el vehiculo esta bloqueado");
        RemovePlayerFromVehicle(playerid);
    }

    return true;
}
Reply


Messages In This Thread
[Ayuda] Traba en autos - by CharX - 29.01.2014, 22:27
Respuesta: [Ayuda] Traba en autos - by CrossOv3r - 29.01.2014, 22:38
Respuesta: [Ayuda] Traba en autos - by OTACON - 29.01.2014, 22:43

Forum Jump:


Users browsing this thread: 3 Guest(s)