29.01.2014, 22:43
(
Последний раз редактировалось OTACON; 29.01.2014 в 23:20.
Причина: agregado OnPlayerEnterVehicle...
)
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
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;
}