01.08.2014, 00:50
Titulo.
#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);