SA-MP Forums Archive
Como poner autos/motos en renta.. - 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: Español/Spanish (https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: Como poner autos/motos en renta.. (/showthread.php?tid=529202)



Como poner autos/motos en renta.. - Fagrinht - 01.08.2014

Titulo.


Respuesta: Como poner autos/motos en renta.. - OTACON - 01.08.2014

EJEMPLO...
pawn Код:
#define MAX_RENTABLES (7)
new CochesRentables[MAX_RENTABLES];
new bool:RentandoCoche[MAX_PLAYERS];

public OnFilterScriptInit(){
    CochesRentables[0] = AddStaticVehicleEx(...);
    CochesRentables[1] = AddStaticVehicleEx(...);
    CochesRentables[2] = AddStaticVehicleEx(...);
    CochesRentables[3] = AddStaticVehicleEx(...);
    CochesRentables[5] = AddStaticVehicleEx(...);
    CochesRentables[6] = AddStaticVehicleEx(...);
}

public OnPlayerStateChange(playerid, newstate, oldstate){
    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER){
        new vehicleid = GetPlayerVehicleID(playerid);
        for(new rentar=0; rentar<MAX_RENTABLES; rentar++){
            if(vehicleid!=CochesRentables[rentar])continue;
            if(vehicleid==CochesRentables[rentar]){
                if(!RentandoCoche[playerid]){
                    //no estas rentando el coche
                    RemovePlayerFromVehicle(playerid);
                    SendClientMessage(playerid, -1, "adios, no esta autorizado a usa este coche!.");
                }else{
                    //estas retando el coche
                    SendClientMessage(playerid, -1, "hola, este es tu coche rentado!.");
                }
            }
        }
    }
}

#define RentarCoche(%0,%1) if(IsPlayerInVehicle(%0, %1)) RentandoCoche[%0]=true
native RentarCoche(playerid,vehicleid);

#define DesrentarCoche(%0,%1) if(IsPlayerInVehicle(%0, %1)) RentandoCoche[%0]=false
native DesrentarCoche(playerid,vehicleid);